From d7dcc9c52dee2c75482657397bba7229b125469e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20=C4=86wirko?= Date: Sat, 13 May 2023 11:51:47 +0200 Subject: [PATCH] update dependencies --- CHANGELOG.md | 3 + build/elven.js | 34 +-- esbuild.config.cjs | 2 +- example/elven.js | 34 +-- package-lock.json | 728 +++++++++++++++++++++++---------------------- package.json | 20 +- 6 files changed, 411 insertions(+), 410 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aad8f02..1423148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### [0.9.1](https://github.com/juliancwirko/elven.js/releases/tag/v0.9.1) (2023-05-13) +- update dependencies: sdk-core, sdk-web-wallet-provider and others + ### [0.9.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.9.0) (2023-04-10) - migrate to MultiversX JS SDK 12.1.0 **(breaking changes):** - `TokenPayment` is now `TokenTransfer` diff --git a/build/elven.js b/build/elven.js index 9d213ba..d21dd97 100644 --- a/build/elven.js +++ b/build/elven.js @@ -1,13 +1,9 @@ -var zR=Object.create;var uc=Object.defineProperty,WR=Object.defineProperties,$R=Object.getOwnPropertyDescriptor,YR=Object.getOwnPropertyDescriptors,JR=Object.getOwnPropertyNames,R_=Object.getOwnPropertySymbols,XR=Object.getPrototypeOf,F_=Object.prototype.hasOwnProperty,ZR=Object.prototype.propertyIsEnumerable;var L_=(t,e,r)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oo=(t,e)=>{for(var r in e||={})F_.call(e,r)&&L_(t,r,e[r]);if(R_)for(var r of R_(e))ZR.call(e,r)&&L_(t,r,e[r]);return t},M_=(t,e)=>WR(t,YR(e));var U_=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ot=(t,e)=>{for(var r in e)uc(t,r,{get:e[r],enumerable:!0})},lf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of JR(e))!F_.call(t,i)&&i!==r&&uc(t,i,{get:()=>e[i],enumerable:!(n=$R(e,i))||n.enumerable});return t},Lt=(t,e,r)=>(lf(t,e,"default"),r&&lf(r,e,"default")),_e=(t,e,r)=>(r=t!=null?zR(XR(t)):{},lf(e||!t||!t.__esModule?uc(r,"default",{value:t,enumerable:!0}):r,t)),rt=t=>lf(uc({},"__esModule",{value:!0}),t);var Ce=(t,e,r)=>new Promise((n,i)=>{var s=u=>{try{a(r.next(u))}catch(l){i(l)}},o=u=>{try{a(r.throw(u))}catch(l){i(l)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((r=r.apply(t,e)).next())});var j0=v(ff=>{"use strict";c();ff.byteLength=tL;ff.toByteArray=nL;ff.fromByteArray=oL;var Gr=[],lr=[],eL=typeof Uint8Array<"u"?Uint8Array:Array,V0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(us=0,q_=V0.length;us0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function tL(t){var e=V_(t),r=e[0],n=e[1];return(r+n)*3/4-n}function rL(t,e,r){return(e+r)*3/4-r}function nL(t){var e,r=V_(t),n=r[0],i=r[1],s=new eL(rL(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=lr[t.charCodeAt(u)]<<2|lr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=lr[t.charCodeAt(u)]<<10|lr[t.charCodeAt(u+1)]<<4|lr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function iL(t){return Gr[t>>18&63]+Gr[t>>12&63]+Gr[t>>6&63]+Gr[t&63]}function sL(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Gr[e>>2]+Gr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Gr[e>>10]+Gr[e>>4&63]+Gr[e<<2&63]+"=")),i.join("")}});var G0=v(H0=>{c();H0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,y=r?-1:1,w=t[e+d];for(d+=y,s=w&(1<<-f)-1,w>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=y,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=y,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};H0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,E=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=y/u:e+=y*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=N*128}});var Z_=v(Bo=>{"use strict";c();var Q0=j0(),Po=G0(),j_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Bo.Buffer=W;Bo.SlowBuffer=hL;Bo.INSPECT_MAX_BYTES=50;var hf=2147483647;Bo.kMaxLength=hf;W.TYPED_ARRAY_SUPPORT=aL();!W.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function aL(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(W.prototype,"parent",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.buffer}});Object.defineProperty(W.prototype,"offset",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.byteOffset}});function On(t){if(t>hf)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,W.prototype),e}function W(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return W0(t)}return Q_(t,e,r)}W.poolSize=8192;function Q_(t,e,r){if(typeof t=="string")return cL(t,e);if(ArrayBuffer.isView(t))return lL(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Qr(t,ArrayBuffer)||t&&Qr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Qr(t,SharedArrayBuffer)||t&&Qr(t.buffer,SharedArrayBuffer)))return K0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return W.from(n,e,r);var i=fL(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return W.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}W.from=function(t,e,r){return Q_(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function k_(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function uL(t,e,r){return k_(t),t<=0?On(t):e!==void 0?typeof r=="string"?On(t).fill(e,r):On(t).fill(e):On(t)}W.alloc=function(t,e,r){return uL(t,e,r)};function W0(t){return k_(t),On(t<0?0:$0(t)|0)}W.allocUnsafe=function(t){return W0(t)};W.allocUnsafeSlow=function(t){return W0(t)};function cL(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=K_(t,e)|0,n=On(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function k0(t){for(var e=t.length<0?0:$0(t.length)|0,r=On(e),n=0;n=hf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hf.toString(16)+" bytes");return t|0}function hL(t){return+t!=t&&(t=0),W.alloc(+t)}W.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==W.prototype};W.compare=function(e,r){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),Qr(r,Uint8Array)&&(r=W.from(r,r.offset,r.byteLength)),!W.isBuffer(e)||!W.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?W.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(W.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function K_(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Qr(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return X_(t).length;default:if(i)return n?-1:z0(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=K_;function dL(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return bL(this,e,r);case"utf8":case"utf-8":return W_(this,e,r);case"ascii":return AL(this,e,r);case"latin1":case"binary":return _L(this,e,r);case"base64":return EL(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IL(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function cs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}W.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};j_&&(W.prototype[j_]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),!W.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=W.from(e,n)),W.isBuffer(e))return e.length===0?-1:H_(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):H_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function H_(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,y=0;yi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return pL(this,e,r,n);case"utf8":case"utf-8":return gL(this,e,r,n);case"ascii":case"latin1":case"binary":return yL(this,e,r,n);case"base64":return mL(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wL(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};W.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function EL(t,e,r){return e===0&&r===t.length?Q0.fromByteArray(t):Q0.fromByteArray(t.slice(e,r))}function W_(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return vL(n)}var G_=4096;function vL(t){var e=t.length;if(e<=G_)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};W.prototype.readUint8=W.prototype.readUInt8=function(e,r){return e=e>>>0,r||Tt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Tt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Tt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};W.prototype.readUint32BE=W.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Tt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Tt(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Tt(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};W.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),Po.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),Po.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Tt(e,8,this.length),Po.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Tt(e,8,this.length),Po.read(this,e,!1,52,8)};function Jt(t,e,r,n,i,s){if(!W.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}W.prototype.writeUintLE=W.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,255,0),this[r]=e&255,r+1};W.prototype.writeUint16LE=W.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeUint16BE=W.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeUint32LE=W.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};W.prototype.writeUint32BE=W.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};W.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};W.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function $_(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y_(t,e,r,n,i){return e=+e,r=r>>>0,i||$_(t,e,r,4,34028234663852886e22,-34028234663852886e22),Po.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return Y_(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return Y_(this,e,r,!1,n)};function J_(t,e,r,n,i){return e=+e,r=r>>>0,i||$_(t,e,r,8,17976931348623157e292,-17976931348623157e292),Po.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return J_(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return J_(this,e,r,!1,n)};W.prototype.copy=function(e,r,n,i){if(!W.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function TL(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function X_(t){return Q0.toByteArray(CL(t))}function df(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Qr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Y0(t){return t!==t}var NL=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var ib=v((AX,nb)=>{c();var ft=nb.exports={},kr,Kr;function J0(){throw new Error("setTimeout has not been defined")}function X0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?kr=setTimeout:kr=J0}catch{kr=J0}try{typeof clearTimeout=="function"?Kr=clearTimeout:Kr=X0}catch{Kr=X0}})();function eb(t){if(kr===setTimeout)return setTimeout(t,0);if((kr===J0||!kr)&&setTimeout)return kr=setTimeout,setTimeout(t,0);try{return kr(t,0)}catch{try{return kr.call(null,t,0)}catch{return kr.call(this,t,0)}}}function DL(t){if(Kr===clearTimeout)return clearTimeout(t);if((Kr===X0||!Kr)&&clearTimeout)return Kr=clearTimeout,clearTimeout(t);try{return Kr(t)}catch{try{return Kr.call(null,t)}catch{return Kr.call(this,t)}}}var Pn=[],Ro=!1,ls,pf=-1;function OL(){!Ro||!ls||(Ro=!1,ls.length?Pn=ls.concat(Pn):pf=-1,Pn.length&&tb())}function tb(){if(!Ro){var t=eb(OL);Ro=!0;for(var e=Pn.length;e;){for(ls=Pn,Pn=[];++pf1)for(var r=1;r{h=_e(Z_()),p=_e(ib()),PL=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=PL});var Wt=v((sb,gf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,y=1e9;function w(P){var B,_,S,F=q.prototype={constructor:q,toString:null,valueOf:null},Z=new q(1),K=20,H=4,G=-7,$=21,pe=-1e7,ae=1e7,re=!1,Y=1,ie=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ne="0123456789abcdefghijklmnopqrstuvwxyz";function q(g,m){var A,O,I,D,L,C,U,j,V=this;if(!(V instanceof q))return new q(g,m);if(m==null){if(g&&g._isBigNumber===!0){V.s=g.s,!g.c||g.e>ae?V.c=V.e=null:g.e=10;L/=10,D++);D>ae?V.c=V.e=null:(V.e=D,V.c=[g]);return}j=String(g)}else{if(!r.test(j=String(g)))return S(V,j,C);V.s=j.charCodeAt(0)==45?(j=j.slice(1),-1):1}(D=j.indexOf("."))>-1&&(j=j.replace(".","")),(L=j.search(/e/i))>0?(D<0&&(D=L),D+=+j.slice(L+1),j=j.substring(0,L)):D<0&&(D=j.length)}else{if(M(m,2,ne.length,"Base"),m==10)return V=new q(g),se(V,K+V.e+1,H);if(j=String(g),C=typeof g=="number"){if(g*0!=0)return S(V,j,C,m);if(V.s=1/g<0?(j=j.slice(1),-1):1,q.DEBUG&&j.replace(/^0\.0*|\./,"").length>15)throw Error(o+g)}else V.s=j.charCodeAt(0)===45?(j=j.slice(1),-1):1;for(A=ne.slice(0,m),D=L=0,U=j.length;LD){D=U;continue}}else if(!I&&(j==j.toUpperCase()&&(j=j.toLowerCase())||j==j.toLowerCase()&&(j=j.toUpperCase()))){I=!0,L=-1,D=0;continue}return S(V,String(g),C,m)}C=!1,j=_(j,m,10,V.s),(D=j.indexOf("."))>-1?j=j.replace(".",""):D=j.length}for(L=0;j.charCodeAt(L)===48;L++);for(U=j.length;j.charCodeAt(--U)===48;);if(j=j.slice(L,++U)){if(U-=L,C&&q.DEBUG&&U>15&&(g>l||g!==i(g)))throw Error(o+V.s*g);if((D=D-L-1)>ae)V.c=V.e=null;else if(D=-y&&I<=y&&I===i(I)){if(O[0]===0){if(I===0&&O.length===1)return!0;break e}if(m=(I+1)%u,m<1&&(m+=u),String(O[0]).length==m){for(m=0;m=a||A!==i(A))break e;if(A!==0)return!0}}}else if(O===null&&I===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},q.maximum=q.max=function(){return oe(arguments,F.lt)},q.minimum=q.min=function(){return oe(arguments,F.gt)},q.random=function(){var g=9007199254740992,m=Math.random()*g&2097151?function(){return i(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var O,I,D,L,C,U=0,j=[],V=new q(Z);if(A==null?A=K:M(A,0,y),L=n(A/u),re)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(L*=2));U>>11),C>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),O[U]=I[0],O[U+1]=I[1]):(j.push(C%1e14),U+=2);U=L/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(L*=7);U=9e15?crypto.randomBytes(7).copy(O,U):(j.push(C%1e14),U+=7);U=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;C/=10,U++);UI-1&&(C[L+1]==null&&(C[L+1]=0),C[L+1]+=C[L]/I|0,C[L]%=I)}return C.reverse()}return function(A,O,I,D,L){var C,U,j,V,X,ye,we,Pe,$e=A.indexOf("."),st=K,De=H;for($e>=0&&(V=ie,ie=0,A=A.replace(".",""),Pe=new q(O),ye=Pe.pow(A.length-$e),ie=V,Pe.c=m(T(N(ye.c),ye.e,"0"),10,I,g),Pe.e=Pe.c.length),we=m(A,O,I,L?(C=ne,g):(C=g,ne)),j=V=we.length;we[--V]==0;we.pop());if(!we[0])return C.charAt(0);if($e<0?--j:(ye.c=we,ye.e=j,ye.s=D,ye=B(ye,Pe,st,De,I),we=ye.c,X=ye.r,j=ye.e),U=j+st+1,$e=we[U],V=I/2,X=X||U<0||we[U+1]!=null,X=De<4?($e!=null||X)&&(De==0||De==(ye.s<0?3:2)):$e>V||$e==V&&(De==4||X||De==6&&we[U-1]&1||De==(ye.s<0?8:7)),U<1||!we[0])A=X?T(C.charAt(1),-st,C.charAt(0)):C.charAt(0);else{if(we.length=U,X)for(--I;++we[--U]>I;)we[U]=0,U||(++j,we=[1].concat(we));for(V=we.length;!we[--V];);for($e=0,A="";$e<=V;A+=C.charAt(we[$e++]));A=T(A,j,C.charAt(0))}return A}}(),B=function(){function g(O,I,D){var L,C,U,j,V=0,X=O.length,ye=I%d,we=I/d|0;for(O=O.slice();X--;)U=O[X]%d,j=O[X]/d|0,L=we*U+j*ye,C=ye*U+L%d*d+V,V=(C/D|0)+(L/d|0)+we*j,O[X]=C%D;return V&&(O=[V].concat(O)),O}function m(O,I,D,L){var C,U;if(D!=L)U=D>L?1:-1;else for(C=U=0;CI[C]?1:-1;break}return U}function A(O,I,D,L){for(var C=0;D--;)O[D]-=C,C=O[D]1;O.splice(0,1));}return function(O,I,D,L,C){var U,j,V,X,ye,we,Pe,$e,st,De,Me,vt,ni,os,as,Yt,Dn,qt=O.s==I.s?1:-1,At=O.c,Qe=I.c;if(!At||!At[0]||!Qe||!Qe[0])return new q(!O.s||!I.s||(At?Qe&&At[0]==Qe[0]:!Qe)?NaN:At&&At[0]==0||!Qe?qt*0:qt/0);for($e=new q(qt),st=$e.c=[],j=O.e-I.e,qt=D+j+1,C||(C=a,j=E(O.e/u)-E(I.e/u),qt=qt/u|0),V=0;Qe[V]==(At[V]||0);V++);if(Qe[V]>(At[V]||0)&&j--,qt<0)st.push(1),X=!0;else{for(os=At.length,Yt=Qe.length,V=0,qt+=2,ye=i(C/(Qe[0]+1)),ye>1&&(Qe=g(Qe,ye,C),At=g(At,ye,C),Yt=Qe.length,os=At.length),ni=Yt,De=At.slice(0,Yt),Me=De.length;Me=C/2&&as++;do{if(ye=0,U=m(Qe,De,Yt,Me),U<0){if(vt=De[0],Yt!=Me&&(vt=vt*C+(De[1]||0)),ye=i(vt/as),ye>1)for(ye>=C&&(ye=C-1),we=g(Qe,ye,C),Pe=we.length,Me=De.length;m(we,De,Pe,Me)==1;)ye--,A(we,Yt=10;qt/=10,V++);se($e,D+($e.e=V+j*u-1)+1,L,X)}else $e.e=j,$e.r=+X;return $e}}();function ce(g,m,A,O){var I,D,L,C,U;if(A==null?A=H:M(A,0,8),!g.c)return g.toString();if(I=g.c[0],L=g.e,m==null)U=N(g.c),U=O==1||O==2&&(L<=G||L>=$)?b(U,L):T(U,L,"0");else if(g=se(new q(g),m,A),D=g.e,U=N(g.c),C=U.length,O==1||O==2&&(m<=D||D<=G)){for(;CC){if(--m>0)for(U+=".";m--;U+="0");}else if(m+=D-C,m>0)for(D+1==C&&(U+=".");m--;U+="0");return g.s<0&&I?"-"+U:U}function oe(g,m){for(var A,O=1,I=new q(g[0]);O=10;I/=10,O++);return(A=O+A*u-1)>ae?g.c=g.e=null:A=10;C/=10,I++);if(D=m-I,D<0)D+=u,L=m,U=X[j=0],V=U/ye[I-L-1]%10|0;else if(j=n((D+1)/u),j>=X.length)if(O){for(;X.length<=j;X.push(0));U=V=0,I=1,D%=u,L=D-u+1}else break e;else{for(U=C=X[j],I=1;C>=10;C/=10,I++);D%=u,L=D-u+I,V=L<0?0:U/ye[I-L-1]%10|0}if(O=O||m<0||X[j+1]!=null||(L<0?U:U%ye[I-L-1]),O=A<4?(V||O)&&(A==0||A==(g.s<0?3:2)):V>5||V==5&&(A==4||O||A==6&&(D>0?L>0?U/ye[I-L]:0:X[j-1])%10&1||A==(g.s<0?8:7)),m<1||!X[0])return X.length=0,O?(m-=g.e+1,X[0]=ye[(u-m%u)%u],g.e=-m||0):X[0]=g.e=0,g;if(D==0?(X.length=j,C=1,j--):(X.length=j+1,C=ye[u-D],X[j]=L>0?i(U/ye[I-L]%ye[L])*C:0),O)for(;;)if(j==0){for(D=1,L=X[0];L>=10;L/=10,D++);for(L=X[0]+=C,C=1;L>=10;L/=10,C++);D!=C&&(g.e++,X[0]==a&&(X[0]=1));break}else{if(X[j]+=C,X[j]!=a)break;X[j--]=0,C=1}for(D=X.length;X[--D]===0;X.pop());}g.e>ae?g.c=g.e=null:g.e=$?b(m,A):T(m,A,"0"),g.s<0?"-"+m:m)}return F.absoluteValue=F.abs=function(){var g=new q(this);return g.s<0&&(g.s=1),g},F.comparedTo=function(g,m){return R(this,new q(g,m))},F.decimalPlaces=F.dp=function(g,m){var A,O,I,D=this;if(g!=null)return M(g,0,y),m==null?m=H:M(m,0,8),se(new q(D),g+D.e+1,m);if(!(A=D.c))return null;if(O=((I=A.length-1)-E(this.e/u))*u,I=A[I])for(;I%10==0;I/=10,O--);return O<0&&(O=0),O},F.dividedBy=F.div=function(g,m){return B(this,new q(g,m),K,H)},F.dividedToIntegerBy=F.idiv=function(g,m){return B(this,new q(g,m),0,1)},F.exponentiatedBy=F.pow=function(g,m){var A,O,I,D,L,C,U,j,V,X=this;if(g=new q(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+ue(g));if(m!=null&&(m=new q(m)),C=g.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!g.c||!g.c[0])return V=new q(Math.pow(+ue(X),C?2-x(g):+ue(g))),m?V.mod(m):V;if(U=g.s<0,m){if(m.c?!m.c[0]:!m.s)return new q(NaN);O=!U&&X.isInteger()&&m.isInteger(),O&&(X=X.mod(m))}else{if(g.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||C&&X.c[1]>=24e7:X.c[0]<8e13||C&&X.c[0]<=9999975e7)))return D=X.s<0&&x(g)?-0:0,X.e>-1&&(D=1/D),new q(U?1/D:D);ie&&(D=n(ie/u+2))}for(C?(A=new q(.5),U&&(g.s=1),j=x(g)):(I=Math.abs(+ue(g)),j=I%2),V=new q(Z);;){if(j){if(V=V.times(X),!V.c)break;D?V.c.length>D&&(V.c.length=D):O&&(V=V.mod(m))}if(I){if(I=i(I/2),I===0)break;j=I%2}else if(g=g.times(A),se(g,g.e+1,1),g.e>14)j=x(g);else{if(I=+ue(g),I===0)break;j=I%2}X=X.times(X),D?X.c&&X.c.length>D&&(X.c.length=D):O&&(X=X.mod(m))}return O?V:(U&&(V=Z.div(V)),m?V.mod(m):D?se(V,ie,H,L):V)},F.integerValue=function(g){var m=new q(this);return g==null?g=H:M(g,0,8),se(m,m.e+1,g)},F.isEqualTo=F.eq=function(g,m){return R(this,new q(g,m))===0},F.isFinite=function(){return!!this.c},F.isGreaterThan=F.gt=function(g,m){return R(this,new q(g,m))>0},F.isGreaterThanOrEqualTo=F.gte=function(g,m){return(m=R(this,new q(g,m)))===1||m===0},F.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},F.isLessThan=F.lt=function(g,m){return R(this,new q(g,m))<0},F.isLessThanOrEqualTo=F.lte=function(g,m){return(m=R(this,new q(g,m)))===-1||m===0},F.isNaN=function(){return!this.s},F.isNegative=function(){return this.s<0},F.isPositive=function(){return this.s>0},F.isZero=function(){return!!this.c&&this.c[0]==0},F.minus=function(g,m){var A,O,I,D,L=this,C=L.s;if(g=new q(g,m),m=g.s,!C||!m)return new q(NaN);if(C!=m)return g.s=-m,L.plus(g);var U=L.e/u,j=g.e/u,V=L.c,X=g.c;if(!U||!j){if(!V||!X)return V?(g.s=-m,g):new q(X?L:NaN);if(!V[0]||!X[0])return X[0]?(g.s=-m,g):new q(V[0]?L:H==3?-0:0)}if(U=E(U),j=E(j),V=V.slice(),C=U-j){for((D=C<0)?(C=-C,I=V):(j=U,I=X),I.reverse(),m=C;m--;I.push(0));I.reverse()}else for(O=(D=(C=V.length)<(m=X.length))?C:m,C=m=0;m0)for(;m--;V[A++]=0);for(m=a-1;O>C;){if(V[--O]=0;){for(A=0,ye=vt[I]%st,we=vt[I]/st|0,L=U,D=I+L;D>I;)j=Me[--L]%st,V=Me[L]/st|0,C=we*j+V*ye,j=ye*j+C%st*st+Pe[D]+A,A=(j/$e|0)+(C/st|0)+we*V,Pe[D--]=j%$e;Pe[D]=A}return A?++O:Pe.splice(0,1),le(g,Pe,O)},F.negated=function(){var g=new q(this);return g.s=-g.s||null,g},F.plus=function(g,m){var A,O=this,I=O.s;if(g=new q(g,m),m=g.s,!I||!m)return new q(NaN);if(I!=m)return g.s=-m,O.minus(g);var D=O.e/u,L=g.e/u,C=O.c,U=g.c;if(!D||!L){if(!C||!U)return new q(I/0);if(!C[0]||!U[0])return U[0]?g:new q(C[0]?O:I*0)}if(D=E(D),L=E(L),C=C.slice(),I=D-L){for(I>0?(L=D,A=U):(I=-I,A=C),A.reverse();I--;A.push(0));A.reverse()}for(I=C.length,m=U.length,I-m<0&&(A=U,U=C,C=A,m=I),I=0;m;)I=(C[--m]=C[m]+U[m]+I)/a|0,C[m]=a===C[m]?0:C[m]%a;return I&&(C=[I].concat(C),++L),le(g,C,L)},F.precision=F.sd=function(g,m){var A,O,I,D=this;if(g!=null&&g!==!!g)return M(g,1,y),m==null?m=H:M(m,0,8),se(new q(D),g,m);if(!(A=D.c))return null;if(I=A.length-1,O=I*u+1,I=A[I]){for(;I%10==0;I/=10,O--);for(I=A[0];I>=10;I/=10,O++);}return g&&D.e+1>O&&(O=D.e+1),O},F.shiftedBy=function(g){return M(g,-l,l),this.times("1e"+g)},F.squareRoot=F.sqrt=function(){var g,m,A,O,I,D=this,L=D.c,C=D.s,U=D.e,j=K+4,V=new q("0.5");if(C!==1||!L||!L[0])return new q(!C||C<0&&(!L||L[0])?NaN:L?D:1/0);if(C=Math.sqrt(+ue(D)),C==0||C==1/0?(m=N(L),(m.length+U)%2==0&&(m+="0"),C=Math.sqrt(+m),U=E((U+1)/2)-(U<0||U%2),C==1/0?m="5e"+U:(m=C.toExponential(),m=m.slice(0,m.indexOf("e")+1)+U),A=new q(m)):A=new q(C+""),A.c[0]){for(U=A.e,C=U+j,C<3&&(C=0);;)if(I=A,A=V.times(I.plus(B(D,I,j,1))),N(I.c).slice(0,C)===(m=N(A.c)).slice(0,C))if(A.e0&&Pe>0){for(D=Pe%C||C,V=we.substr(0,D);D0&&(V+=j+we.slice(D)),ye&&(V="-"+V)}O=X?V+(A.decimalSeparator||"")+((U=+A.fractionGroupSize)?X.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):X):V}return(A.prefix||"")+O+(A.suffix||"")},F.toFraction=function(g){var m,A,O,I,D,L,C,U,j,V,X,ye,we=this,Pe=we.c;if(g!=null&&(C=new q(g),!C.isInteger()&&(C.c||C.s!==1)||C.lt(Z)))throw Error(s+"Argument "+(C.isInteger()?"out of range: ":"not an integer: ")+ue(C));if(!Pe)return new q(we);for(m=new q(Z),j=A=new q(Z),O=U=new q(Z),ye=N(Pe),D=m.e=ye.length-we.e-1,m.c[0]=f[(L=D%u)<0?u+L:L],g=!g||C.comparedTo(m)>0?D>0?m:j:C,L=ae,ae=1/0,C=new q(ye),U.c[0]=0;V=B(C,m,0,1),I=A.plus(V.times(O)),I.comparedTo(g)!=1;)A=O,O=I,j=U.plus(V.times(I=j)),U=I,m=C.minus(V.times(I=m)),C=I;return I=B(g.minus(A),O,0,1),U=U.plus(I.times(j)),A=A.plus(I.times(O)),U.s=j.s=we.s,D=D*2,X=B(j,O,D,H).minus(we).abs().comparedTo(B(U,A,D,H).minus(we).abs())<1?[j,O]:[U,A],ae=L,X},F.toNumber=function(){return+ue(this)},F.toPrecision=function(g,m){return g!=null&&M(g,1,y),ce(this,g,m,2)},F.toString=function(g){var m,A=this,O=A.s,I=A.e;return I===null?O?(m="Infinity",O<0&&(m="-"+m)):m="NaN":(g==null?m=I<=G||I>=$?b(N(A.c),I):T(N(A.c),I,"0"):g===10?(A=se(new q(A),K+I+1,H),m=T(N(A.c),A.e,"0")):(M(g,2,ne.length,"Base"),m=_(T(N(A.c),I,"0"),10,g,O,!0)),O<0&&A.c[0]&&(m="-"+m)),m},F.valueOf=F.toJSON=function(){return ue(this)},F._isBigNumber=!0,P!=null&&q.set(P),q}function E(P){var B=P|0;return P>0||P===B?B:B-1}function N(P){for(var B,_,S=1,F=P.length,Z=P[0]+"";S$^_?1:-1;for(H=(G=F.length)<($=Z.length)?G:$,K=0;KZ[K]^_?1:-1;return G==$?0:G>$^_?1:-1}function M(P,B,_,S){if(P_||P!==i(P))throw Error(s+(S||"Argument")+(typeof P=="number"?P_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(P))}function x(P){var B=P.c.length-1;return E(P.e/u)==B&&P.c[B]%2!=0}function b(P,B){return(P.length>1?P.charAt(0)+"."+P.slice(1):P)+(B<0?"e":"e+")+B}function T(P,B,_){var S,F;if(B<0){for(F=_+".";++B;F+=_);P=F+P}else if(S=P.length,++B>S){for(F=_,B-=S;--B;F+=_);P+=F}else B{"use strict";c();Object.defineProperty(fe,"__esModule",{value:!0});fe.ErrGasLimitShouldBe0ForInnerTransaction=fe.ErrInvalidRelayedV2BuilderArguments=fe.ErrInvalidRelayedV1BuilderArguments=fe.ErrNotImplemented=fe.ErrContractInteraction=fe.ErrCodec=fe.ErrCannotParseTransactionOutcome=fe.ErrCannotParseContractResults=fe.ErrMissingFieldOnEnum=fe.ErrMissingFieldOnStruct=fe.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=fe.ErrTypingSystem=fe.ErrMock=fe.ErrContractHasNoAddress=fe.ErrContract=fe.ErrExpectedTransactionEventsNotFound=fe.ErrExpectedTransactionStatusNotReached=fe.ErrTransactionWatcherTimeout=fe.ErrAsyncTimerAborted=fe.ErrAsyncTimerAlreadyRunning=fe.ErrInvalidFunctionName=fe.ErrSignatureCannotCreate=fe.ErrTransactionOptionsInvalid=fe.ErrTransactionVersionInvalid=fe.ErrNonceInvalid=fe.ErrNotEnoughGas=fe.ErrAddressEmpty=fe.ErrAddressBadHrp=fe.ErrAddressCannotCreate=fe.ErrUnexpectedCondition=fe.ErrInvariantFailed=fe.ErrBadType=fe.ErrUnsupportedOperation=fe.ErrInvalidArgument=fe.Err=void 0;var Be=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};fe.Err=Be;var Z0=class extends Be{constructor(e,r){super(`Invalid argument: ${e}`,r)}};fe.ErrInvalidArgument=Z0;var ey=class extends Be{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};fe.ErrUnsupportedOperation=ey;var ty=class extends Be{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};fe.ErrBadType=ty;var ry=class extends Be{constructor(e){super(`Invariant failed: [${e}]`)}};fe.ErrInvariantFailed=ry;var ny=class extends Be{constructor(e){super(`Unexpected condition: [${e}]`)}};fe.ErrUnexpectedCondition=ny;var iy=class extends Be{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};fe.ErrAddressCannotCreate=iy;var sy=class extends Be{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};fe.ErrAddressBadHrp=sy;var oy=class extends Be{constructor(){super("Address is empty")}};fe.ErrAddressEmpty=oy;var ay=class extends Be{constructor(e){super(`Not enough gas provided: ${e}`)}};fe.ErrNotEnoughGas=ay;var uy=class extends Be{constructor(e){super(`Invalid nonce: ${e}`)}};fe.ErrNonceInvalid=uy;var cy=class extends Be{constructor(e){super(`Invalid transaction version: ${e}`)}};fe.ErrTransactionVersionInvalid=cy;var ly=class extends Be{constructor(e){super(`Invalid transaction options: ${e}`)}};fe.ErrTransactionOptionsInvalid=ly;var fy=class extends Be{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};fe.ErrSignatureCannotCreate=fy;var hy=class extends Be{constructor(){super("Invalid function name")}};fe.ErrInvalidFunctionName=hy;var dy=class extends Be{constructor(){super("Async timer already running")}};fe.ErrAsyncTimerAlreadyRunning=dy;var py=class extends Be{constructor(){super("Async timer aborted")}};fe.ErrAsyncTimerAborted=py;var gy=class extends Be{constructor(){super("TransactionWatcher has timed out")}};fe.ErrTransactionWatcherTimeout=gy;var yy=class extends Be{constructor(){super("Expected transaction status not reached")}};fe.ErrExpectedTransactionStatusNotReached=yy;var my=class extends Be{constructor(){super("Expected transaction events not found")}};fe.ErrExpectedTransactionEventsNotFound=my;var yf=class extends Be{constructor(e){super(e)}};fe.ErrContract=yf;var wy=class extends yf{constructor(){super(` +var kR=Object.create;var uc=Object.defineProperty,KR=Object.defineProperties,zR=Object.getOwnPropertyDescriptor,WR=Object.getOwnPropertyDescriptors,$R=Object.getOwnPropertyNames,P_=Object.getOwnPropertySymbols,YR=Object.getPrototypeOf,R_=Object.prototype.hasOwnProperty,JR=Object.prototype.propertyIsEnumerable;var B_=(t,e,r)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Do=(t,e)=>{for(var r in e||={})R_.call(e,r)&&B_(t,r,e[r]);if(P_)for(var r of P_(e))JR.call(e,r)&&B_(t,r,e[r]);return t},L_=(t,e)=>KR(t,WR(e));var F_=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),at=(t,e)=>{for(var r in e)uc(t,r,{get:e[r],enumerable:!0})},lf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $R(e))!R_.call(t,i)&&i!==r&&uc(t,i,{get:()=>e[i],enumerable:!(n=zR(e,i))||n.enumerable});return t},Lt=(t,e,r)=>(lf(t,e,"default"),r&&lf(r,e,"default")),be=(t,e,r)=>(r=t!=null?kR(YR(t)):{},lf(e||!t||!t.__esModule?uc(r,"default",{value:t,enumerable:!0}):r,t)),nt=t=>lf(uc({},"__esModule",{value:!0}),t);var Ce=(t,e,r)=>new Promise((n,i)=>{var s=u=>{try{a(r.next(u))}catch(l){i(l)}},o=u=>{try{a(r.throw(u))}catch(l){i(l)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((r=r.apply(t,e)).next())});var q0=v(ff=>{"use strict";c();ff.byteLength=ZR;ff.toByteArray=tL;ff.fromByteArray=iL;var Gr=[],lr=[],XR=typeof Uint8Array<"u"?Uint8Array:Array,U0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ls=0,M_=U0.length;ls0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function ZR(t){var e=U_(t),r=e[0],n=e[1];return(r+n)*3/4-n}function eL(t,e,r){return(e+r)*3/4-r}function tL(t){var e,r=U_(t),n=r[0],i=r[1],s=new XR(eL(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=lr[t.charCodeAt(u)]<<2|lr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=lr[t.charCodeAt(u)]<<10|lr[t.charCodeAt(u+1)]<<4|lr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function rL(t){return Gr[t>>18&63]+Gr[t>>12&63]+Gr[t>>6&63]+Gr[t&63]}function nL(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Gr[e>>2]+Gr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Gr[e>>10]+Gr[e>>4&63]+Gr[e<<2&63]+"=")),i.join("")}});var H0=v(V0=>{c();V0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,y=r?-1:1,w=t[e+d];for(d+=y,s=w&(1<<-f)-1,w>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=y,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=y,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};V0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,E=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=y/u:e+=y*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=T*128}});var J_=v(Po=>{"use strict";c();var j0=q0(),Oo=H0(),q_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Po.Buffer=W;Po.SlowBuffer=lL;Po.INSPECT_MAX_BYTES=50;var hf=2147483647;Po.kMaxLength=hf;W.TYPED_ARRAY_SUPPORT=sL();!W.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sL(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(W.prototype,"parent",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.buffer}});Object.defineProperty(W.prototype,"offset",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.byteOffset}});function On(t){if(t>hf)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,W.prototype),e}function W(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return K0(t)}return j_(t,e,r)}W.poolSize=8192;function j_(t,e,r){if(typeof t=="string")return aL(t,e);if(ArrayBuffer.isView(t))return uL(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Qr(t,ArrayBuffer)||t&&Qr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Qr(t,SharedArrayBuffer)||t&&Qr(t.buffer,SharedArrayBuffer)))return Q0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return W.from(n,e,r);var i=cL(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return W.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}W.from=function(t,e,r){return j_(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function G_(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function oL(t,e,r){return G_(t),t<=0?On(t):e!==void 0?typeof r=="string"?On(t).fill(e,r):On(t).fill(e):On(t)}W.alloc=function(t,e,r){return oL(t,e,r)};function K0(t){return G_(t),On(t<0?0:z0(t)|0)}W.allocUnsafe=function(t){return K0(t)};W.allocUnsafeSlow=function(t){return K0(t)};function aL(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=Q_(t,e)|0,n=On(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function G0(t){for(var e=t.length<0?0:z0(t.length)|0,r=On(e),n=0;n=hf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hf.toString(16)+" bytes");return t|0}function lL(t){return+t!=t&&(t=0),W.alloc(+t)}W.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==W.prototype};W.compare=function(e,r){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),Qr(r,Uint8Array)&&(r=W.from(r,r.offset,r.byteLength)),!W.isBuffer(e)||!W.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?W.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(W.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function Q_(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Qr(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Y_(t).length;default:if(i)return n?-1:k0(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=Q_;function fL(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return AL(this,e,r);case"utf8":case"utf-8":return K_(this,e,r);case"ascii":return EL(this,e,r);case"latin1":case"binary":return vL(this,e,r);case"base64":return mL(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function fs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}W.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};q_&&(W.prototype[q_]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),!W.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,W0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=W.from(e,n)),W.isBuffer(e))return e.length===0?-1:V_(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):V_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function V_(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,y=0;yi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return hL(this,e,r,n);case"utf8":case"utf-8":return dL(this,e,r,n);case"ascii":case"latin1":case"binary":return pL(this,e,r,n);case"base64":return gL(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yL(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};W.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mL(t,e,r){return e===0&&r===t.length?j0.fromByteArray(t):j0.fromByteArray(t.slice(e,r))}function K_(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return wL(n)}var H_=4096;function wL(t){var e=t.length;if(e<=H_)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};W.prototype.readUint8=W.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};W.prototype.readUint32BE=W.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};W.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Oo.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Oo.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Oo.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Oo.read(this,e,!1,52,8)};function Jt(t,e,r,n,i,s){if(!W.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}W.prototype.writeUintLE=W.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,255,0),this[r]=e&255,r+1};W.prototype.writeUint16LE=W.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeUint16BE=W.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeUint32LE=W.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};W.prototype.writeUint32BE=W.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};W.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};W.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function z_(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function W_(t,e,r,n,i){return e=+e,r=r>>>0,i||z_(t,e,r,4,34028234663852886e22,-34028234663852886e22),Oo.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return W_(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return W_(this,e,r,!1,n)};function $_(t,e,r,n,i){return e=+e,r=r>>>0,i||z_(t,e,r,8,17976931348623157e292,-17976931348623157e292),Oo.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return $_(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return $_(this,e,r,!1,n)};W.prototype.copy=function(e,r,n,i){if(!W.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function SL(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Y_(t){return j0.toByteArray(IL(t))}function df(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Qr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function W0(t){return t!==t}var TL=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var rb=v((mX,tb)=>{c();var ft=tb.exports={},kr,Kr;function $0(){throw new Error("setTimeout has not been defined")}function Y0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?kr=setTimeout:kr=$0}catch{kr=$0}try{typeof clearTimeout=="function"?Kr=clearTimeout:Kr=Y0}catch{Kr=Y0}})();function X_(t){if(kr===setTimeout)return setTimeout(t,0);if((kr===$0||!kr)&&setTimeout)return kr=setTimeout,setTimeout(t,0);try{return kr(t,0)}catch{try{return kr.call(null,t,0)}catch{return kr.call(this,t,0)}}}function xL(t){if(Kr===clearTimeout)return clearTimeout(t);if((Kr===Y0||!Kr)&&clearTimeout)return Kr=clearTimeout,clearTimeout(t);try{return Kr(t)}catch{try{return Kr.call(null,t)}catch{return Kr.call(this,t)}}}var Pn=[],Bo=!1,hs,pf=-1;function NL(){!Bo||!hs||(Bo=!1,hs.length?Pn=hs.concat(Pn):pf=-1,Pn.length&&Z_())}function Z_(){if(!Bo){var t=X_(NL);Bo=!0;for(var e=Pn.length;e;){for(hs=Pn,Pn=[];++pf1)for(var r=1;r{h=be(J_()),p=be(rb()),DL=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=DL});var Wt=v((nb,gf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,y=1e9;function w(P){var L,b,C,M=q.prototype={constructor:q,toString:null,valueOf:null},Z=new q(1),K=20,j=4,G=-7,$=21,de=-1e7,ae=1e7,re=!1,Y=1,ie=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ne="0123456789abcdefghijklmnopqrstuvwxyz";function q(g,m){var A,D,I,N,F,S,U,H,V=this;if(!(V instanceof q))return new q(g,m);if(m==null){if(g&&g._isBigNumber===!0){V.s=g.s,!g.c||g.e>ae?V.c=V.e=null:g.e=10;F/=10,N++);N>ae?V.c=V.e=null:(V.e=N,V.c=[g]);return}H=String(g)}else{if(!r.test(H=String(g)))return C(V,H,S);V.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(N=H.indexOf("."))>-1&&(H=H.replace(".","")),(F=H.search(/e/i))>0?(N<0&&(N=F),N+=+H.slice(F+1),H=H.substring(0,F)):N<0&&(N=H.length)}else{if(_(m,2,ne.length,"Base"),m==10)return V=new q(g),se(V,K+V.e+1,j);if(H=String(g),S=typeof g=="number"){if(g*0!=0)return C(V,H,S,m);if(V.s=1/g<0?(H=H.slice(1),-1):1,q.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+g)}else V.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(A=ne.slice(0,m),N=F=0,U=H.length;FN){N=U;continue}}else if(!I&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){I=!0,F=-1,N=0;continue}return C(V,String(g),S,m)}S=!1,H=b(H,m,10,V.s),(N=H.indexOf("."))>-1?H=H.replace(".",""):N=H.length}for(F=0;H.charCodeAt(F)===48;F++);for(U=H.length;H.charCodeAt(--U)===48;);if(H=H.slice(F,++U)){if(U-=F,S&&q.DEBUG&&U>15&&(g>l||g!==i(g)))throw Error(o+V.s*g);if((N=N-F-1)>ae)V.c=V.e=null;else if(N=-y&&I<=y&&I===i(I)){if(D[0]===0){if(I===0&&D.length===1)return!0;break e}if(m=(I+1)%u,m<1&&(m+=u),String(D[0]).length==m){for(m=0;m=a||A!==i(A))break e;if(A!==0)return!0}}}else if(D===null&&I===null&&(N===null||N===1||N===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},q.maximum=q.max=function(){return oe(arguments,M.lt)},q.minimum=q.min=function(){return oe(arguments,M.gt)},q.random=function(){var g=9007199254740992,m=Math.random()*g&2097151?function(){return i(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var D,I,N,F,S,U=0,H=[],V=new q(Z);if(A==null?A=K:_(A,0,y),F=n(A/u),re)if(crypto.getRandomValues){for(D=crypto.getRandomValues(new Uint32Array(F*=2));U>>11),S>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),D[U]=I[0],D[U+1]=I[1]):(H.push(S%1e14),U+=2);U=F/2}else if(crypto.randomBytes){for(D=crypto.randomBytes(F*=7);U=9e15?crypto.randomBytes(7).copy(D,U):(H.push(S%1e14),U+=7);U=F/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;S/=10,U++);UI-1&&(S[F+1]==null&&(S[F+1]=0),S[F+1]+=S[F]/I|0,S[F]%=I)}return S.reverse()}return function(A,D,I,N,F){var S,U,H,V,X,ye,we,Pe,$e=A.indexOf("."),ot=K,De=j;for($e>=0&&(V=ie,ie=0,A=A.replace(".",""),Pe=new q(D),ye=Pe.pow(A.length-$e),ie=V,Pe.c=m(O(T(ye.c),ye.e,"0"),10,I,g),Pe.e=Pe.c.length),we=m(A,D,I,F?(S=ne,g):(S=g,ne)),H=V=we.length;we[--V]==0;we.pop());if(!we[0])return S.charAt(0);if($e<0?--H:(ye.c=we,ye.e=H,ye.s=N,ye=L(ye,Pe,ot,De,I),we=ye.c,X=ye.r,H=ye.e),U=H+ot+1,$e=we[U],V=I/2,X=X||U<0||we[U+1]!=null,X=De<4?($e!=null||X)&&(De==0||De==(ye.s<0?3:2)):$e>V||$e==V&&(De==4||X||De==6&&we[U-1]&1||De==(ye.s<0?8:7)),U<1||!we[0])A=X?O(S.charAt(1),-ot,S.charAt(0)):S.charAt(0);else{if(we.length=U,X)for(--I;++we[--U]>I;)we[U]=0,U||(++H,we=[1].concat(we));for(V=we.length;!we[--V];);for($e=0,A="";$e<=V;A+=S.charAt(we[$e++]));A=O(A,H,S.charAt(0))}return A}}(),L=function(){function g(D,I,N){var F,S,U,H,V=0,X=D.length,ye=I%d,we=I/d|0;for(D=D.slice();X--;)U=D[X]%d,H=D[X]/d|0,F=we*U+H*ye,S=ye*U+F%d*d+V,V=(S/N|0)+(F/d|0)+we*H,D[X]=S%N;return V&&(D=[V].concat(D)),D}function m(D,I,N,F){var S,U;if(N!=F)U=N>F?1:-1;else for(S=U=0;SI[S]?1:-1;break}return U}function A(D,I,N,F){for(var S=0;N--;)D[N]-=S,S=D[N]1;D.splice(0,1));}return function(D,I,N,F,S){var U,H,V,X,ye,we,Pe,$e,ot,De,Me,vt,ni,us,cs,Yt,Dn,qt=D.s==I.s?1:-1,At=D.c,Qe=I.c;if(!At||!At[0]||!Qe||!Qe[0])return new q(!D.s||!I.s||(At?Qe&&At[0]==Qe[0]:!Qe)?NaN:At&&At[0]==0||!Qe?qt*0:qt/0);for($e=new q(qt),ot=$e.c=[],H=D.e-I.e,qt=N+H+1,S||(S=a,H=E(D.e/u)-E(I.e/u),qt=qt/u|0),V=0;Qe[V]==(At[V]||0);V++);if(Qe[V]>(At[V]||0)&&H--,qt<0)ot.push(1),X=!0;else{for(us=At.length,Yt=Qe.length,V=0,qt+=2,ye=i(S/(Qe[0]+1)),ye>1&&(Qe=g(Qe,ye,S),At=g(At,ye,S),Yt=Qe.length,us=At.length),ni=Yt,De=At.slice(0,Yt),Me=De.length;Me=S/2&&cs++;do{if(ye=0,U=m(Qe,De,Yt,Me),U<0){if(vt=De[0],Yt!=Me&&(vt=vt*S+(De[1]||0)),ye=i(vt/cs),ye>1)for(ye>=S&&(ye=S-1),we=g(Qe,ye,S),Pe=we.length,Me=De.length;m(we,De,Pe,Me)==1;)ye--,A(we,Yt=10;qt/=10,V++);se($e,N+($e.e=V+H*u-1)+1,F,X)}else $e.e=H,$e.r=+X;return $e}}();function ce(g,m,A,D){var I,N,F,S,U;if(A==null?A=j:_(A,0,8),!g.c)return g.toString();if(I=g.c[0],F=g.e,m==null)U=T(g.c),U=D==1||D==2&&(F<=G||F>=$)?x(U,F):O(U,F,"0");else if(g=se(new q(g),m,A),N=g.e,U=T(g.c),S=U.length,D==1||D==2&&(m<=N||N<=G)){for(;SS){if(--m>0)for(U+=".";m--;U+="0");}else if(m+=N-S,m>0)for(N+1==S&&(U+=".");m--;U+="0");return g.s<0&&I?"-"+U:U}function oe(g,m){for(var A,D=1,I=new q(g[0]);D=10;I/=10,D++);return(A=D+A*u-1)>ae?g.c=g.e=null:A=10;S/=10,I++);if(N=m-I,N<0)N+=u,F=m,U=X[H=0],V=U/ye[I-F-1]%10|0;else if(H=n((N+1)/u),H>=X.length)if(D){for(;X.length<=H;X.push(0));U=V=0,I=1,N%=u,F=N-u+1}else break e;else{for(U=S=X[H],I=1;S>=10;S/=10,I++);N%=u,F=N-u+I,V=F<0?0:U/ye[I-F-1]%10|0}if(D=D||m<0||X[H+1]!=null||(F<0?U:U%ye[I-F-1]),D=A<4?(V||D)&&(A==0||A==(g.s<0?3:2)):V>5||V==5&&(A==4||D||A==6&&(N>0?F>0?U/ye[I-F]:0:X[H-1])%10&1||A==(g.s<0?8:7)),m<1||!X[0])return X.length=0,D?(m-=g.e+1,X[0]=ye[(u-m%u)%u],g.e=-m||0):X[0]=g.e=0,g;if(N==0?(X.length=H,S=1,H--):(X.length=H+1,S=ye[u-N],X[H]=F>0?i(U/ye[I-F]%ye[F])*S:0),D)for(;;)if(H==0){for(N=1,F=X[0];F>=10;F/=10,N++);for(F=X[0]+=S,S=1;F>=10;F/=10,S++);N!=S&&(g.e++,X[0]==a&&(X[0]=1));break}else{if(X[H]+=S,X[H]!=a)break;X[H--]=0,S=1}for(N=X.length;X[--N]===0;X.pop());}g.e>ae?g.c=g.e=null:g.e=$?x(m,A):O(m,A,"0"),g.s<0?"-"+m:m)}return M.absoluteValue=M.abs=function(){var g=new q(this);return g.s<0&&(g.s=1),g},M.comparedTo=function(g,m){return R(this,new q(g,m))},M.decimalPlaces=M.dp=function(g,m){var A,D,I,N=this;if(g!=null)return _(g,0,y),m==null?m=j:_(m,0,8),se(new q(N),g+N.e+1,m);if(!(A=N.c))return null;if(D=((I=A.length-1)-E(this.e/u))*u,I=A[I])for(;I%10==0;I/=10,D--);return D<0&&(D=0),D},M.dividedBy=M.div=function(g,m){return L(this,new q(g,m),K,j)},M.dividedToIntegerBy=M.idiv=function(g,m){return L(this,new q(g,m),0,1)},M.exponentiatedBy=M.pow=function(g,m){var A,D,I,N,F,S,U,H,V,X=this;if(g=new q(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+ue(g));if(m!=null&&(m=new q(m)),S=g.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!g.c||!g.c[0])return V=new q(Math.pow(+ue(X),S?2-B(g):+ue(g))),m?V.mod(m):V;if(U=g.s<0,m){if(m.c?!m.c[0]:!m.s)return new q(NaN);D=!U&&X.isInteger()&&m.isInteger(),D&&(X=X.mod(m))}else{if(g.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||S&&X.c[1]>=24e7:X.c[0]<8e13||S&&X.c[0]<=9999975e7)))return N=X.s<0&&B(g)?-0:0,X.e>-1&&(N=1/N),new q(U?1/N:N);ie&&(N=n(ie/u+2))}for(S?(A=new q(.5),U&&(g.s=1),H=B(g)):(I=Math.abs(+ue(g)),H=I%2),V=new q(Z);;){if(H){if(V=V.times(X),!V.c)break;N?V.c.length>N&&(V.c.length=N):D&&(V=V.mod(m))}if(I){if(I=i(I/2),I===0)break;H=I%2}else if(g=g.times(A),se(g,g.e+1,1),g.e>14)H=B(g);else{if(I=+ue(g),I===0)break;H=I%2}X=X.times(X),N?X.c&&X.c.length>N&&(X.c.length=N):D&&(X=X.mod(m))}return D?V:(U&&(V=Z.div(V)),m?V.mod(m):N?se(V,ie,j,F):V)},M.integerValue=function(g){var m=new q(this);return g==null?g=j:_(g,0,8),se(m,m.e+1,g)},M.isEqualTo=M.eq=function(g,m){return R(this,new q(g,m))===0},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(g,m){return R(this,new q(g,m))>0},M.isGreaterThanOrEqualTo=M.gte=function(g,m){return(m=R(this,new q(g,m)))===1||m===0},M.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},M.isLessThan=M.lt=function(g,m){return R(this,new q(g,m))<0},M.isLessThanOrEqualTo=M.lte=function(g,m){return(m=R(this,new q(g,m)))===-1||m===0},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&this.c[0]==0},M.minus=function(g,m){var A,D,I,N,F=this,S=F.s;if(g=new q(g,m),m=g.s,!S||!m)return new q(NaN);if(S!=m)return g.s=-m,F.plus(g);var U=F.e/u,H=g.e/u,V=F.c,X=g.c;if(!U||!H){if(!V||!X)return V?(g.s=-m,g):new q(X?F:NaN);if(!V[0]||!X[0])return X[0]?(g.s=-m,g):new q(V[0]?F:j==3?-0:0)}if(U=E(U),H=E(H),V=V.slice(),S=U-H){for((N=S<0)?(S=-S,I=V):(H=U,I=X),I.reverse(),m=S;m--;I.push(0));I.reverse()}else for(D=(N=(S=V.length)<(m=X.length))?S:m,S=m=0;m0)for(;m--;V[A++]=0);for(m=a-1;D>S;){if(V[--D]=0;){for(A=0,ye=vt[I]%ot,we=vt[I]/ot|0,F=U,N=I+F;N>I;)H=Me[--F]%ot,V=Me[F]/ot|0,S=we*H+V*ye,H=ye*H+S%ot*ot+Pe[N]+A,A=(H/$e|0)+(S/ot|0)+we*V,Pe[N--]=H%$e;Pe[N]=A}return A?++D:Pe.splice(0,1),le(g,Pe,D)},M.negated=function(){var g=new q(this);return g.s=-g.s||null,g},M.plus=function(g,m){var A,D=this,I=D.s;if(g=new q(g,m),m=g.s,!I||!m)return new q(NaN);if(I!=m)return g.s=-m,D.minus(g);var N=D.e/u,F=g.e/u,S=D.c,U=g.c;if(!N||!F){if(!S||!U)return new q(I/0);if(!S[0]||!U[0])return U[0]?g:new q(S[0]?D:I*0)}if(N=E(N),F=E(F),S=S.slice(),I=N-F){for(I>0?(F=N,A=U):(I=-I,A=S),A.reverse();I--;A.push(0));A.reverse()}for(I=S.length,m=U.length,I-m<0&&(A=U,U=S,S=A,m=I),I=0;m;)I=(S[--m]=S[m]+U[m]+I)/a|0,S[m]=a===S[m]?0:S[m]%a;return I&&(S=[I].concat(S),++F),le(g,S,F)},M.precision=M.sd=function(g,m){var A,D,I,N=this;if(g!=null&&g!==!!g)return _(g,1,y),m==null?m=j:_(m,0,8),se(new q(N),g,m);if(!(A=N.c))return null;if(I=A.length-1,D=I*u+1,I=A[I]){for(;I%10==0;I/=10,D--);for(I=A[0];I>=10;I/=10,D++);}return g&&N.e+1>D&&(D=N.e+1),D},M.shiftedBy=function(g){return _(g,-l,l),this.times("1e"+g)},M.squareRoot=M.sqrt=function(){var g,m,A,D,I,N=this,F=N.c,S=N.s,U=N.e,H=K+4,V=new q("0.5");if(S!==1||!F||!F[0])return new q(!S||S<0&&(!F||F[0])?NaN:F?N:1/0);if(S=Math.sqrt(+ue(N)),S==0||S==1/0?(m=T(F),(m.length+U)%2==0&&(m+="0"),S=Math.sqrt(+m),U=E((U+1)/2)-(U<0||U%2),S==1/0?m="5e"+U:(m=S.toExponential(),m=m.slice(0,m.indexOf("e")+1)+U),A=new q(m)):A=new q(S+""),A.c[0]){for(U=A.e,S=U+H,S<3&&(S=0);;)if(I=A,A=V.times(I.plus(L(N,I,H,1))),T(I.c).slice(0,S)===(m=T(A.c)).slice(0,S))if(A.e0&&Pe>0){for(N=Pe%S||S,V=we.substr(0,N);N0&&(V+=H+we.slice(N)),ye&&(V="-"+V)}D=X?V+(A.decimalSeparator||"")+((U=+A.fractionGroupSize)?X.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):X):V}return(A.prefix||"")+D+(A.suffix||"")},M.toFraction=function(g){var m,A,D,I,N,F,S,U,H,V,X,ye,we=this,Pe=we.c;if(g!=null&&(S=new q(g),!S.isInteger()&&(S.c||S.s!==1)||S.lt(Z)))throw Error(s+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+ue(S));if(!Pe)return new q(we);for(m=new q(Z),H=A=new q(Z),D=U=new q(Z),ye=T(Pe),N=m.e=ye.length-we.e-1,m.c[0]=f[(F=N%u)<0?u+F:F],g=!g||S.comparedTo(m)>0?N>0?m:H:S,F=ae,ae=1/0,S=new q(ye),U.c[0]=0;V=L(S,m,0,1),I=A.plus(V.times(D)),I.comparedTo(g)!=1;)A=D,D=I,H=U.plus(V.times(I=H)),U=I,m=S.minus(V.times(I=m)),S=I;return I=L(g.minus(A),D,0,1),U=U.plus(I.times(H)),A=A.plus(I.times(D)),U.s=H.s=we.s,N=N*2,X=L(H,D,N,j).minus(we).abs().comparedTo(L(U,A,N,j).minus(we).abs())<1?[H,D]:[U,A],ae=F,X},M.toNumber=function(){return+ue(this)},M.toPrecision=function(g,m){return g!=null&&_(g,1,y),ce(this,g,m,2)},M.toString=function(g){var m,A=this,D=A.s,I=A.e;return I===null?D?(m="Infinity",D<0&&(m="-"+m)):m="NaN":(g==null?m=I<=G||I>=$?x(T(A.c),I):O(T(A.c),I,"0"):g===10?(A=se(new q(A),K+I+1,j),m=O(T(A.c),A.e,"0")):(_(g,2,ne.length,"Base"),m=b(O(T(A.c),I,"0"),10,g,D,!0)),D<0&&A.c[0]&&(m="-"+m)),m},M.valueOf=M.toJSON=function(){return ue(this)},M._isBigNumber=!0,P!=null&&q.set(P),q}function E(P){var L=P|0;return P>0||P===L?L:L-1}function T(P){for(var L,b,C=1,M=P.length,Z=P[0]+"";C$^b?1:-1;for(j=(G=M.length)<($=Z.length)?G:$,K=0;KZ[K]^b?1:-1;return G==$?0:G>$^b?1:-1}function _(P,L,b,C){if(Pb||P!==i(P))throw Error(s+(C||"Argument")+(typeof P=="number"?Pb?" out of range: ":" not an integer: ":" not a primitive number: ")+String(P))}function B(P){var L=P.c.length-1;return E(P.e/u)==L&&P.c[L]%2!=0}function x(P,L){return(P.length>1?P.charAt(0)+"."+P.slice(1):P)+(L<0?"e":"e+")+L}function O(P,L,b){var C,M;if(L<0){for(M=b+".";++L;M+=b);P=M+P}else if(C=P.length,++L>C){for(M=b,L-=C;--L;M+=b);P+=M}else L{"use strict";c();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrGasLimitShouldBe0ForInnerTransaction=pe.ErrInvalidRelayedV2BuilderArguments=pe.ErrInvalidRelayedV1BuilderArguments=pe.ErrNotImplemented=pe.ErrContractInteraction=pe.ErrCodec=pe.ErrCannotParseTransactionOutcome=pe.ErrCannotParseContractResults=pe.ErrMissingFieldOnEnum=pe.ErrMissingFieldOnStruct=pe.ErrTypingSystem=pe.ErrMock=pe.ErrContractHasNoAddress=pe.ErrContract=pe.ErrExpectedTransactionEventsNotFound=pe.ErrExpectedTransactionStatusNotReached=pe.ErrTransactionWatcherTimeout=pe.ErrAsyncTimerAborted=pe.ErrAsyncTimerAlreadyRunning=pe.ErrInvalidFunctionName=pe.ErrSignatureCannotCreate=pe.ErrTransactionOptionsInvalid=pe.ErrTransactionVersionInvalid=pe.ErrNonceInvalid=pe.ErrNotEnoughGas=pe.ErrAddressEmpty=pe.ErrAddressBadHrp=pe.ErrAddressCannotCreate=pe.ErrUnexpectedCondition=pe.ErrInvariantFailed=pe.ErrBadType=pe.ErrUnsupportedOperation=pe.ErrInvalidArgument=pe.Err=void 0;var Be=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};pe.Err=Be;var J0=class extends Be{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=J0;var X0=class extends Be{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=X0;var Z0=class extends Be{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=Z0;var ey=class extends Be{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=ey;var ty=class extends Be{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=ty;var ry=class extends Be{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=ry;var ny=class extends Be{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=ny;var iy=class extends Be{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=iy;var sy=class extends Be{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=sy;var oy=class extends Be{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=oy;var ay=class extends Be{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=ay;var uy=class extends Be{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=uy;var cy=class extends Be{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=cy;var ly=class extends Be{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=ly;var fy=class extends Be{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=fy;var hy=class extends Be{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=hy;var dy=class extends Be{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=dy;var py=class extends Be{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=py;var gy=class extends Be{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=gy;var yf=class extends Be{constructor(e){super(e)}};pe.ErrContract=yf;var yy=class extends yf{constructor(){super(` The smart contract has no address set. Make sure you provide the address in the constructor, or call setAddress() appropriately. If you need to recompute the address of the contract, make use of SmartContract.computeAddress() (static method). -`)}};fe.ErrContractHasNoAddress=wy;var Ey=class extends Be{constructor(e){super(e)}};fe.ErrMock=Ey;var mf=class extends Be{constructor(e){super(e)}};fe.ErrTypingSystem=mf;var vy=class extends mf{constructor(e){super(` -argument at position ${e} seems to be a TypedValue. The automatic type inference system requires regular javascript objects as input. -This error might occur when you pass a TypedValue to contract.methods.myFunction([...]). For passing TypedValues instead of regular javascript objects, and bypass the automatic type inference system, use contract.methodsExplicit.myFunction([...]) instead. -Also see https://github.com/multiversx/mx-sdk-js-core/pull/187. -`)}};fe.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=vy;var Ay=class extends Be{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};fe.ErrMissingFieldOnStruct=Ay;var _y=class extends Be{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};fe.ErrMissingFieldOnEnum=_y;var by=class extends Be{constructor(e){super(`cannot parse contract results: ${e}`)}};fe.ErrCannotParseContractResults=by;var Iy=class extends Be{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};fe.ErrCannotParseTransactionOutcome=Iy;var Sy=class extends Be{constructor(e){super(e)}};fe.ErrCodec=Sy;var Cy=class extends Be{constructor(e){super(e)}};fe.ErrContractInteraction=Cy;var Ty=class extends Be{constructor(){super("Method not yet implemented")}};fe.ErrNotImplemented=Ty;var xy=class extends Be{constructor(){super("invalid arguments for relayed v1 builder")}};fe.ErrInvalidRelayedV1BuilderArguments=xy;var Ny=class extends Be{constructor(){super("invalid arguments for relayed v2 builder")}};fe.ErrInvalidRelayedV2BuilderArguments=Ny;var Dy=class extends Be{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};fe.ErrGasLimitShouldBe0ForInnerTransaction=Dy});var ub=v(ii=>{"use strict";c();var BL=ii&&ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ii,"__esModule",{value:!0});ii.TokenPayment=ii.TokenTransfer=void 0;var cc=BL(Wt()),RL=je(),ob="EGLD",ab=18;cc.default.set({ROUNDING_MODE:1});var zr=class{constructor(e){let r=new cc.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new RL.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new cc.default(e).shiftedBy(ab).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new zr({tokenIdentifier:ob,nonce:0,amountAsBigInteger:e,numDecimals:ab})}static fungibleFromAmount(e,r,n){let i=new cc.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new zr({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new cc.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==ob}isFungible(){return this.nonce==0}};ii.TokenTransfer=zr;var Oy=class extends zr{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ii.TokenPayment=Oy});var Lo=v(ke=>{"use strict";c();Object.defineProperty(ke,"__esModule",{value:!0});ke.ARGUMENTS_SEPARATOR=ke.ESDT_TRANSFER_VALUE=ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_GAS_LIMIT=ke.TRANSACTION_VERSION_WITH_OPTIONS=ke.TRANSACTION_VERSION_DEFAULT=ke.TRANSACTION_OPTIONS_TX_GUARDED=ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=ke.TRANSACTION_OPTIONS_DEFAULT=ke.TRANSACTION_MIN_GAS_PRICE=void 0;ke.TRANSACTION_MIN_GAS_PRICE=1e9;ke.TRANSACTION_OPTIONS_DEFAULT=0;ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ke.TRANSACTION_OPTIONS_TX_GUARDED=2;ke.TRANSACTION_VERSION_DEFAULT=1;ke.TRANSACTION_VERSION_WITH_OPTIONS=2;ke.ESDT_TRANSFER_GAS_LIMIT=5e5;ke.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ke.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ke.ESDT_TRANSFER_VALUE="0";ke.ARGUMENTS_SEPARATOR="@"});var fr=v(Je=>{"use strict";c();var LL=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FL=Je&&Je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ML=Je&&Je.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LL(e,t,r);return FL(e,t),e};Object.defineProperty(Je,"__esModule",{value:!0});Je.isEmpty=Je.guardEmpty=Je.guardNotEmpty=Je.guardLength=Je.guardSameLength=Je.guardValueIsSetWithMessage=Je.guardValueIsSet=Je.guardTrue=void 0;var Fo=ML(je());function UL(t,e){if(!t)throw new Fo.ErrInvariantFailed(`[<${e}>] isn't true`)}Je.guardTrue=UL;function qL(t,e){cb(`${t} isn't set (null or undefined)`,e)}Je.guardValueIsSet=qL;function cb(t,e){if(e==null||e===void 0)throw new Fo.ErrInvariantFailed(t)}Je.guardValueIsSetWithMessage=cb;function VL(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Fo.ErrInvariantFailed("arrays do not have the same length")}Je.guardSameLength=VL;function jL(t,e){let r=t.length||0;if(r!=e)throw new Fo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Je.guardLength=jL;function HL(t,e){if(Py(t))throw new Fo.ErrInvariantFailed(`${e} is empty`)}Je.guardNotEmpty=HL;function GL(t,e){if(!Py(t))throw new Fo.ErrInvariantFailed(`${e} is not empty`)}Je.guardEmpty=GL;function Py(t){return t.isEmpty?t.isEmpty():t.length===0}Je.isEmpty=Py});var lb=v(wf=>{"use strict";c();Object.defineProperty(wf,"__esModule",{value:!0});wf.getJavascriptPrototypesInHierarchy=void 0;function QL(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}wf.getJavascriptPrototypesInHierarchy=QL});var mt=v(yt=>{"use strict";c();Object.defineProperty(yt,"__esModule",{value:!0});yt.NullType=yt.TypePlaceholder=yt.isTyped=yt.PrimitiveValue=yt.TypedValue=yt.CustomType=yt.PrimitiveType=yt.TypeCardinality=yt.Type=void 0;var By=lb(),fb=fr(),sr=class{constructor(e,r=[],n=Rn.fixed(1)){fb.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return sr.ClassName}getClassHierarchy(){return By.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return fb.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return sr.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!sr.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return sr.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return By.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};yt.Type=sr;sr.ClassName="Type";var Rn=class{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new Rn(e,e)}static variable(e){return new Rn(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||Rn.MaxCardinality}};yt.TypeCardinality=Rn;Rn.MaxCardinality=4096;var Mo=class extends sr{constructor(e){super(e)}getClassName(){return Mo.ClassName}};yt.PrimitiveType=Mo;Mo.ClassName="PrimitiveType";var Uo=class extends sr{getClassName(){return Uo.ClassName}};yt.CustomType=Uo;Uo.ClassName="CustomType";var fs=class{constructor(e){this.type=e}getClassName(){return fs.ClassName}getClassHierarchy(){return By.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};yt.TypedValue=fs;fs.ClassName="TypedValue";var qo=class extends fs{constructor(e){super(e)}getClassName(){return qo.ClassName}};yt.PrimitiveValue=qo;qo.ClassName="PrimitiveValue";function kL(t){return t.belongsToTypesystem!==void 0}yt.isTyped=kL;var Vo=class extends sr{constructor(){super("...")}getClassName(){return Vo.ClassName}};yt.TypePlaceholder=Vo;Vo.ClassName="TypePlaceholder";var jo=class extends sr{constructor(){super("?")}getClassName(){return jo.ClassName}};yt.NullType=jo;jo.ClassName="NullType"});var hb=v((Ho,Go)=>{c();(function(t){var e=typeof Ho=="object"&&Ho&&!Ho.nodeType&&Ho,r=typeof Go=="object"&&Go&&!Go.nodeType&&Go,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,y=128,w="-",E=/^xn--/,N=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=o-a,b=Math.floor,T=String.fromCharCode,P;function B(Y){throw new RangeError(M[Y])}function _(Y,ie){for(var te=Y.length,ne=[];te--;)ne[te]=ie(Y[te]);return ne}function S(Y,ie){var te=Y.split("@"),ne="";te.length>1&&(ne=te[0]+"@",Y=te[1]),Y=Y.replace(R,".");var q=Y.split("."),ce=_(q,ie).join(".");return ne+ce}function F(Y){for(var ie=[],te=0,ne=Y.length,q,ce;te=55296&&q<=56319&&te65535&&(ie-=65536,te+=T(ie>>>10&1023|55296),ie=56320|ie&1023),te+=T(ie),te}).join("")}function K(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function H(Y,ie){return Y+22+75*(Y<26)-((ie!=0)<<5)}function G(Y,ie,te){var ne=0;for(Y=te?b(Y/f):Y>>1,Y+=b(Y/ie);Y>x*u>>1;ne+=o)Y=b(Y/x);return b(ne+(x+1)*Y/(Y+l))}function $(Y){var ie=[],te=Y.length,ne,q=0,ce=y,oe=d,le,se,ue,g,m,A,O,I,D;for(le=Y.lastIndexOf(w),le<0&&(le=0),se=0;se=128&&B("not-basic"),ie.push(Y.charCodeAt(se));for(ue=le>0?le+1:0;ue=te&&B("invalid-input"),O=K(Y.charCodeAt(ue++)),(O>=o||O>b((s-q)/m))&&B("overflow"),q+=O*m,I=A<=oe?a:A>=oe+u?u:A-oe,!(Ob(s/D)&&B("overflow"),m*=D;ne=ie.length+1,oe=G(q-g,ne,g==0),b(q/ne)>s-ce&&B("overflow"),ce+=b(q/ne),q%=ne,ie.splice(q++,0,ce)}return Z(ie)}function pe(Y){var ie,te,ne,q,ce,oe,le,se,ue,g,m,A=[],O,I,D,L;for(Y=F(Y),O=Y.length,ie=y,te=0,ce=d,oe=0;oe=ie&&mb((s-te)/I)&&B("overflow"),te+=(le-ie)*I,ie=le,oe=0;oes&&B("overflow"),m==ie){for(se=te,ue=o;g=ue<=ce?a:ue>=ce+u?u:ue-ce,!(se{"use strict";c();var pb=hb();function KL(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Ry(t){return t>="0"&&t<="7"}function zL(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function db(t){return t=parseInt(t,16),pb.ucs2.encode([t])}function gb(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!zL(l))throw new KL(u,"Unexpected token ILLEGAL");return l}for(;e{c();var Eb=yb();_b.exports={validate:WL,parse:$L};function WL(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Ef(t,0,e,!1)}catch(n){r=n.message}return r}function $L(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Ef(t,0,e,!0);return r.value}function vb(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function ZL(t,e,r,n){for(var i=e,s=",",o=[],a=e;hs(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Ef(t,i,r,n),l=vb(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function e5(t,e){return t.substr(e,4)==="true"}function t5(t,e){return t.substr(e,5)==="false"}function r5(t,e){return t.substr(e,4)==="null"}var n5=new RegExp(/^\s$/);function hs(t){return n5.test(t)}var i5=new RegExp(/^\d$/);function mb(t){return i5.test(t)}function Ln(t,e,r){var n=10,i;t.length{"use strict";c();var s5=Wr&&Wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o5=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a5=Wr&&Wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s5(e,t,r);return o5(e,t),e};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.TypeExpressionParser=void 0;var Ib=a5(je()),u5=mt(),c5=bb(),Fy=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new Ib.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return c5.parse(r)}catch{throw new Ib.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new u5.Type(e,n)}};Wr.TypeExpressionParser=Fy});var My=v(si=>{"use strict";c();Object.defineProperty(si,"__esModule",{value:!0});si.EndpointParameterDefinition=si.EndpointModifiers=si.EndpointDefinition=void 0;var l5=vf(),Sb="?",f5="N / A",lc=class{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?Sb:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>ds.fromJSON(s)),n=e.outputs.map(s=>ds.fromJSON(s)),i=new Af(e.mutability,e.payableInTokens);return new lc(e.name,r,n,i)}};si.EndpointDefinition=lc;var Af=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};si.EndpointModifiers=Af;var ds=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new l5.TypeExpressionParser().parse(e.type);return new ds(e.name||Sb,e.description||f5,r)}};si.EndpointParameterDefinition=ds});var Qo=v(Xt=>{"use strict";c();var h5=Xt&&Xt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d5=Xt&&Xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p5=Xt&&Xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h5(e,t,r);return d5(e,t),e};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.Fields=Xt.Field=Xt.FieldDefinition=void 0;var Uy=p5(je()),g5=vf(),fc=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new g5.TypeExpressionParser().parse(e.type);return new fc(e.name,e.description,r)}};Xt.FieldDefinition=fc;var qy=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Uy.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Uy.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};Xt.Field=qy;var Vy=class{static checkTyping(e,r){if(e.length!=r.length)throw new Uy.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(ai,"__esModule",{value:!0});ai.EnumValue=ai.EnumVariantDefinition=ai.EnumType=void 0;var y5=je(),jy=fr(),_f=Qo(),Tb=mt(),Cb=256,ps=class extends Tb.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return ps.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>ko.fromJSON(n));return new ps(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return jy.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return jy.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};ai.EnumType=ps;ps.ClassName="EnumType";var ko=class{constructor(e,r,n=[]){this.fieldsDefinitions=[],jy.guardTrue(r_f.FieldDefinition.fromJSON(n));return new ko(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return _f.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ai.EnumVariantDefinition=ko;var oi=class extends Tb.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();_f.Fields.checkTyping(this.fields,i)}getClassName(){return oi.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new oi(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new oi(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=_f.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new y5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(r=>e.fields[r.name]=r.value.valueOf()),e}};ai.EnumValue=oi;oi.ClassName="EnumValue"});var ys=v(zo=>{"use strict";c();Object.defineProperty(zo,"__esModule",{value:!0});zo.Struct=zo.StructType=void 0;var m5=je(),bf=Qo(),xb=mt(),gs=class extends xb.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return gs.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>bf.FieldDefinition.fromJSON(n));return new gs(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return bf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};zo.StructType=gs;gs.ClassName="StructType";var Ko=class extends xb.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return Ko.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();bf.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new m5.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return bf.Fields.equals(r,n)}};zo.Struct=Ko;Ko.ClassName="Struct"});var Tf=v((XX,Ob)=>{"use strict";c();var Sf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Hy={};for(dc=0;dc>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Nb(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Wo(e)^n>>5}for(e=Wo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=Nb(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Wo(n)^o,i+=Sf.charAt(o)}for(s=0;s<6;++s)n=Wo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=Sf.charAt(a)}return i}function Db(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=Nb(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function E5(){var t=Db.apply(null,arguments);if(typeof t=="object")return t}function v5(t){var e=Db.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Cf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var S5=$r&&$r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C5=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pb=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S5(e,t,r);return C5(e,t),e};Object.defineProperty($r,"__esModule",{value:!0});$r.Address=void 0;var xf=Pb(Tf()),$o=Pb(je()),Gy="erd",Qy=32,T5="0".repeat(16),_t=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof _t)return _t.fromAddress(e);if(e instanceof h.Buffer)return _t.fromBuffer(e);if(typeof e=="string")return _t.fromString(e);throw new $o.ErrAddressCannotCreate(e)}}static fromAddress(e){return _t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new _t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Qy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e.toString("hex"))}static fromString(e){return _t.isValidHex(e)?_t.fromValidHex(e):_t.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Qy}static fromHex(e){if(!_t.isValidHex(e))throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e)}static empty(){return new _t}static fromBech32(e){let r;try{r=xf.decode(e)}catch(s){throw new $o.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Gy)throw new $o.ErrAddressBadHrp(Gy,n);let i=h.Buffer.from(xf.fromWords(r.words));if(i.length!=Qy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=xf.toWords(this.pubkey());return xf.encode(Gy,e)}pubkey(){return this.isEmpty()?h.Buffer.from([]):h.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new _t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(T5)}};$r.Address=_t});var Xo=v(Jo=>{"use strict";c();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.AddressValue=Jo.AddressType=void 0;var x5=Zt(),Bb=mt(),ms=class extends Bb.PrimitiveType{constructor(){super("Address")}getClassName(){return ms.ClassName}};Jo.AddressType=ms;ms.ClassName="AddressType";var Yo=class extends Bb.PrimitiveValue{constructor(e){super(new ms),this.value=new x5.Address(e.bech32())}getClassName(){return Yo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Jo.AddressValue=Yo;Yo.ClassName="AddressValue"});var Nf=v(Zo=>{"use strict";c();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.OptionalValue=Zo.OptionalType=void 0;var N5=fr(),pc=mt(),ui=class extends pc.Type{constructor(e){super("Optional",[e],pc.TypeCardinality.variable(1))}getClassName(){return ui.ClassName}isAssignableFrom(e){if(!e.hasExactClass(ui.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(pc.NullType.ClassName);return r||n}};Zo.OptionalType=ui;ui.ClassName="OptionalType";var ws=class extends pc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return ws.ClassName}static newMissing(){let e=new ui(new pc.NullType);return new ws(e)}isSet(){return!!this.value}getTypedValue(){return N5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Zo.OptionalValue=ws;ws.ClassName="OptionalValue"});var gc=v(ta=>{"use strict";c();Object.defineProperty(ta,"__esModule",{value:!0});ta.BooleanValue=ta.BooleanType=void 0;var Rb=mt(),Es=class extends Rb.PrimitiveType{constructor(){super("bool")}getClassName(){return Es.ClassName}};ta.BooleanType=Es;Es.ClassName="BooleanType";var ea=class extends Rb.PrimitiveValue{constructor(e){super(new Es),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ta.BooleanValue=ea;ea.ClassName="BooleanValue"});var li=v(ra=>{"use strict";c();Object.defineProperty(ra,"__esModule",{value:!0});ra.BytesValue=ra.BytesType=void 0;var Lb=mt(),vs=class extends Lb.PrimitiveType{constructor(){super("bytes")}getClassName(){return vs.ClassName}};ra.BytesType=vs;vs.ClassName="BytesType";var ci=class extends Lb.PrimitiveValue{constructor(e){super(new vs),this.value=e}getClassName(){return ci.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new ci(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new ci(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};ra.BytesValue=ci;ci.ClassName="BytesValue"});var Mb=v(na=>{"use strict";c();Object.defineProperty(na,"__esModule",{value:!0});na.CodeMetadataValue=na.CodeMetadataType=void 0;var Fb=mt(),Df=class extends Fb.PrimitiveType{constructor(){super("CodeMetadata")}};na.CodeMetadataType=Df;var ky=class extends Fb.PrimitiveValue{constructor(e){super(new Df),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};na.CodeMetadataValue=ky});var Of=v(ia=>{"use strict";c();Object.defineProperty(ia,"__esModule",{value:!0});ia.CompositeValue=ia.CompositeType=void 0;var D5=fr(),Ky=mt(),As=class extends Ky.Type{constructor(...e){super("Composite",e,Ky.TypeCardinality.variable(e.length))}getClassName(){return As.ClassName}};ia.CompositeType=As;As.ClassName="CompositeType";var _s=class extends Ky.TypedValue{constructor(e,r){super(e),D5.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return _s.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new As(...r);return new _s(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.CollectionOfTypedValues=void 0;var zy=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.List=Yr.OptionValue=Yr.ListType=Yr.OptionType=void 0;var O5=fr(),P5=Wy(),bs=mt(),Jr=class extends bs.Type{constructor(e){super("Option",[e])}getClassName(){return Jr.ClassName}isAssignableFrom(e){if(!e.hasExactClass(Jr.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(bs.NullType.ClassName);return r||n}};Yr.OptionType=Jr;Jr.ClassName="OptionType";var Is=class extends bs.Type{constructor(e){super("List",[e])}getClassName(){return Is.ClassName}};Yr.ListType=Is;Is.ClassName="ListType";var Fn=class extends bs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Fn.ClassName}static newMissing(){let e=new Jr(new bs.NullType);return new Fn(e)}static newMissingTyped(e){return new Fn(new Jr(e))}static newProvided(e){let r=new Jr(e.getType());return new Fn(r,e)}isSet(){return!!this.value}getTypedValue(){return O5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Yr.OptionValue=Fn;Fn.ClassName="OptionValue";var fi=class extends bs.TypedValue{constructor(e,r){super(e),this.backingCollection=new P5.CollectionOfTypedValues(r)}getClassName(){return fi.ClassName}static fromItems(e){if(e.length==0)return new fi(new bs.TypePlaceholder,[]);let r=e[0].getType(),n=new Is(r);return new fi(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Yr.List=fi;fi.ClassName="List"});var Bf=v(aa=>{"use strict";c();Object.defineProperty(aa,"__esModule",{value:!0});aa.ArrayVec=aa.ArrayVecType=void 0;var Ub=fr(),B5=Wy(),qb=mt(),sa=class extends qb.Type{constructor(e,r){super("Array",[r]),Ub.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return sa.ClassName}};aa.ArrayVecType=sa;sa.ClassName="ArrayVecType";var oa=class extends qb.TypedValue{constructor(e,r){super(e),Ub.guardLength(r,e.length),this.backingCollection=new B5.CollectionOfTypedValues(r)}getClassName(){return oa.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};aa.ArrayVec=oa;oa.ClassName="ArrayVec"});var mc=v(ca=>{"use strict";c();Object.defineProperty(ca,"__esModule",{value:!0});ca.H256Value=ca.H256Type=void 0;var Vb=mt(),Ss=class extends Vb.PrimitiveType{constructor(){super("H256")}getClassName(){return Ss.ClassName}};ca.H256Type=Ss;Ss.ClassName="H256Type";var ua=class extends Vb.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return ua.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ca.H256Value=ua;ua.ClassName="H256Value"});var Rf=v(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.NothingValue=fa.NothingType=void 0;var jb=mt(),Cs=class extends jb.PrimitiveType{constructor(){super("nothing")}getClassName(){return Cs.ClassName}};fa.NothingType=Cs;Cs.ClassName="NothingType";var la=class extends jb.PrimitiveValue{constructor(){super(new Cs)}getClassName(){return la.ClassName}equals(e){return!1}valueOf(){return{}}};fa.NothingValue=la;la.ClassName="NothingValue"});var wc=v(Ae=>{"use strict";c();var R5=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L5=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F5=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&R5(e,t,r);return L5(e,t),e},M5=Ae&&Ae.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var Hb=F5(je()),Gb=mt(),Ms=M5(Wt()),Vt=class extends Gb.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return Vt.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=Vt;Vt.ClassName="NumericalType";var Ts=class extends Vt{constructor(){super("u8",1,!1)}getClassName(){return Ts.ClassName}};Ae.U8Type=Ts;Ts.ClassName="U8Type";var xs=class extends Vt{constructor(){super("i8",1,!0)}getClassName(){return xs.ClassName}};Ae.I8Type=xs;xs.ClassName="I8Type";var Ns=class extends Vt{constructor(){super("u16",2,!1)}getClassName(){return Ns.ClassName}};Ae.U16Type=Ns;Ns.ClassName="U16Type";var Ds=class extends Vt{constructor(){super("i16",2,!0)}getClassName(){return Ds.ClassName}};Ae.I16Type=Ds;Ds.ClassName="I16Type";var Os=class extends Vt{constructor(){super("u32",4,!1)}getClassName(){return Os.ClassName}};Ae.U32Type=Os;Os.ClassName="U32Type";var Ps=class extends Vt{constructor(){super("i32",4,!0)}getClassName(){return Ps.ClassName}};Ae.I32Type=Ps;Ps.ClassName="I32Type";var Bs=class extends Vt{constructor(){super("u64",8,!1)}getClassName(){return Bs.ClassName}};Ae.U64Type=Bs;Bs.ClassName="U64Type";var Rs=class extends Vt{constructor(){super("i64",8,!0)}getClassName(){return Rs.ClassName}};Ae.I64Type=Rs;Rs.ClassName="I64Type";var Ls=class extends Vt{constructor(){super("BigUint",0,!1)}getClassName(){return Ls.ClassName}};Ae.BigUIntType=Ls;Ls.ClassName="BigUIntType";var Fs=class extends Vt{constructor(){super("Bigint",0,!0)}getClassName(){return Fs.ClassName}};Ae.BigIntType=Fs;Fs.ClassName="BigIntType";var jt=class extends Gb.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ms.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new Hb.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new Hb.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return jt.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=jt;jt.ClassName="NumericalValue";var ha=class extends jt{constructor(e){super(new Ts,new Ms.default(e))}getClassName(){return ha.ClassName}};Ae.U8Value=ha;ha.ClassName="U8Value";var da=class extends jt{constructor(e){super(new xs,new Ms.default(e))}getClassName(){return da.ClassName}};Ae.I8Value=da;da.ClassName="I8Value";var pa=class extends jt{constructor(e){super(new Ns,new Ms.default(e))}getClassName(){return pa.ClassName}};Ae.U16Value=pa;pa.ClassName="U16Value";var ga=class extends jt{constructor(e){super(new Ds,new Ms.default(e))}getClassName(){return ga.ClassName}};Ae.I16Value=ga;ga.ClassName="I16Value";var ya=class extends jt{constructor(e){super(new Os,new Ms.default(e))}getClassName(){return ya.ClassName}};Ae.U32Value=ya;ya.ClassName="U32Value";var ma=class extends jt{constructor(e){super(new Ps,new Ms.default(e))}getClassName(){return ma.ClassName}};Ae.I32Value=ma;ma.ClassName="I32Value";var wa=class extends jt{constructor(e){super(new Bs,e)}getClassName(){return wa.ClassName}};Ae.U64Value=wa;wa.ClassName="U64Value";var Ea=class extends jt{constructor(e){super(new Rs,e)}getClassName(){return Ea.ClassName}};Ae.I64Value=Ea;Ea.ClassName="I64Value";var va=class extends jt{constructor(e){super(new Ls,e)}getClassName(){return va.ClassName}};Ae.BigUIntValue=va;va.ClassName="BigUIntValue";var Aa=class extends jt{constructor(e){super(new Fs,e)}getClassName(){return Aa.ClassName}};Ae.BigIntValue=Aa;Aa.ClassName="BigIntValue"});var Lf=v(_a=>{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.StringValue=_a.StringType=void 0;var Qb=mt(),Us=class extends Qb.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return Us.ClassName}};_a.StringType=Us;Us.ClassName="StringType";var hi=class extends Qb.PrimitiveValue{constructor(e){super(new Us),this.value=e}getClassName(){return hi.ClassName}static fromUTF8(e){return new hi(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new hi(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};_a.StringValue=hi;hi.ClassName="StringValue"});var Ia=v(ba=>{"use strict";c();Object.defineProperty(ba,"__esModule",{value:!0});ba.TokenIdentifierValue=ba.TokenIdentifierType=void 0;var kb=mt(),U5="EGLD",qs=class extends kb.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return qs.ClassName}};ba.TokenIdentifierType=qs;qs.ClassName="TokenIdentifierType";var di=class extends kb.PrimitiveValue{constructor(e){super(new qs),this.value=e}static egld(){return new di(U5)}static esdtTokenIdentifier(e){return new di(e)}getClassName(){return di.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};ba.TokenIdentifierValue=di;di.ClassName="TokenIdentifierValue"});var Ff=v(hr=>{"use strict";c();var q5=hr&&hr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V5=hr&&hr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j5=hr&&hr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q5(e,t,r);return V5(e,t),e};Object.defineProperty(hr,"__esModule",{value:!0});hr.Tuple=hr.TupleType=void 0;var H5=j5(je()),G5=ys(),Kb=Qo(),Q5=ys(),Mn=class extends Q5.StructType{constructor(...e){super(Mn.prepareName(e),Mn.prepareFieldDefinitions(e))}getClassName(){return Mn.ClassName}static prepareName(e){let r=e.map(i=>i.toString()).join(", ");return`tuple${r.length}<${r}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new Kb.FieldDefinition(zb(i),"anonymous tuple field",n))}};hr.TupleType=Mn;Mn.ClassName="TupleType";function zb(t){return`field${t}`}var Vs=class extends G5.Struct{constructor(e,r){super(e,r)}getClassName(){return Vs.ClassName}static fromItems(e){if(e.length<1)throw new H5.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Mn(...r),i=e.map((s,o)=>new Kb.Field(s,zb(o)));return new Vs(n,i)}};hr.Tuple=Vs;Vs.ClassName="Tuple"});var Uf=v(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.VariadicValue=Sa.VariadicType=void 0;var Mf=mt(),gi=class extends Mf.Type{constructor(e){super("Variadic",[e],Mf.TypeCardinality.variable())}getClassName(){return gi.ClassName}};Sa.VariadicType=gi;gi.ClassName="VariadicType";var pi=class extends Mf.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return pi.ClassName}static fromItems(...e){if(e.length==0)return new pi(new gi(new Mf.TypePlaceholder),[]);let r=e[0].getType();return new pi(new gi(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var k5=Xr&&Xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K5=Xr&&Xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z5=Xr&&Xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&k5(e,t,r);return K5(e,t),e};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.TypeMapper=void 0;var Wb=z5(je()),W5=Xo(),$y=Nf(),$5=gc(),Y5=li(),J5=Mb(),qf=Of(),Yy=hc(),X5=Qo(),$b=yc(),Vf=Bf(),Z5=mc(),Yb=Rf(),dr=wc(),eF=Lf(),Jb=ys(),Xb=Ia(),yi=Ff(),Jy=Uf(),Xy=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new $b.OptionType(r[0])],["List",(...r)=>new $b.ListType(r[0])],["VarArgs",(...r)=>new Jy.VariadicType(r[0])],["MultiResultVec",(...r)=>new Jy.VariadicType(r[0])],["variadic",(...r)=>new Jy.VariadicType(r[0])],["OptionalArg",(...r)=>new $y.OptionalType(r[0])],["optional",(...r)=>new $y.OptionalType(r[0])],["OptionalResult",(...r)=>new $y.OptionalType(r[0])],["multi",(...r)=>new qf.CompositeType(...r)],["MultiArg",(...r)=>new qf.CompositeType(...r)],["MultiResult",(...r)=>new qf.CompositeType(...r)],["multi",(...r)=>new qf.CompositeType(...r)],["tuple",(...r)=>new yi.TupleType(...r)],["tuple2",(...r)=>new yi.TupleType(...r)],["tuple3",(...r)=>new yi.TupleType(...r)],["tuple4",(...r)=>new yi.TupleType(...r)],["tuple5",(...r)=>new yi.TupleType(...r)],["tuple6",(...r)=>new yi.TupleType(...r)],["tuple7",(...r)=>new yi.TupleType(...r)],["tuple8",(...r)=>new yi.TupleType(...r)],["array20",(...r)=>new Vf.ArrayVecType(20,r[0])],["array32",(...r)=>new Vf.ArrayVecType(32,r[0])],["array46",(...r)=>new Vf.ArrayVecType(46,r[0])],["array64",(...r)=>new Vf.ArrayVecType(64,r[0])]]),this.closedTypesMap=new Map([["u8",new dr.U8Type],["u16",new dr.U16Type],["u32",new dr.U32Type],["u64",new dr.U64Type],["U64",new dr.U64Type],["BigUint",new dr.BigUIntType],["i8",new dr.I8Type],["i16",new dr.I16Type],["i32",new dr.I32Type],["i64",new dr.I64Type],["Bigint",new dr.BigIntType],["BigInt",new dr.BigIntType],["bool",new $5.BooleanType],["bytes",new Y5.BytesType],["Address",new W5.AddressType],["H256",new Z5.H256Type],["utf-8 string",new eF.StringType],["TokenIdentifier",new Xb.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new Xb.TokenIdentifierType],["CodeMetadata",new J5.CodeMetadataType],["nothing",new Yb.NothingType],["AsyncCall",new Yb.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new Wb.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(Yy.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(Jb.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new Jb.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Yy.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Yy.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new X5.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new Wb.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};Xr.TypeMapper=Xy});var nI=v(Zr=>{"use strict";c();var tF=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rF=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nF=Zr&&Zr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tF(e,t,r);return rF(e,t),e};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.AbiRegistry=void 0;var Zb=nF(je()),em=fr(),Ec=My(),eI=hc(),tI=ys(),iF=Zy(),sF="?",Ca=class{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||sF,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Ec.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Ec.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let y=s[d];if(y.type=="struct")u.push(tI.StructType.fromJSON({name:d,fields:y.fields}));else if(y.type=="enum")u.push(eI.EnumType.fromJSON({name:d,variants:y.variants}));else throw new Zb.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new Ca({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(tI.StructType.ClassName));return em.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(eI.EnumType.ClassName));return em.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return em.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new iF.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new Zb.ErrTypingSystem("Did not re-map all custom types");let n=rI(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(rI(o,e));return new Ca({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};Zr.AbiRegistry=Ca;function rI(t,e){let r=t.input.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Ec.EndpointDefinition(t.name,r,n,t.modifiers)}});var sI=v(Ta=>{"use strict";c();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.createListOfTokenIdentifiers=Ta.createListOfAddresses=void 0;var oF=Xo(),iI=yc(),aF=Ia();function uF(t){let e=t.map(n=>new oF.AddressValue(n));return iI.List.fromItems(e)}Ta.createListOfAddresses=uF;function cF(t){let e=t.map(n=>new aF.TokenIdentifierValue(n));return iI.List.fromItems(e)}Ta.createListOfTokenIdentifiers=cF});var EI=v(Ht=>{"use strict";c();var lF=Ht&&Ht.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fF=Ht&&Ht.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hF=Ht&&Ht.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lF(e,t,r);return fF(e,t),e};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.onPrimitiveTypeSelect=Ht.onPrimitiveValueSelect=Ht.onTypedValueSelect=Ht.onTypeSelect=void 0;var Hf=hF(je()),oI=Xo(),aI=gc(),uI=li(),cI=hc(),jf=yc(),lI=mc(),fI=wc(),hI=Rf(),dI=ys(),pI=Ia(),gI=Ff(),yI=mt(),mI=Bf(),wI=Lf();function dF(t,e){if(t.hasExactClass(jf.OptionType.ClassName))return e.onOption();if(t.hasExactClass(jf.ListType.ClassName))return e.onList();if(t.hasExactClass(mI.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(yI.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(dI.StructType.ClassName))return e.onStruct();if(t.hasExactClass(gI.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(cI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't known: ${t}`)}Ht.onTypeSelect=dF;function pF(t,e){if(t.hasClassOrSuperclass(yI.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(jf.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(jf.List.ClassName))return e.onList();if(t.hasExactClass(mI.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(dI.Struct.ClassName))return e.onStruct();if(t.hasExactClass(gI.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(cI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't typed: ${t}`)}Ht.onTypedValueSelect=pF;function gF(t,e){if(t.hasExactClass(aI.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(fI.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(oI.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(uI.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(wI.StringValue.ClassName))return e.onString();if(t.hasExactClass(lI.H256Value.ClassName))return e.onH256();if(t.hasExactClass(pI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(hI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Ht.onPrimitiveValueSelect=gF;function yF(t,e){if(t.hasExactClass(aI.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(fI.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(oI.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(uI.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(wI.StringType.ClassName))return e.onString();if(t.hasExactClass(lI.H256Type.ClassName))return e.onH256();if(t.hasExactClass(pI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(hI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Ht.onPrimitiveTypeSelect=yF});var bt=v(Ue=>{"use strict";c();var mF=Ue&&Ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xe=Ue&&Ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mF(e,t,r)};Object.defineProperty(Ue,"__esModule",{value:!0});Xe(nI(),Ue);Xe(Xo(),Ue);Xe(Nf(),Ue);Xe(gc(),Ue);Xe(li(),Ue);Xe(Of(),Ue);Xe(My(),Ue);Xe(hc(),Ue);Xe(sI(),Ue);Xe(Qo(),Ue);Xe(yc(),Ue);Xe(Bf(),Ue);Xe(mc(),Ue);Xe(EI(),Ue);Xe(Rf(),Ue);Xe(wc(),Ue);Xe(Lf(),Ue);Xe(ys(),Ue);Xe(Ia(),Ue);Xe(Ff(),Ue);Xe(vf(),Ue);Xe(Zy(),Ue);Xe(mt(),Ue);Xe(Uf(),Ue)});var AI=v(en=>{"use strict";c();var wF=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EF=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vF=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wF(e,t,r);return EF(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.OptionValueBinaryCodec=void 0;var vI=vF(je()),Gf=bt(),tm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Gf.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new vI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Gf.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Gf.OptionValue(r);if(e[0]!=1)throw new vI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Gf.OptionValue(r,n)}encodeNested(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([])}};en.OptionValueBinaryCodec=tm});var _I=v(Qf=>{"use strict";c();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.AddressBinaryCodec=void 0;var AF=Zt(),_F=bt(),rm=class{decodeNested(e){let r=e.slice(0,32),n=new AF.Address(r);return[new _F.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Qf.AddressBinaryCodec=rm});var II=v(tn=>{"use strict";c();var bF=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IF=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SF=tn&&tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bF(e,t,r);return IF(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.BooleanBinaryCodec=void 0;var CF=SF(je()),bI=bt(),Dr=class{decodeNested(e){let r=e.readUInt8(0);return[new bI.BooleanValue(r==Dr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new CF.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new bI.BooleanValue(r==Dr.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([Dr.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([])}};tn.BooleanBinaryCodec=Dr;Dr.TRUE=1;Dr.FALSE=0});var Kf=v(kf=>{"use strict";c();Object.defineProperty(kf,"__esModule",{value:!0});kf.SizeOfU32=void 0;kf.SizeOfU32=4});var nm=v(rn=>{"use strict";c();var TF=rn&&rn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.zeroPadStringIfOddLength=rn.isPaddedHex=rn.numberToPaddedHex=void 0;var xF=TF(Wt());function NF(t){let e=new xF.default(t).toString(16);return SI(e)}rn.numberToPaddedHex=NF;function DF(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}rn.isPaddedHex=DF;function SI(t){return t=t||"",t.length%2==1?"0"+t:t}rn.zeroPadStringIfOddLength=SI});var zf=v(wt=>{"use strict";c();var OF=wt&&wt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wt,"__esModule",{value:!0});wt.prependByteToBuffer=wt.flipBufferBitsInPlace=wt.getHexMagnitudeOfBigInt=wt.bigIntToBuffer=wt.bufferToBigInt=wt.cloneBuffer=wt.isMsbZero=wt.isMsbOne=void 0;var im=OF(Wt()),PF=nm();function CI(t,e=0){return t[e]>>7==1}wt.isMsbOne=CI;function BF(t,e=0){return!CI(t,e)}wt.isMsbZero=BF;function RF(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}wt.cloneBuffer=RF;function LF(t){let e=t.toString("hex");return new im.default(`0x${e}`,16)}wt.bufferToBigInt=LF;function FF(t){let e=TI(t);return h.Buffer.from(e,"hex")}wt.bigIntToBuffer=FF;function TI(t){return t=new im.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new im.default(-1))),PF.numberToPaddedHex(t)):""}wt.getHexMagnitudeOfBigInt=TI;function MF(t){for(let e=0;e{"use strict";c();var qF=xa&&xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xa,"__esModule",{value:!0});xa.NumericalBinaryCodec=void 0;var vc=qF(Wt()),sm=bt(),xI=Kf(),ht=zf(),om=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=xI.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=ht.cloneBuffer(e);if(e.length==0)return new sm.NumericalValue(r,new vc.default(0));if(!r.withSign||ht.isMsbZero(n)){let l=ht.bufferToBigInt(n);return new sm.NumericalValue(r,l)}ht.flipBufferBitsInPlace(n);let u=ht.bufferToBigInt(n).multipliedBy(new vc.default(-1)).minus(new vc.default(1));return new sm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(xI.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=ht.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=ht.bigIntToBuffer(e.value);ht.isMsbOne(o)&&(o=ht.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new vc.default(1)),i=ht.bigIntToBuffer(n);ht.flipBufferBitsInPlace(i),ht.isMsbZero(i)&&(i=ht.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):ht.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=ht.bigIntToBuffer(e.value);return ht.isMsbOne(i)&&(i=ht.prependByteToBuffer(i,0)),i}let r=e.value.plus(new vc.default(1)),n=ht.bigIntToBuffer(r);return ht.flipBufferBitsInPlace(n),ht.isMsbZero(n)&&(n=ht.prependByteToBuffer(n,255)),n}};xa.NumericalBinaryCodec=om});var DI=v(Wf=>{"use strict";c();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.H256BinaryCodec=void 0;var VF=mc(),am=class{decodeNested(e){let r=e.slice(0,32);return[new VF.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Wf.H256BinaryCodec=am});var Jf=v(Yf=>{"use strict";c();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.BytesBinaryCodec=void 0;var OI=li(),$f=Kf(),um=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice($f.SizeOfU32,$f.SizeOfU32+r);return[new OI.BytesValue(n),$f.SizeOfU32+r]}decodeTopLevel(e){return new OI.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc($f.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Yf.BytesBinaryCodec=um});var BI=v(Xf=>{"use strict";c();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.TokenIdentifierCodec=void 0;var jF=li(),PI=Ia(),HF=Jf(),cm=class{constructor(){this.bytesCodec=new HF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new PI.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new PI.TokenIdentifierValue(r.toString())}encodeNested(e){let r=jF.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Xf.TokenIdentifierCodec=cm});var LI=v(Zf=>{"use strict";c();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.NothingCodec=void 0;var RI=bt(),lm=class{decodeNested(){return[new RI.NothingValue,0]}decodeTopLevel(){return new RI.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Zf.NothingCodec=lm});var MI=v(eh=>{"use strict";c();Object.defineProperty(eh,"__esModule",{value:!0});eh.StringBinaryCodec=void 0;var FI=bt(),GF=li(),QF=Jf(),fm=class{constructor(){this.bytesBinaryCodec=new QF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new FI.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new FI.StringValue(e.toString())}encodeNested(e){let r=GF.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};eh.StringBinaryCodec=fm});var UI=v(rh=>{"use strict";c();Object.defineProperty(rh,"__esModule",{value:!0});rh.PrimitiveBinaryCodec=void 0;var th=bt(),kF=_I(),KF=II(),zF=NI(),WF=DI(),$F=Jf(),YF=BI(),JF=LI(),XF=MI(),hm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new KF.BooleanBinaryCodec,this.numericalCodec=new zF.NumericalBinaryCodec,this.addressCodec=new kF.AddressBinaryCodec,this.h256Codec=new WF.H256BinaryCodec,this.bytesCodec=new $F.BytesBinaryCodec,this.stringCodec=new XF.StringBinaryCodec,this.tokenIdentifierCodec=new YF.TokenIdentifierCodec,this.nothingCodec=new JF.NothingCodec}decodeNested(e,r){return th.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return th.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return th.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return th.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};rh.PrimitiveBinaryCodec=hm});var jI=v(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.ListBinaryCodec=void 0;var qI=bt(),VI=Kf(),dm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=VI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new qI.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(VI.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return h.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return h.Buffer.concat(r)}};nh.ListBinaryCodec=dm});var gm=v(ih=>{"use strict";c();Object.defineProperty(ih,"__esModule",{value:!0});ih.FieldsBinaryCodec=void 0;var ZF=bt(),pm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new ZF.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return h.Buffer.concat(r)}};ih.FieldsBinaryCodec=pm});var mm=v(sh=>{"use strict";c();Object.defineProperty(sh,"__esModule",{value:!0});sh.StructBinaryCodec=void 0;var e4=bt(),t4=gm(),ym=class{constructor(e){this.fieldsCodec=new t4.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new e4.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};sh.StructBinaryCodec=ym});var HI=v(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.EnumBinaryCodec=void 0;var oh=bt(),r4=gm(),wm=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new r4.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new oh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new oh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new oh.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return h.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new oh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};ah.EnumBinaryCodec=wm});var GI=v(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.TupleBinaryCodec=void 0;var n4=mm(),Em=class{constructor(e){this.structCodec=new n4.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};uh.TupleBinaryCodec=Em});var QI=v(ch=>{"use strict";c();Object.defineProperty(ch,"__esModule",{value:!0});ch.ArrayVecBinaryCodec=void 0;var i4=bt(),vm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var s4=pr&&pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o4=pr&&pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a4=pr&&pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s4(e,t,r);return o4(e,t),e};Object.defineProperty(pr,"__esModule",{value:!0});pr.BinaryCodecConstraints=pr.BinaryCodec=void 0;var kI=a4(je()),lh=bt(),KI=fr(),u4=AI(),c4=UI(),l4=jI(),f4=mm(),h4=HI(),d4=GI(),p4=QI(),Am=class{constructor(e=null){this.constraints=e||new fh,this.optionCodec=new u4.OptionValueBinaryCodec(this),this.listCodec=new l4.ListBinaryCodec(this),this.arrayCodec=new p4.ArrayVecBinaryCodec(this),this.primitiveCodec=new c4.PrimitiveBinaryCodec(this),this.structCodec=new f4.StructBinaryCodec(this),this.tupleCodec=new d4.TupleBinaryCodec(this),this.enumCodec=new h4.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),lh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=lh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return KI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),lh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return KI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),lh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};pr.BinaryCodec=Am;var fh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||40960,this.maxListLength=e?.maxListLength||8192}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new kI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new kI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};pr.BinaryCodecConstraints=fh});var zI=v(gr=>{"use strict";c();var g4=gr&&gr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gr,"__esModule",{value:!0});gr.decodeBigNumber=gr.decodeString=gr.decodeBool=gr.decodeUnsignedNumber=void 0;var y4=g4(Wt()),hh=bt(),m4=_m(),dh=new m4.BinaryCodec;function w4(t){let e=dh.decodeTopLevel(t,new hh.BigUIntType);return Number(e.valueOf())}gr.decodeUnsignedNumber=w4;function E4(t){return!!dh.decodeTopLevel(t,new hh.BooleanType).valueOf()}gr.decodeBool=E4;function v4(t){let e=dh.decodeTopLevel(t,new hh.BytesType);return String(e.valueOf())}gr.decodeString=v4;function A4(t){let e=dh.decodeTopLevel(t,new hh.BigUIntType);return new y4.default(e.valueOf())}gr.decodeBigNumber=A4});var $I=v(mi=>{"use strict";c();var _4=mi&&mi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WI=mi&&mi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_4(e,t,r)};Object.defineProperty(mi,"__esModule",{value:!0});WI(_m(),mi);WI(zI(),mi)});var gh=v(ph=>{"use strict";c();Object.defineProperty(ph,"__esModule",{value:!0});ph.ArgSerializer=void 0;var YI=Lo(),b4=$I(),bm=Nf(),Im=Of(),Sm=Uf(),I4={codec:new b4.BinaryCodec},Cm=class{constructor(e){e=Object.assign(Object.assign({},I4),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(YI.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let f=0;f=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(YI.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let s of e)i(s);function i(s){if(s.hasExactClass(bm.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(Sm.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(Im.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};ph.ArgSerializer=Cm});var wh=v(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.Compatibility=void 0;var S4=Zt(),yh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==S4.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};mh.Compatibility=yh;yh.areWarningsEnabled=!0});var JI=v(nn=>{"use strict";c();var C4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C4(e,t,r);return T4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Hash=void 0;var N4=x4(je()),Ac=class{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new N4.ErrBadType("hash","buffer | string",e)}static empty(){return new Ac(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};nn.Hash=Ac});var ZI=v(yr=>{"use strict";c();var D4=yr&&yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O4=yr&&yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4=yr&&yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&D4(e,t,r);return O4(e,t),e};Object.defineProperty(yr,"__esModule",{value:!0});yr.TransactionOptions=yr.TransactionVersion=void 0;var Or=Lo(),XI=P4(je()),Na=class{constructor(e){if(e=Number(e),e<1)throw new XI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Na(Or.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new Na(Or.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};yr.TransactionVersion=Na;var Da=class{constructor(e){if(e=Number(e),e<0)throw new XI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new Da(Or.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Or.TRANSACTION_OPTIONS_TX_GUARDED),new Da(r)}isWithHashSign(){return(this.value&Or.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Or.TRANSACTION_OPTIONS_TX_GUARDED)==Or.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Or.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};yr.TransactionOptions=Da});var tS=v((Hee,eS)=>{"use strict";c();eS.exports=B4;function B4(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var Eh=iS;Eh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Oa=new Array(64),nS=new Array(123);for(Pr=0;Pr<64;)nS[Oa[Pr]=Pr<26?Pr+65:Pr<52?Pr+71:Pr<62?Pr-4:Pr-59|43]=Pr++;var Pr;Eh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Oa[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Oa[u|l>>6],s[o++]=Oa[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Oa[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var rS="invalid encoding";Eh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=nS[u])===void 0)throw Error(rS);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(rS);return n-i};Eh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var aS=v((Kee,oS)=>{"use strict";c();oS.exports=vh;function vh(){this._listeners={}}vh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};vh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();dS.exports=uS(uS);function uS(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,cS),t.writeFloatBE=e.bind(null,lS);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,fS),t.readFloatBE=r.bind(null,hS)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,cS,0,4),t.writeDoubleBE=e.bind(null,lS,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,y=4294967296*(l&1048575)+u;return d===2047?y?NaN:f*(1/0):d===0?f*5e-324*y:f*Math.pow(2,d-1075)*(y+4503599627370496)}t.readDoubleLE=r.bind(null,fS,0,4),t.readDoubleBE=r.bind(null,hS,4,0)}(),t}function cS(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function lS(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function fS(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function hS(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var gS=v((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var mS=v(yS=>{"use strict";c();var Tm=yS;Tm.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Tm.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var ES=v((Zee,wS)=>{"use strict";c();wS.exports=R4;function R4(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var AS=v((tte,vS)=>{"use strict";c();vS.exports=xt;var _c=Ei();function xt(t,e){this.lo=t>>>0,this.hi=e>>>0}var js=xt.zero=new xt(0,0);js.toNumber=function(){return 0};js.zzEncode=js.zzDecode=function(){return this};js.length=function(){return 1};var L4=xt.zeroHash="\0\0\0\0\0\0\0\0";xt.fromNumber=function(e){if(e===0)return js;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new xt(n,i)};xt.from=function(e){if(typeof e=="number")return xt.fromNumber(e);if(_c.isString(e))if(_c.Long)e=_c.Long.fromString(e);else return xt.fromNumber(parseInt(e,10));return e.low||e.high?new xt(e.low>>>0,e.high>>>0):js};xt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};xt.prototype.toLong=function(e){return _c.Long?new _c.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var wi=String.prototype.charCodeAt;xt.fromHash=function(e){return e===L4?js:new xt((wi.call(e,0)|wi.call(e,1)<<8|wi.call(e,2)<<16|wi.call(e,3)<<24)>>>0,(wi.call(e,4)|wi.call(e,5)<<8|wi.call(e,6)<<16|wi.call(e,7)<<24)>>>0)};xt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};xt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};xt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};xt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Ei=v(xm=>{"use strict";c();var me=xm;me.asPromise=tS();me.base64=sS();me.EventEmitter=aS();me.float=pS();me.inquire=gS();me.utf8=mS();me.pool=ES();me.LongBits=AS();me.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||xm;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};me.Buffer=function(){try{var t=me.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,r){var n=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function _S(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};me.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();TS.exports=Le;var mr=Ei(),Nm,Ah=mr.LongBits,IS=mr.base64,SS=mr.utf8;function bc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Om(){}function F4(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Le(){this.len=0,this.head=new bc(Om,0,0),this.tail=this.head,this.states=null}var CS=function(){return mr.Buffer?function(){return(Le.create=function(){return new Nm})()}:function(){return new Le}};Le.create=CS();Le.alloc=function(e){return new mr.Array(e)};mr.Array!==Array&&(Le.alloc=mr.pool(Le.alloc,mr.Array.prototype.subarray));Le.prototype._push=function(e,r,n){return this.tail=this.tail.next=new bc(e,r,n),this.len+=r,this};function Pm(t,e,r){e[r]=t&255}function M4(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Bm(t,e){this.len=t,this.next=void 0,this.val=e}Bm.prototype=Object.create(bc.prototype);Bm.prototype.fn=M4;Le.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Bm((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Le.prototype.int32=function(e){return e<0?this._push(Rm,10,Ah.fromNumber(e)):this.uint32(e)};Le.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Rm(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Le.prototype.uint64=function(e){var r=Ah.from(e);return this._push(Rm,r.length(),r)};Le.prototype.int64=Le.prototype.uint64;Le.prototype.sint64=function(e){var r=Ah.from(e).zzEncode();return this._push(Rm,r.length(),r)};Le.prototype.bool=function(e){return this._push(Pm,1,e?1:0)};function Dm(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Le.prototype.fixed32=function(e){return this._push(Dm,4,e>>>0)};Le.prototype.sfixed32=Le.prototype.fixed32;Le.prototype.fixed64=function(e){var r=Ah.from(e);return this._push(Dm,4,r.lo)._push(Dm,4,r.hi)};Le.prototype.sfixed64=Le.prototype.fixed64;Le.prototype.float=function(e){return this._push(mr.float.writeFloatLE,4,e)};Le.prototype.double=function(e){return this._push(mr.float.writeDoubleLE,8,e)};var U4=mr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Pm,1,0);if(mr.isString(e)){var n=Le.alloc(r=IS.length(e));IS.decode(e,n,0),e=n}return this.uint32(r)._push(U4,r,e)};Le.prototype.string=function(e){var r=SS.length(e);return r?this.uint32(r)._push(SS.write,r,e):this._push(Pm,1,0)};Le.prototype.fork=function(){return this.states=new F4(this),this.head=this.tail=new bc(Om,0,0),this.len=0,this};Le.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new bc(Om,0,0),this.len=0),this};Le.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Le.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Le._configure=function(t){Nm=t,Le.create=CS(),Nm._configure()}});var DS=v((ate,NS)=>{"use strict";c();NS.exports=sn;var xS=Lm();(sn.prototype=Object.create(xS.prototype)).constructor=sn;var vi=Ei();function sn(){xS.call(this)}sn._configure=function(){sn.alloc=vi._Buffer_allocUnsafe,sn.writeBytesBuffer=vi.Buffer&&vi.Buffer.prototype instanceof Uint8Array&&vi.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(sn.writeBytesBuffer,r,e),this};function q4(t,e,r){t.length<40?vi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}sn.prototype.string=function(e){var r=vi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(q4,r,e),this};sn._configure()});var Um=v((cte,LS)=>{"use strict";c();LS.exports=dt;var on=Ei(),Mm,BS=on.LongBits,V4=on.utf8;function Br(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function dt(t){this.buf=t,this.pos=0,this.len=t.length}var OS=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new dt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new dt(e);throw Error("illegal buffer")},RS=function(){return on.Buffer?function(r){return(dt.create=function(i){return on.Buffer.isBuffer(i)?new Mm(i):OS(i)})(r)}:OS};dt.create=RS();dt.prototype._slice=on.Array.prototype.subarray||on.Array.prototype.slice;dt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Br(this,10);return e}}();dt.prototype.int32=function(){return this.uint32()|0};dt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Fm(){var t=new BS(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Br(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Br(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}dt.prototype.bool=function(){return this.uint32()!==0};function _h(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}dt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return _h(this.buf,this.pos+=4)};dt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return _h(this.buf,this.pos+=4)|0};function PS(){if(this.pos+8>this.len)throw Br(this,8);return new BS(_h(this.buf,this.pos+=4),_h(this.buf,this.pos+=4))}dt.prototype.float=function(){if(this.pos+4>this.len)throw Br(this,4);var e=on.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};dt.prototype.double=function(){if(this.pos+8>this.len)throw Br(this,4);var e=on.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};dt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Br(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};dt.prototype.string=function(){var e=this.bytes();return V4.read(e,0,e.length)};dt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Br(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Br(this);while(this.buf[this.pos++]&128);return this};dt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};dt._configure=function(t){Mm=t,dt.create=RS(),Mm._configure();var e=on.Long?"toLong":"toNumber";on.merge(dt.prototype,{int64:function(){return Fm.call(this)[e](!1)},uint64:function(){return Fm.call(this)[e](!0)},sint64:function(){return Fm.call(this).zzDecode()[e](!1)},fixed64:function(){return PS.call(this)[e](!0)},sfixed64:function(){return PS.call(this)[e](!1)}})}});var qS=v((fte,US)=>{"use strict";c();US.exports=Hs;var MS=Um();(Hs.prototype=Object.create(MS.prototype)).constructor=Hs;var FS=Ei();function Hs(t){MS.call(this,t)}Hs._configure=function(){FS.Buffer&&(Hs.prototype._slice=FS.Buffer.prototype.slice)};Hs.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Hs._configure()});var jS=v((dte,VS)=>{"use strict";c();VS.exports=Ic;var qm=Ei();(Ic.prototype=Object.create(qm.EventEmitter.prototype)).constructor=Ic;function Ic(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");qm.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Ic.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return qm.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Ic.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var GS=v(HS=>{"use strict";c();var j4=HS;j4.Service=jS()});var kS=v((mte,QS)=>{"use strict";c();QS.exports={}});var WS=v(zS=>{"use strict";c();var er=zS;er.build="minimal";er.Writer=Lm();er.BufferWriter=DS();er.Reader=Um();er.BufferReader=qS();er.util=Ei();er.rpc=GS();er.roots=kS();er.configure=KS;function KS(){er.util._configure(),er.Writer._configure(er.BufferWriter),er.Reader._configure(er.BufferReader)}KS()});var YS=v((Ate,$S)=>{"use strict";c();$S.exports=WS()});var XS=v((bte,JS)=>{"use strict";c();var Pa=YS(),bh=Pa.Reader,H4=Pa.Writer,J=Pa.util,Sc=Pa.roots.default||(Pa.roots.default={});Sc.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof bh||(n=new bh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Sc.proto.Transaction)return n;var i=new Sc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Pa.util.toJSONOptions)},e}(),t}();JS.exports=Sc});var eC=v(wr=>{"use strict";c();var G4=wr&&wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q4=wr&&wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4=wr&&wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G4(e,t,r);return Q4(e,t),e},K4=wr&&wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wr,"__esModule",{value:!0});wr.ProtoSerializer=void 0;var z4=K4(Wt()),Vm=Zt(),W4=Lo(),$4=k4(je()),Y4=zf(),ZS=XS(),jm=class{serializeTransaction(e){let r=new Vm.Address(e.getReceiver().bech32()).pubkey(),n=new Vm.Address(e.getSender().bech32()).pubkey(),i=new ZS.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:r,RcvUserName:null,SndAddr:n,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==W4.TRANSACTION_OPTIONS_DEFAULT&&(i.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let a=e.getGuardian();i.GuardAddr=new Vm.Address(a.bech32()).pubkey(),i.GuardSignature=e.getGuardianSignature()}let s=ZS.proto.Transaction.encode(i).finish();return h.Buffer.from(s)}serializeTransactionValue(e){let r=new z4.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=Y4.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new $4.ErrUnsupportedOperation("deserializeTransaction")}};wr.ProtoSerializer=jm});var tC=v(Gs=>{"use strict";c();var J4=Gs&&Gs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X4=Gs&&Gs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&J4(e,t,r)};Object.defineProperty(Gs,"__esModule",{value:!0});X4(eC(),Gs)});var iC=v(an=>{"use strict";c();var Z4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eM=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tM=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z4(e,t,r);return eM(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.Signature=void 0;var rC=tM(je()),nC=64,Rr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Rr.fromHex(e);if(e instanceof h.Buffer)return Rr.fromBuffer(e)}}static empty(){return new Rr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Rr.isValidHex(e))throw new rC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==nC}static fromValidHex(e){let r=new Rr;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=nC)throw new rC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};an.Signature=Rr});var Cc=v(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.TransactionPayload=void 0;var Ba=class{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ba("");let r=h.Buffer.from(e,"base64").toString();return new Ba(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>h.Buffer.from(e,"hex"))}length(){return h.Buffer.from(this.data).length}};Ih.TransactionPayload=Ba});var Hm=v((Bte,sC)=>{c();Un.notEqual=nM;Un.notOk=iM;Un.equal=rM;Un.ok=Un;sC.exports=Un;function rM(t,e,r){Un(t==e,r)}function nM(t,e,r){Un(t!=e,r)}function iM(t,e){Un(!t,e)}function Un(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ua=v(Ma=>{"use strict";c();var Gm=j0(),La=G0(),oC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ma.Buffer=z;Ma.SlowBuffer=lM;Ma.INSPECT_MAX_BYTES=50;var Sh=2147483647;Ma.kMaxLength=Sh;z.TYPED_ARRAY_SUPPORT=sM();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sM(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Sh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return zm(t)}return lC(t,e,r)}z.poolSize=8192;function lC(t,e,r){if(typeof t=="string")return aM(t,e);if(ArrayBuffer.isView(t))return uM(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(un(t,ArrayBuffer)||t&&un(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(un(t,SharedArrayBuffer)||t&&un(t.buffer,SharedArrayBuffer)))return km(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=cM(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return lC(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function fC(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function oM(t,e,r){return fC(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return oM(t,e,r)};function zm(t){return fC(t),qn(t<0?0:Wm(t)|0)}z.allocUnsafe=function(t){return zm(t)};z.allocUnsafeSlow=function(t){return zm(t)};function aM(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=hC(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Qm(t){let e=t.length<0?0:Wm(t.length)|0,r=qn(e);for(let n=0;n=Sh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Sh.toString(16)+" bytes");return t|0}function lM(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),un(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function hC(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||un(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Km(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return AC(t).length;default:if(i)return n?-1:Km(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=hC;function fM(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return AM(this,e,r);case"utf8":case"utf-8":return pC(this,e,r);case"ascii":return EM(this,e,r);case"latin1":case"binary":return vM(this,e,r);case"base64":return mM(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function Qs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};oC&&(z.prototype[oC]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ym(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:aC(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):aC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function aC(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return hM(this,e,r,n);case"utf8":case"utf-8":return dM(this,e,r,n);case"ascii":case"latin1":case"binary":return pM(this,e,r,n);case"base64":return gM(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yM(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mM(t,e,r){return e===0&&r===t.length?Gm.fromByteArray(t):Gm.fromByteArray(t.slice(e,r))}function pC(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return wM(n)}var uC=4096;function wM(t){let e=t.length;if(e<=uC)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Nt(e,4,this.length),La.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),La.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!1,52,8)};function tr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function gC(t,e,r,n,i){vC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function yC(t,e,r,n,i){vC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=Ai(function(e,r=0){return gC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=Ai(function(e,r=0){return yC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=Ai(function(e,r=0){return gC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=Ai(function(e,r=0){return yC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mC(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function wC(t,e,r,n,i){return e=+e,r=r>>>0,i||mC(t,e,r,4,34028234663852886e22,-34028234663852886e22),La.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return wC(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return wC(this,e,r,!1,n)};function EC(t,e,r,n,i){return e=+e,r=r>>>0,i||mC(t,e,r,8,17976931348623157e292,-17976931348623157e292),La.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return EC(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return EC(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=cC(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=cC(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function cC(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function bM(t,e,r){Fa(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Tc(e,t.length-(r+1))}function vC(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Ra.ERR_OUT_OF_RANGE("value",a,t)}bM(n,i,s)}function Fa(t,e){if(typeof t!="number")throw new Ra.ERR_INVALID_ARG_TYPE(e,"number",t)}function Tc(t,e,r){throw Math.floor(t)!==t?(Fa(t,r),new Ra.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ra.ERR_BUFFER_OUT_OF_BOUNDS:new Ra.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var IM=/[^+/0-9A-Za-z-_]/g;function SM(t){if(t=t.split("=")[0],t=t.trim().replace(IM,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Km(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function CM(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function AC(t){return Gm.toByteArray(SM(t))}function Ch(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function un(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ym(t){return t!==t}var xM=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ai(t){return typeof BigInt>"u"?NM:t}function NM(){throw new Error("BigInt not supported")}});var bC=v((Ute,_C)=>{c();_C.exports=Jm;Jm.supported=typeof WebAssembly<"u";function Jm(t){if(!Jm.supported)return null;var e=t&&t.imports,r=DM("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function DM(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(OM)):new(Ua()).Buffer(t,"base64")}function OM(t){return t.charCodeAt(0)}});var DC=v((Hte,ln)=>{c();var cn=Hm(),Ke=bC()(),Vn=64,Th=[];ln.exports=Er;var IC=ln.exports.BYTES_MIN=16,SC=ln.exports.BYTES_MAX=64,Vte=ln.exports.BYTES=32,CC=ln.exports.KEYBYTES_MIN=16,TC=ln.exports.KEYBYTES_MAX=64,jte=ln.exports.KEYBYTES=32,xC=ln.exports.SALTBYTES=16,NC=ln.exports.PERSONALBYTES=16;function Er(t,e,r,n,i){if(!(this instanceof Er))return new Er(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(cn(t>=IC,"digestLength must be at least "+IC+", was given "+t),cn(t<=SC,"digestLength must be at most "+SC+", was given "+t),e!=null&&cn(e.length>=CC,"key must be at least "+CC+", was given "+e.length),e!=null&&cn(e.length<=TC,"key must be at least "+TC+", was given "+e.length),r!=null&&cn(r.length===xC,"salt must be exactly "+xC+", was given "+r.length),n!=null&&cn(n.length===NC,"personal must be exactly "+NC+", was given "+n.length)),Th.length||(Th.push(Vn),Vn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Th.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,Vn,Vn+e.length),Ke.memory[this.pointer+200]=128)}Er.prototype.update=function(t){return cn(this.finalized===!1,"Hash instance finalized"),cn(t,"input must be TypedArray or Buffer"),Vn+t.length>Ke.memory.length&&Ke.realloc(Vn+t.length),Ke.memory.set(t,Vn),Ke.exports.blake2b_update(this.pointer,Vn,Vn+t.length),this};Er.prototype.digest=function(t){if(cn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Th.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return BM(Ke.memory,this.pointer+128,this.digestLength);cn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ii=Hm(),Nc=DC();function xh(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function OC(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function UC(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function _i(t,e,r,n,i,s){var o=xc[i],a=xc[i+1],u=xc[s],l=xc[s+1];xh(Ie,t,e),OC(Ie,t,o,a);var f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1];Ie[n]=d,Ie[n+1]=f,xh(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=f>>>24^d<<8,Ie[e+1]=d>>>24^f<<8,xh(Ie,t,e),OC(Ie,t,u,l),f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1],Ie[n]=f>>>16^d<<16,Ie[n+1]=d>>>16^f<<16,xh(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=d>>>31^f<<1,Ie[e+1]=f>>>31^d<<1}var qC=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),LM=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Gt=new Uint8Array(LM.map(function(t){return t*2})),Ie=new Uint32Array(32),xc=new Uint32Array(32);function VC(t,e){var r=0;for(r=0;r<16;r++)Ie[r]=t.h[r],Ie[r+16]=qC[r];for(Ie[24]=Ie[24]^t.t,Ie[25]=Ie[25]^t.t/4294967296,e&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]),r=0;r<32;r++)xc[r]=UC(t.b,4*r);for(r=0;r<12;r++)_i(0,8,16,24,Gt[r*16+0],Gt[r*16+1]),_i(2,10,18,26,Gt[r*16+2],Gt[r*16+3]),_i(4,12,20,28,Gt[r*16+4],Gt[r*16+5]),_i(6,14,22,30,Gt[r*16+6],Gt[r*16+7]),_i(0,10,20,30,Gt[r*16+8],Gt[r*16+9]),_i(2,12,22,24,Gt[r*16+10],Gt[r*16+11]),_i(4,14,16,26,Gt[r*16+12],Gt[r*16+13]),_i(6,8,18,28,Gt[r*16+14],Gt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ie[r]^Ie[r+16]}var bi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function qa(t,e,r,n){bi.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,bi[0]=t,e&&(bi[1]=e.length),bi[2]=1,bi[3]=1,r&&bi.set(r,32),n&&bi.set(n,48);for(var i=0;i<16;i++)this.h[i]=qC[i]^UC(bi,i*4);e&&(jC(this,e),this.c=128)}qa.prototype.update=function(t){return Ii(t!=null,"input must be Uint8Array or Buffer"),jC(this,t),this};qa.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ii(e.length>=this.outlen,"out must have at least outlen bytes of space"),FM(this,e),t==="hex"?MM(e):e};qa.prototype.final=qa.prototype.digest;qa.ready=function(t){Nc.ready(function(){t()})};function jC(t,e){for(var r=0;r>2]>>8*(r&3);return e}function MM(t){for(var e="",r=0;r=PC,"outlen must be at least "+PC+", was given "+e),Ii(e<=BC,"outlen must be at most "+BC+", was given "+e),r!=null&&Ii(r.length>=RC,"key must be at least "+RC+", was given "+r.length),r!=null&&Ii(r.length<=LC,"key must be at most "+LC+", was given "+r.length),n!=null&&Ii(n.length===FC,"salt must be exactly "+FC+", was given "+n.length),i!=null&&Ii(i.length===MC,"personal must be exactly "+MC+", was given "+i.length)),new HC(e,r,n,i)};rr.exports.ready=function(t){Nc.ready(function(){t()})};rr.exports.WASM_SUPPORTED=Nc.SUPPORTED;rr.exports.WASM_LOADED=!1;var PC=rr.exports.BYTES_MIN=16,BC=rr.exports.BYTES_MAX=64,Qte=rr.exports.BYTES=32,RC=rr.exports.KEYBYTES_MIN=16,LC=rr.exports.KEYBYTES_MAX=64,kte=rr.exports.KEYBYTES=32,FC=rr.exports.SALTBYTES=16,MC=rr.exports.PERSONALBYTES=16;Nc.ready(function(t){t||(rr.exports.WASM_LOADED=!0,HC=Nc)})});var Pc=v(vr=>{"use strict";c();var qM=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VM=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jM=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qM(e,t,r);return VM(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.TransactionHash=vr.Transaction=void 0;var Va=Wt(),Dc=Zt(),HM=wh(),GM=Lo(),QM=jM(je()),kM=JI(),jn=ZI(),KM=tC(),QC=iC(),kC=Cc(),zM=fr(),WM=GC(),$M=32,Oc=class{constructor({nonce:e,value:r,receiver:n,sender:i,gasPrice:s,gasLimit:o,data:a,chainID:u,version:l,options:f,guardian:d}){this.nonce=e||0,this.value=r?new Va.BigNumber(r.toString()).toFixed(0):0,this.sender=i,this.receiver=n,this.gasPrice=s||GM.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new kC.TransactionPayload,this.chainID=u,this.version=l?new jn.TransactionVersion(l.valueOf()):jn.TransactionVersion.withDefaultVersion(),this.options=f?new jn.TransactionOptions(f.valueOf()):jn.TransactionOptions.withDefaultOptions(),this.guardian=d||Dc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Si.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new jn.TransactionVersion(e.valueOf())}getOptions(){return new jn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new jn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return zM.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return HM.Compatibility.guardAddressIsSetAndNonZero(new Dc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new Oc({nonce:Number(e.nonce),value:new Va.BigNumber(e.value).toFixed(0),receiver:Dc.Address.fromString(e.receiver),sender:Dc.Address.fromString(e.sender),guardian:e.guardian==null?void 0:Dc.Address.fromString(e.guardian||""),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new kC.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new jn.TransactionVersion(e.version),options:e.options==null?void 0:new jn.TransactionOptions(e.options)});return e.signature&&r.applySignature(new QC.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new QC.Signature(e.guardianSignature)),r}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}applyGuardianSignature(e){e instanceof h.Buffer?this.guardianSignature=e:this.guardianSignature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new QM.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new Va.BigNumber(this.gasPrice.valueOf()),i=new Va.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new Va.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new Va.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};vr.Transaction=Oc;var Si=class extends kM.Hash{constructor(e){super(e)}static compute(e){let n=new KM.ProtoSerializer().serializeTransaction(e),i=WM($M).update(n).digest("hex");return new Si(i)}};vr.TransactionHash=Si});var KC=v(Dh=>{"use strict";c();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.TransferTransactionsFactory=void 0;var Xm=gh(),Lr=bt(),Nh=Pc(),Zm=Cc(),ew=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new Nh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new Xm.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Zm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Nh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new Xm.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.U64Value(e.tokenTransfer.nonce),new Lr.BigUIntValue(e.tokenTransfer.valueOf()),new Lr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Zm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Nh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new Lr.AddressValue(e.destination),new Lr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Lr.BytesValue.fromUTF8(u.tokenIdentifier),new Lr.U64Value(u.nonce),new Lr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Xm.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Zm.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Nh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Dh.TransferTransactionsFactory=ew});var WC=v(ks=>{"use strict";c();Object.defineProperty(ks,"__esModule",{value:!0});ks.GasEstimator=ks.DefaultGasConfiguration=void 0;ks.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var YM=1e5,zC=8e5,tw=class{constructor(e){this.gasConfiguration=e||ks.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+YM}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+zC}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+zC)*r+this.gasConfiguration.gasPerDataByte*e}};ks.GasEstimator=tw});var Ph=v(Oh=>{"use strict";c();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.Account=void 0;var JM=Zt(),rw=class{constructor(e){this.address=new JM.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};Oh.Account=rw});var nw=v(zs=>{"use strict";c();Object.defineProperty(zs,"__esModule",{value:!0});zs.Logger=zs.LogLevel=void 0;var Ks;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(Ks=zs.LogLevel||(zs.LogLevel={}));var Fr=class{static setLevel(e){Fr.logLevel=e}static trace(e,...r){Fr.logLevel>=Ks.Debug||console.debug(e,r)}static debug(e,...r){Fr.logLevel>=Ks.Debug||console.debug(e,r)}static info(e,...r){Fr.logLevel>=Ks.Info||console.log(e,r)}static warn(e,...r){Fr.logLevel>=Ks.Warn||console.warn(e,r)}static error(e,...r){Fr.logLevel>=Ks.Error||console.error(e,r)}};zs.Logger=Fr;Fr.logLevel=Ks.Debug});var $C=v(fn=>{"use strict";c();var XM=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZM=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eU=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XM(e,t,r);return ZM(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.AsyncTimer=void 0;var tU=eU(je()),rU=je(),iw=nw(),sw=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new tU.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,iw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){iw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new rU.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(iw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};fn.AsyncTimer=sw});var uw=v(Ha=>{"use strict";c();var Ar=Ha&&Ha.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ha,"__esModule",{value:!0});Ha.TransactionWatcher=void 0;var ow=$C(),ja=je(),YC=nw(),_r=class{constructor(e,r={}){this.fetcher=new aw(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||_r.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||_r.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||_r.DefaultPatience}awaitPending(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new ja.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new ja.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new ja.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new ja.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Ar(this,void 0,void 0,function*(){let n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new ja.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Ar(this,void 0,void 0,function*(){let i=new ow.AsyncTimer("watcher:periodic"),s=new ow.AsyncTimer("watcher:patience"),o=new ow.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(YC.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof ja.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};Ha.TransactionWatcher=_r;_r.DefaultPollingInterval=6e3;_r.DefaultTimeout=_r.DefaultPollingInterval*15;_r.DefaultPatience=0;_r.NoopOnStatusReceived=t=>{};var aw=class{constructor(e){this.fetcher=e}getTransaction(e){return Ar(this,void 0,void 0,function*(){return YC.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var JC=v(Lh=>{"use strict";c();Object.defineProperty(Lh,"__esModule",{value:!0});Lh.CodeMetadata=void 0;var cw=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=Bh.Upgradeable),this.readable&&(e|=Bh.Readable),this.payable&&(r|=Rh.Payable),this.payableBySc&&(r|=Rh.PayableBySc),h.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};Lh.CodeMetadata=cw;var Bh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(Bh||(Bh={}));var Rh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Rh||(Rh={}))});var Fh=v(hn=>{"use strict";c();var nU=hn&&hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iU=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sU=hn&&hn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nU(e,t,r);return iU(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.ContractFunction=void 0;var oU=sU(je()),Bc=class{constructor(e){if(this.name=e,e==null)throw new oU.ErrInvalidFunctionName}static none(){return new Bc("untitled")}toString(){return this.name}valueOf(){return this.name}};hn.ContractFunction=Bc});var XC=v(br=>{"use strict";c();var aU=br&&br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uU=br&&br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cU=br&&br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aU(e,t,r);return uU(e,t),e},lU=br&&br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(br,"__esModule",{value:!0});br.InteractionChecker=void 0;var lw=cU(je()),fU=lU(Wt()),fw=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new fU.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new lw.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new lw.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.Query=void 0;var hU=Zt(),dU=gh(),hw=class{constructor(e){this.caller=e.caller||new hU.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new dU.ArgSerializer().valuesToStrings(this.args)}};Mh.Query=hw});var eT=v(qh=>{"use strict";c();Object.defineProperty(qh,"__esModule",{value:!0});qh.Interaction=void 0;var ZC=Zt(),pU=wh(),dw=Lo(),pw=Fh(),gU=XC(),yU=Uh(),Ga=bt(),gw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new ZC.Address,this.sender=new ZC.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new Qa([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){pU.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new pw.ContractFunction(dw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new pw.ContractFunction(dw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new pw.ContractFunction(dw.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new yU.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new Qa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new Qa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new Qa(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new gU.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};qh.Interaction=gw;var Qa=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new Ga.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Ga.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Ga.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Ga.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Ga.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Ga.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var tT=v(Vh=>{"use strict";c();Object.defineProperty(Vh,"__esModule",{value:!0});Vh.ArgumentErrorContext=void 0;var mU=je(),yw=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new mU.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) -Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};Vh.ArgumentErrorContext=yw});var nT=v(Ws=>{"use strict";c();var wU=Ws&&Ws.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.NativeSerializer=void 0;var EU=wU(Wt()),be=bt(),vU=tT(),jh=bt(),AU=Zt(),rT=je(),_U=nm(),bU;(function(t){function e(x,b){x=x||[],r(x),x=n(x,b);let T=b.input,P=[];for(let B=0;B0&&b[0].type.getCardinality().isComposite()&&(P=1/0,B=!0);for(let _ of b){if(_.type.getCardinality().isSingular())break;T-=1}return{min:T,max:P,variadic:B}}function s(x,b,T){if(b instanceof be.OptionType)return o(x,b,T);if(b instanceof be.OptionalType)return a(x,b,T);if(b instanceof be.VariadicType)return u(x,b,T);if(b instanceof be.CompositeType)return f(x,b,T);if(b instanceof be.TupleType)return d(x,b,T);if(b instanceof jh.StructType)return y(x,b,T);if(b instanceof be.ListType)return l(x,b,T);if(b instanceof be.PrimitiveType)return w(x,b,T);T.throwError(`convertToTypedValue: unhandled type ${b}`)}function o(x,b,T){if(x==null)return be.OptionValue.newMissing();let P=s(x,b.getFirstTypeParameter(),T);return be.OptionValue.newProvided(P)}function a(x,b,T){if(x==null)return new be.OptionalValue(b);let P=s(x,b.getFirstTypeParameter(),T);return new be.OptionalValue(b,P)}function u(x,b,T){x==null&&(x=[]),x.map===void 0&&T.convertError(x,"Variadic");let P=x.map(function(B){return s(B,b.getFirstTypeParameter(),T)});return new be.VariadicValue(b,P)}function l(x,b,T){x.map===void 0&&T.convertError(x,"List");let P=x.map(function(B){return s(B,b.getFirstTypeParameter(),T)});return new be.List(b,P)}function f(x,b,T){let P=[],B=b.getTypeParameters();T.guardSameLength(x,B);for(let _=0;_{"use strict";c();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.ContractCallPayloadBuilder=Mr.ContractUpgradePayloadBuilder=Mr.ContractDeployPayloadBuilder=Mr.ArwenVirtualMachine=void 0;var vw=Cc(),Aw=fr(),IU=gh();Mr.ArwenVirtualMachine="0500";var mw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Aw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Mr.ArwenVirtualMachine}@${r}`;return n=_w(n,this.arguments),new vw.TransactionPayload(n)}};Mr.ContractDeployPayloadBuilder=mw;var ww=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Aw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=_w(n,this.arguments),new vw.TransactionPayload(n)}};Mr.ContractUpgradePayloadBuilder=ww;var Ew=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){Aw.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=_w(e,this.arguments),new vw.TransactionPayload(e)}};Mr.ContractCallPayloadBuilder=Ew;function _w(t,e){let{argumentsString:r,count:n}=new IU.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Hn=v((Ire,bw)=>{"use strict";c();var ka=typeof Reflect=="object"?Reflect:null,sT=ka&&typeof ka.apply=="function"?ka.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Hh;ka&&typeof ka.ownKeys=="function"?Hh=ka.ownKeys:Object.getOwnPropertySymbols?Hh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Hh=function(e){return Object.getOwnPropertyNames(e)};function SU(t){console&&console.warn&&console.warn(t)}var aT=Number.isNaN||function(e){return e!==e};function He(){He.init.call(this)}bw.exports=He;bw.exports.once=NU;He.EventEmitter=He;He.prototype._events=void 0;He.prototype._eventsCount=0;He.prototype._maxListeners=void 0;var oT=10;function Gh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(He,"defaultMaxListeners",{enumerable:!0,get:function(){return oT},set:function(t){if(typeof t!="number"||t<0||aT(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");oT=t}});He.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};He.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||aT(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function uT(t){return t._maxListeners===void 0?He.defaultMaxListeners:t._maxListeners}He.prototype.getMaxListeners=function(){return uT(this)};He.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")sT(u,this,r);else for(var l=u.length,f=dT(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,SU(a)}return t}He.prototype.addListener=function(e,r){return cT(this,e,r,!1)};He.prototype.on=He.prototype.addListener;He.prototype.prependListener=function(e,r){return cT(this,e,r,!0)};function CU(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function lT(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=CU.bind(n);return i.listener=r,n.wrapFn=i,i}He.prototype.once=function(e,r){return Gh(r),this.on(e,lT(this,e,r)),this};He.prototype.prependOnceListener=function(e,r){return Gh(r),this.prependListener(e,lT(this,e,r)),this};He.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Gh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():TU(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};He.prototype.off=He.prototype.removeListener;He.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function fT(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?xU(i):dT(i,i.length)}He.prototype.listeners=function(e){return fT(this,e,!0)};He.prototype.rawListeners=function(e){return fT(this,e,!1)};He.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):hT.call(t,e)};He.prototype.listenerCount=hT;function hT(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}He.prototype.eventNames=function(){return this._eventsCount>0?Hh(this._events):[]};function dT(t,e){for(var r=new Array(e),n=0;n{c();gT.exports=Hn().EventEmitter});var Sw=v(()=>{c()});var AT=v((Ore,vT)=>{"use strict";c();function yT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function mT(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return Qh.alloc(0);for(var n=Qh.allocUnsafe(r>>>0),i=this.head,s=0;i;)UU(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=Qh.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:MU,value:function(r,n){return Cw(this,mT(mT({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var xw=v((Bre,bT)=>{"use strict";c();function qU(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(Tw,this,t)):p.default.nextTick(Tw,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(kh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(_T,r,s)):p.default.nextTick(_T,r,s):e?(p.default.nextTick(kh,r),e(s)):p.default.nextTick(kh,r)}),this)}function _T(t,e){Tw(t,e),kh(t)}function kh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function VU(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Tw(t,e){t.emit("error",e)}function jU(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}bT.exports={destroy:qU,undestroy:VU,errorOrDestroy:jU}});var $s=v((Lre,CT)=>{"use strict";c();function HU(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var ST={};function Ir(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){HU(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,ST[t]=i}function IT(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function GU(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function QU(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function kU(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Ir("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ir("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&GU(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(QU(t," argument"))i="The ".concat(t," ").concat(n," ").concat(IT(e,"type"));else{var s=kU(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(IT(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Ir("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ir("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ir("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ir("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ir("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ir("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ir("ERR_STREAM_WRITE_AFTER_END","write after end");Ir("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ir("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ir("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");CT.exports.codes=ST});var Nw=v((Mre,TT)=>{"use strict";c();var KU=$s().codes.ERR_INVALID_OPT_VALUE;function zU(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function WU(t,e,r,n){var i=zU(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new KU(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}TT.exports={getHighWaterMark:WU}});var Ka=v((qre,Dw)=>{c();typeof Object.create=="function"?Dw.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Dw.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var NT=v((jre,xT)=>{c();xT.exports=$U;function $U(t,e){if(Ow("noDeprecation"))return t;var r=!1;function n(){if(!r){if(Ow("throwDeprecation"))throw new Error(e);Ow("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function Ow(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var Rw=v((Gre,LT)=>{"use strict";c();LT.exports=at;function OT(t){var e=this;this.next=null,this.entry=null,this.finish=function(){_q(e,t)}}var za;at.WritableState=Lc;var YU={deprecate:NT()},PT=Iw(),zh=Ua().Buffer,JU=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function XU(t){return zh.from(t)}function ZU(t){return zh.isBuffer(t)||t instanceof JU}var Bw=xw(),eq=Nw(),tq=eq.getHighWaterMark,Ci=$s().codes,rq=Ci.ERR_INVALID_ARG_TYPE,nq=Ci.ERR_METHOD_NOT_IMPLEMENTED,iq=Ci.ERR_MULTIPLE_CALLBACK,sq=Ci.ERR_STREAM_CANNOT_PIPE,oq=Ci.ERR_STREAM_DESTROYED,aq=Ci.ERR_STREAM_NULL_VALUES,uq=Ci.ERR_STREAM_WRITE_AFTER_END,cq=Ci.ERR_UNKNOWN_ENCODING,Wa=Bw.errorOrDestroy;Ka()(at,PT);function lq(){}function Lc(t,e,r){za=za||Ys(),t=t||{},typeof r!="boolean"&&(r=e instanceof za),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=tq(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){mq(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new OT(this)}Lc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Lc.prototype,"buffer",{get:YU.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Kh;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Kh=Function.prototype[Symbol.hasInstance],Object.defineProperty(at,Symbol.hasInstance,{value:function(e){return Kh.call(this,e)?!0:this!==at?!1:e&&e._writableState instanceof Lc}})):Kh=function(e){return e instanceof this};function at(t){za=za||Ys();var e=this instanceof za;if(!e&&!Kh.call(at,this))return new at(t);this._writableState=new Lc(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),PT.call(this)}at.prototype.pipe=function(){Wa(this,new sq)};function fq(t,e){var r=new uq;Wa(t,r),p.default.nextTick(e,r)}function hq(t,e,r,n){var i;return r===null?i=new aq:typeof r!="string"&&!e.objectMode&&(i=new rq("chunk",["string","Buffer"],r)),i?(Wa(t,i),p.default.nextTick(n,i),!1):!0}at.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&ZU(t);return s&&!zh.isBuffer(t)&&(t=XU(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=lq),n.ending?fq(this,r):(s||hq(this,n,t,r))&&(n.pendingcb++,i=pq(this,n,s,t,e,r)),i};at.prototype.cork=function(){this._writableState.corked++};at.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&BT(this,t))};at.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new cq(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(at.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function dq(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=zh.from(e,r)),e}Object.defineProperty(at.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function pq(t,e,r,n,i,s){if(!r){var o=dq(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var bq=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};MT.exports=dn;var FT=Mw(),Fw=Rw();Ka()(dn,FT);for(Lw=bq(Fw.prototype),Wh=0;Wh{c();var Yh=Ua(),pn=Yh.Buffer;function UT(t,e){for(var r in t)e[r]=t[r]}pn.from&&pn.alloc&&pn.allocUnsafe&&pn.allocUnsafeSlow?qT.exports=Yh:(UT(Yh,Uw),Uw.Buffer=Js);function Js(t,e,r){return pn(t,e,r)}Js.prototype=Object.create(pn.prototype);UT(pn,Js);Js.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return pn(t,e,r)};Js.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=pn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Js.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return pn(t)};Js.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Yh.SlowBuffer(t)}});var jw=v(HT=>{"use strict";c();var Vw=VT().Buffer,jT=Vw.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Cq(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Tq(t){var e=Cq(t);if(typeof e!="string"&&(Vw.isEncoding===jT||!jT(t)))throw new Error("Unknown encoding: "+t);return e||t}HT.StringDecoder=Fc;function Fc(t){this.encoding=Tq(t);var e;switch(this.encoding){case"utf16le":this.text=Bq,this.end=Rq,e=4;break;case"utf8":this.fillLast=Dq,e=4;break;case"base64":this.text=Lq,this.end=Fq,e=3;break;default:this.write=Mq,this.end=Uq;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Vw.allocUnsafe(e)}Fc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function xq(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Nq(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Dq(t){var e=this.lastTotal-this.lastNeed,r=Nq(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Oq(t,e){var r=xq(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Pq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Bq(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Rq(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Lq(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Fq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Mq(t){return t.toString(this.encoding)}function Uq(t){return t&&t.length?this.write(t):""}});var Jh=v((Yre,kT)=>{"use strict";c();var GT=$s().codes.ERR_STREAM_PREMATURE_CLOSE;function qq(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var Xh;function Ti(t,e,r){return e=Hq(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Hq(t){var e=Gq(t,"string");return typeof e=="symbol"?e:String(e)}function Gq(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qq=Jh(),xi=Symbol("lastResolve"),Xs=Symbol("lastReject"),Mc=Symbol("error"),Zh=Symbol("ended"),Zs=Symbol("lastPromise"),Hw=Symbol("handlePromise"),eo=Symbol("stream");function Ni(t,e){return{value:t,done:e}}function kq(t){var e=t[xi];if(e!==null){var r=t[eo].read();r!==null&&(t[Zs]=null,t[xi]=null,t[Xs]=null,e(Ni(r,!1)))}}function Kq(t){p.default.nextTick(kq,t)}function zq(t,e){return function(r,n){t.then(function(){if(e[Zh]){r(Ni(void 0,!0));return}e[Hw](r,n)},n)}}var Wq=Object.getPrototypeOf(function(){}),$q=Object.setPrototypeOf((Xh={get stream(){return this[eo]},next:function(){var e=this,r=this[Mc];if(r!==null)return Promise.reject(r);if(this[Zh])return Promise.resolve(Ni(void 0,!0));if(this[eo].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Mc]?a(e[Mc]):o(Ni(void 0,!0))})});var n=this[Zs],i;if(n)i=new Promise(zq(n,this));else{var s=this[eo].read();if(s!==null)return Promise.resolve(Ni(s,!1));i=new Promise(this[Hw])}return this[Zs]=i,i}},Ti(Xh,Symbol.asyncIterator,function(){return this}),Ti(Xh,"return",function(){var e=this;return new Promise(function(r,n){e[eo].destroy(null,function(i){if(i){n(i);return}r(Ni(void 0,!0))})})}),Xh),Wq),Yq=function(e){var r,n=Object.create($q,(r={},Ti(r,eo,{value:e,writable:!0}),Ti(r,xi,{value:null,writable:!0}),Ti(r,Xs,{value:null,writable:!0}),Ti(r,Mc,{value:null,writable:!0}),Ti(r,Zh,{value:e._readableState.endEmitted,writable:!0}),Ti(r,Hw,{value:function(s,o){var a=n[eo].read();a?(n[Zs]=null,n[xi]=null,n[Xs]=null,s(Ni(a,!1))):(n[xi]=s,n[Xs]=o)},writable:!0}),r));return n[Zs]=null,Qq(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Xs];s!==null&&(n[Zs]=null,n[xi]=null,n[Xs]=null,s(i)),n[Mc]=i;return}var o=n[xi];o!==null&&(n[Zs]=null,n[xi]=null,n[Xs]=null,o(Ni(void 0,!0))),n[Zh]=!0}),e.on("readable",Kq.bind(null,n)),n};KT.exports=Yq});var $T=v((ene,WT)=>{c();WT.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Mw=v((nne,sx)=>{"use strict";c();sx.exports=Fe;var $a;Fe.ReadableState=ZT;var rne=Hn().EventEmitter,XT=function(e,r){return e.listeners(r).length},qc=Iw(),ed=Ua().Buffer,Jq=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Xq(t){return ed.from(t)}function Zq(t){return ed.isBuffer(t)||t instanceof Jq}var Gw=Sw(),xe;Gw&&Gw.debuglog?xe=Gw.debuglog("stream"):xe=function(){};var eV=AT(),Yw=xw(),tV=Nw(),rV=tV.getHighWaterMark,td=$s().codes,nV=td.ERR_INVALID_ARG_TYPE,iV=td.ERR_STREAM_PUSH_AFTER_EOF,sV=td.ERR_METHOD_NOT_IMPLEMENTED,oV=td.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ya,Qw,kw;Ka()(Fe,qc);var Uc=Yw.errorOrDestroy,Kw=["error","close","destroy","pause","resume"];function aV(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function ZT(t,e,r){$a=$a||Ys(),t=t||{},typeof r!="boolean"&&(r=e instanceof $a),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=rV(this,t,"readableHighWaterMark",r),this.buffer=new eV,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Ya||(Ya=jw().StringDecoder),this.decoder=new Ya(t.encoding),this.encoding=t.encoding)}function Fe(t){if($a=$a||Ys(),!(this instanceof Fe))return new Fe(t);var e=this instanceof $a;this._readableState=new ZT(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),qc.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=Yw.destroy;Fe.prototype._undestroy=Yw.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=ed.from(t,e),e=""),n=!0),ex(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return ex(this,t,null,!0,!1)};function ex(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,lV(t,s);else{var o;if(i||(o=uV(s,e)),o)Uc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==ed.prototype&&(e=Xq(e)),n)s.endEmitted?Uc(t,new oV):zw(t,s,e,!0);else if(s.ended)Uc(t,new iV);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?zw(t,s,e,!1):$w(t,s)):zw(t,s,e,!1)}else n||(s.reading=!1,$w(t,s))}return!s.ended&&(s.length=YT?t=YT:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function JT(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=cV(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Ww(this):rd(this),null;if(t=JT(t,e),t===0&&e.ended)return e.length===0&&Ww(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=nx(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Ww(this)),i!==null&&this.emit("data",i),i};function lV(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?rd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,tx(t)))}}function rd(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(tx,t))}function tx(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Jw(t)}function $w(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(fV,t,e))}function fV(t,e){for(;!e.reading&&!e.ended&&(e.length1&&ix(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function y(R){xe("onerror",R),N(),t.removeListener("error",y),XT(t,"error")===0&&Uc(t,R)}aV(t,"error",y);function w(){t.removeListener("finish",E),N()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),N()}t.once("finish",E);function N(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function hV(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&XT(t,"data")&&(r.flowing=!0,Jw(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?rd(this):n.reading||p.default.nextTick(dV,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=qc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(rx,this),r};Fe.prototype.removeAllListeners=function(t){var e=qc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(rx,this),e};function rx(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function dV(t){xe("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,pV(this,t)),t.paused=!1,this};function pV(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(gV,t,e))}function gV(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Jw(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Jw(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Ww(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(yV,e,t))}function yV(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return kw===void 0&&(kw=$T()),kw(Fe,t,e)});function ix(t,e){for(var r=0,n=t.length;r{"use strict";c();ax.exports=Gn;var nd=$s().codes,mV=nd.ERR_METHOD_NOT_IMPLEMENTED,wV=nd.ERR_MULTIPLE_CALLBACK,EV=nd.ERR_TRANSFORM_ALREADY_TRANSFORMING,vV=nd.ERR_TRANSFORM_WITH_LENGTH_0,id=Ys();Ka()(Gn,id);function AV(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new wV);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();cx.exports=Vc;var ux=Xw();Ka()(Vc,ux);function Vc(t){if(!(this instanceof Vc))return new Vc(t);ux.call(this,t)}Vc.prototype._transform=function(t,e,r){r(null,t)}});var gx=v((cne,px)=>{"use strict";c();var Zw;function bV(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var dx=$s().codes,IV=dx.ERR_MISSING_ARGS,SV=dx.ERR_STREAM_DESTROYED;function fx(t){if(t)throw t}function CV(t){return t.setHeader&&typeof t.abort=="function"}function TV(t,e,r,n){n=bV(n);var i=!1;t.on("close",function(){i=!0}),Zw===void 0&&(Zw=Jh()),Zw(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,CV(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new SV("pipe"))}}}function hx(t){t()}function xV(t,e){return t.pipe(e)}function NV(t){return!t.length||typeof t[t.length-1]!="function"?fx:t.pop()}function DV(){for(var t=arguments.length,e=new Array(t),r=0;r0;return TV(o,u,l,function(f){i||(i=f),f&&s.forEach(hx),!u&&(s.forEach(hx),n(i))})});return e.reduce(xV)}px.exports=DV});var eE=v((Sr,yx)=>{c();Sr=yx.exports=Mw();Sr.Stream=Sr;Sr.Readable=Sr;Sr.Writable=Rw();Sr.Duplex=Ys();Sr.Transform=Xw();Sr.PassThrough=lx();Sr.finished=Jh();Sr.pipeline=gx()});var Ex=v((hne,wx)=>{c();var{Transform:OV}=eE();wx.exports=t=>class mx extends OV{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new mx(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _x=v((pne,Ax)=>{c();var{Transform:PV}=eE();Ax.exports=t=>class vx extends PV{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new vx(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var Ix=v((yne,bx)=>{c();var BV=Ex(),RV=_x();bx.exports=function(t){let e=BV(t),r=RV(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var Tx=v(Cx=>{c();var Sx=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Cx.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],y=f^(i<<1|s>>>31),w=d^(s<<1|i>>>31),E=t[0]^y,N=t[1]^w,R=t[10]^y,M=t[11]^w,x=t[20]^y,b=t[21]^w,T=t[30]^y,P=t[31]^w,B=t[40]^y,_=t[41]^w;y=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let S=t[2]^y,F=t[3]^w,Z=t[12]^y,K=t[13]^w,H=t[22]^y,G=t[23]^w,$=t[32]^y,pe=t[33]^w,ae=t[42]^y,re=t[43]^w;y=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^y,ie=t[5]^w,te=t[14]^y,ne=t[15]^w,q=t[24]^y,ce=t[25]^w,oe=t[34]^y,le=t[35]^w,se=t[44]^y,ue=t[45]^w;y=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let g=t[6]^y,m=t[7]^w,A=t[16]^y,O=t[17]^w,I=t[26]^y,D=t[27]^w,L=t[36]^y,C=t[37]^w,U=t[46]^y,j=t[47]^w;y=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let V=t[8]^y,X=t[9]^w,ye=t[18]^y,we=t[19]^w,Pe=t[28]^y,$e=t[29]^w,st=t[38]^y,De=t[39]^w,Me=t[48]^y,vt=t[49]^w,ni=E,os=N,as=M<<4|R>>>28,Yt=R<<4|M>>>28,Dn=x<<3|b>>>29,qt=b<<3|x>>>29,At=P<<9|T>>>23,Qe=T<<9|P>>>23,Xg=B<<18|_>>>14,Zg=_<<18|B>>>14,e0=S<<1|F>>>31,t0=F<<1|S>>>31,r0=K<<12|Z>>>20,n0=Z<<12|K>>>20,i0=H<<10|G>>>22,s0=G<<10|H>>>22,o0=pe<<13|$>>>19,a0=$<<13|pe>>>19,u0=ae<<2|re>>>30,c0=re<<2|ae>>>30,l0=ie<<30|Y>>>2,f0=Y<<30|ie>>>2,h0=te<<6|ne>>>26,d0=ne<<6|te>>>26,p0=ce<<11|q>>>21,g0=q<<11|ce>>>21,y0=oe<<15|le>>>17,m0=le<<15|oe>>>17,w0=ue<<29|se>>>3,E0=se<<29|ue>>>3,v0=g<<28|m>>>4,A0=m<<28|g>>>4,_0=O<<23|A>>>9,b0=A<<23|O>>>9,I0=I<<25|D>>>7,S0=D<<25|I>>>7,C0=L<<21|C>>>11,T0=C<<21|L>>>11,x0=j<<24|U>>>8,N0=U<<24|j>>>8,D0=V<<27|X>>>5,O0=X<<27|V>>>5,P0=ye<<20|we>>>12,B0=we<<20|ye>>>12,R0=$e<<7|Pe>>>25,L0=Pe<<7|$e>>>25,F0=st<<8|De>>>24,M0=De<<8|st>>>24,U0=Me<<14|vt>>>18,q0=vt<<14|Me>>>18;t[0]=ni^~r0&p0,t[1]=os^~n0&g0,t[10]=v0^~P0&Dn,t[11]=A0^~B0&qt,t[20]=e0^~h0&I0,t[21]=t0^~d0&S0,t[30]=D0^~as&i0,t[31]=O0^~Yt&s0,t[40]=l0^~_0&R0,t[41]=f0^~b0&L0,t[2]=r0^~p0&C0,t[3]=n0^~g0&T0,t[12]=P0^~Dn&o0,t[13]=B0^~qt&a0,t[22]=h0^~I0&F0,t[23]=d0^~S0&M0,t[32]=as^~i0&y0,t[33]=Yt^~s0&m0,t[42]=_0^~R0&At,t[43]=b0^~L0&Qe,t[4]=p0^~C0&U0,t[5]=g0^~T0&q0,t[14]=Dn^~o0&w0,t[15]=qt^~a0&E0,t[24]=I0^~F0&Xg,t[25]=S0^~M0&Zg,t[34]=i0^~y0&x0,t[35]=s0^~m0&N0,t[44]=R0^~At&u0,t[45]=L0^~Qe&c0,t[6]=C0^~U0&ni,t[7]=T0^~q0&os,t[16]=o0^~w0&v0,t[17]=a0^~E0&A0,t[26]=F0^~Xg&e0,t[27]=M0^~Zg&t0,t[36]=y0^~x0&D0,t[37]=m0^~N0&O0,t[46]=At^~u0&l0,t[47]=Qe^~c0&f0,t[8]=U0^~ni&r0,t[9]=q0^~os&n0,t[18]=w0^~v0&P0,t[19]=E0^~A0&B0,t[28]=Xg^~e0&h0,t[29]=Zg^~t0&d0,t[38]=x0^~D0&as,t[39]=N0^~O0&Yt,t[48]=u0^~l0&_0,t[49]=c0^~f0&b0,t[0]^=Sx[e*2],t[1]^=Sx[e*2+1]}}});var Nx=v((vne,xx)=>{c();var sd=Tx();function Ja(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Ja.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};Ja.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(sd.p1600(this.state),this.count=0);return e};Ja.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};xx.exports=Ja});var Ox=v((_ne,Dx)=>{c();Dx.exports=Ix()(Nx())});var Lx=v(Xa=>{"use strict";c();var LV=Xa&&Xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xa,"__esModule",{value:!0});Xa.SmartContract=void 0;var FV=LV(Wt()),jc=Zt(),tE=wh(),MV=je(),rE=Pc(),UV=fr(),qV=zf(),Px=JC(),Bx=Fh(),Rx=eT(),VV=nT(),jV=Uh(),od=iT(),HV=Ox(),nE=class{constructor(e={}){this.address=new jc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new jc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new Bx.ContractFunction(i);return new Rx.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new Bx.ContractFunction(i),a=VV.NativeSerializer.nativeToTypedValues(s||[],n);return new Rx.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return UV.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){tE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new Px.CodeMetadata,i=i||[],s=s||0;let l=new od.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new rE.Transaction({receiver:jc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){tE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new Px.CodeMetadata,i=i||[],s=s||0;let l=new od.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new rE.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){tE.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new od.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new rE.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new jV.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new MV.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new jc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new FV.default(r.valueOf().toString(10)),u=qV.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=HV("keccak256").update(l).digest(),d=h.Buffer.from(od.ArwenVirtualMachine,"hex"),y=h.Buffer.concat([n,d,f.slice(10,30),s]);return new jc.Address(y)}};Xa.SmartContract=nE});var Fx=v(Za=>{"use strict";c();Object.defineProperty(Za,"__esModule",{value:!0});Za.Signature=Za.Address=void 0;var iE=class{constructor(e){this.value=e}bech32(){return this.value}};Za.Address=iE;var sE=class{constructor(e){this.value=e}hex(){return this.value}};Za.Signature=sE});var Mx=v(Hc=>{"use strict";c();Object.defineProperty(Hc,"__esModule",{value:!0});Hc.Operation=void 0;var GV;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(GV=Hc.Operation||(Hc.Operation={}))});var Ux=v(Di=>{"use strict";c();Object.defineProperty(Di,"__esModule",{value:!0});Di.ErrAccountNotConnected=Di.ErrCannotSignSingleTransaction=Di.Err=void 0;var Gc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Di.Err=Gc;var oE=class extends Gc{constructor(){super("Cannot sign single transaction.")}};Di.ErrCannotSignSingleTransaction=oE;var aE=class extends Gc{constructor(){super("Account is not connected.")}};Di.ErrAccountNotConnected=aE});var uE=v(eu=>{"use strict";c();var Oi=eu&&eu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(eu,"__esModule",{value:!0});eu.ExtensionProvider=void 0;var ad=Fx(),Qc=Mx(),qx=Ux(),gn=class{constructor(){if(this.account={address:""},this.initialized=!1,gn._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");gn._instance=this}static getInstance(){return gn._instance}setAddress(e){return this.account.address=e,gn._instance}init(){return Oi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Qc.Operation.Connect,n),this.account.address})}logout(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Qc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Oi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new qx.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new qx.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Qc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{for(let n=0;n{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};eu.ExtensionProvider=gn;gn._instance=new gn});var kx=v((Gne,Qx)=>{"use strict";c();function QV(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Qx.exports=kV;function kV(t,e,r){var n=r&&r.stringify||QV,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var Kx=kx();$x.exports=mn;var kc=tj().console||{},KV={mapHttpRequest:hd,mapHttpResponse:hd,wrapRequestSerializer:cE,wrapResponseSerializer:cE,wrapErrorSerializer:cE,req:hd,res:hd,err:JV};function zV(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function mn(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||kc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=zV(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=Kc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:y});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:XV(t)};u.levels=mn.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Kc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=lE());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function y(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,tu(l,u,"error","log"),tu(l,u,"fatal","error"),tu(l,u,"warn","error"),tu(l,u,"info","log"),tu(l,u,"debug","log"),tu(l,u,"trace","log")}function w(E,N){if(!E)throw new Error("missing bindings for child Pino");N=N||{},i&&E.serializers&&(N.serializers=E.serializers);let R=N.serializers;if(i&&R){var M=Object.assign({},n,R),x=t.browser.serialize===!0?Object.keys(M):i;delete E.serializers,dd([E],x,M,this._stdErrSerialize)}function b(T){this._childLevel=(T._childLevel|0)+1,this.error=ru(T,E,"error"),this.fatal=ru(T,E,"fatal"),this.warn=ru(T,E,"warn"),this.info=ru(T,E,"info"),this.debug=ru(T,E,"debug"),this.trace=ru(T,E,"trace"),M&&(this.serializers=M,this._serialize=x),e&&(this._logEvent=lE([].concat(T._logEvent.bindings,E)))}return b.prototype=this,new b(this)}return u}mn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};mn.stdSerializers=KV;mn.stdTimeFunctions=Object.assign({},{nullTime:zx,epochTime:Wx,unixTime:ZV,isoTime:ej});function tu(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Kc:i[r]?i[r]:kc[r]||kc[n]||Kc,WV(t,e,r)}function WV(t,e,r){!t.transmit&&e[r]===Kc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===kc?kc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ru(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;ihE,__asyncDelegator:()=>pj,__asyncGenerator:()=>dj,__asyncValues:()=>gj,__await:()=>zc,__awaiter:()=>aj,__classPrivateFieldGet:()=>Ej,__classPrivateFieldSet:()=>vj,__createBinding:()=>cj,__decorate:()=>ij,__exportStar:()=>lj,__extends:()=>rj,__generator:()=>uj,__importDefault:()=>wj,__importStar:()=>mj,__makeTemplateObject:()=>yj,__metadata:()=>oj,__param:()=>sj,__read:()=>Yx,__rest:()=>nj,__spread:()=>fj,__spreadArrays:()=>hj,__values:()=>dE});function rj(t,e){fE(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function nj(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function sj(t,e){return function(r,n){e(r,n,t)}}function oj(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function aj(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function uj(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Yx(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function fj(){for(var t=[],e=0;e1||a(y,w)})})}function a(y,w){try{u(n[y](w))}catch(E){d(s[0][3],E)}}function u(y){y.value instanceof zc?Promise.resolve(y.value.v).then(l,f):d(s[0][2],y)}function l(y){a("next",y)}function f(y){a("throw",y)}function d(y,w){y(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function pj(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:zc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function gj(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof dE=="function"?dE(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function yj(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function mj(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function wj(t){return t&&t.__esModule?t:{default:t}}function Ej(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function vj(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var fE,hE,ar=ge(()=>{c();fE=function(t,e){return fE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},fE(t,e)};hE=function(){return hE=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(gd,"__esModule",{value:!0});function Aj(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}gd.safeJsonParse=Aj;function _j(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}gd.safeJsonStringify=_j});var Jx=v((Yne,yd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?yd.exports=global.localStorage:typeof window<"u"&&window.localStorage?yd.exports=window.localStorage:yd.exports=new e})()});var Xx=v(md=>{"use strict";c();Object.defineProperty(md,"__esModule",{value:!0});md.IKeyValueStorage=void 0;var gE=class{};md.IKeyValueStorage=gE});var Zx=v(wd=>{"use strict";c();Object.defineProperty(wd,"__esModule",{value:!0});wd.parseEntry=void 0;var bj=pE();function Ij(t){var e;return[t[0],bj.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}wd.parseEntry=Ij});var t2=v(Ed=>{"use strict";c();Object.defineProperty(Ed,"__esModule",{value:!0});var e2=(ar(),rt(or));e2.__exportStar(Xx(),Ed);e2.__exportStar(Zx(),Ed)});var n2=v(Wc=>{"use strict";c();Object.defineProperty(Wc,"__esModule",{value:!0});Wc.KeyValueStorage=void 0;var nu=(ar(),rt(or)),r2=pE(),Sj=nu.__importDefault(Jx()),Cj=t2(),vd=class{constructor(){this.localStorage=Sj.default}getKeys(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(Cj.parseEntry)})}getItem(e){return nu.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return r2.safeJsonParse(r)})}setItem(e,r){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,r2.safeJsonStringify(r))})}removeItem(e){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Wc.KeyValueStorage=vd;Wc.default=vd});var i2=v(Ad=>{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.delay=void 0;function Tj(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ad.delay=Tj});var s2=v(iu=>{"use strict";c();Object.defineProperty(iu,"__esModule",{value:!0});iu.ONE_THOUSAND=iu.ONE_HUNDRED=void 0;iu.ONE_HUNDRED=100;iu.ONE_THOUSAND=1e3});var o2=v(he=>{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ONE_YEAR=he.FOUR_WEEKS=he.THREE_WEEKS=he.TWO_WEEKS=he.ONE_WEEK=he.THIRTY_DAYS=he.SEVEN_DAYS=he.FIVE_DAYS=he.THREE_DAYS=he.ONE_DAY=he.TWENTY_FOUR_HOURS=he.TWELVE_HOURS=he.SIX_HOURS=he.THREE_HOURS=he.ONE_HOUR=he.SIXTY_MINUTES=he.THIRTY_MINUTES=he.TEN_MINUTES=he.FIVE_MINUTES=he.ONE_MINUTE=he.SIXTY_SECONDS=he.THIRTY_SECONDS=he.TEN_SECONDS=he.FIVE_SECONDS=he.ONE_SECOND=void 0;he.ONE_SECOND=1;he.FIVE_SECONDS=5;he.TEN_SECONDS=10;he.THIRTY_SECONDS=30;he.SIXTY_SECONDS=60;he.ONE_MINUTE=he.SIXTY_SECONDS;he.FIVE_MINUTES=he.ONE_MINUTE*5;he.TEN_MINUTES=he.ONE_MINUTE*10;he.THIRTY_MINUTES=he.ONE_MINUTE*30;he.SIXTY_MINUTES=he.ONE_MINUTE*60;he.ONE_HOUR=he.SIXTY_MINUTES;he.THREE_HOURS=he.ONE_HOUR*3;he.SIX_HOURS=he.ONE_HOUR*6;he.TWELVE_HOURS=he.ONE_HOUR*12;he.TWENTY_FOUR_HOURS=he.ONE_HOUR*24;he.ONE_DAY=he.TWENTY_FOUR_HOURS;he.THREE_DAYS=he.ONE_DAY*3;he.FIVE_DAYS=he.ONE_DAY*5;he.SEVEN_DAYS=he.ONE_DAY*7;he.THIRTY_DAYS=he.ONE_DAY*30;he.ONE_WEEK=he.SEVEN_DAYS;he.TWO_WEEKS=he.ONE_WEEK*2;he.THREE_WEEKS=he.ONE_WEEK*3;he.FOUR_WEEKS=he.ONE_WEEK*4;he.ONE_YEAR=he.ONE_DAY*365});var yE=v(_d=>{"use strict";c();Object.defineProperty(_d,"__esModule",{value:!0});var a2=(ar(),rt(or));a2.__exportStar(s2(),_d);a2.__exportStar(o2(),_d)});var c2=v(su=>{"use strict";c();Object.defineProperty(su,"__esModule",{value:!0});su.fromMiliseconds=su.toMiliseconds=void 0;var u2=yE();function xj(t){return t*u2.ONE_THOUSAND}su.toMiliseconds=xj;function Nj(t){return Math.floor(t/u2.ONE_THOUSAND)}su.fromMiliseconds=Nj});var f2=v(bd=>{"use strict";c();Object.defineProperty(bd,"__esModule",{value:!0});var l2=(ar(),rt(or));l2.__exportStar(i2(),bd);l2.__exportStar(c2(),bd)});var h2=v($c=>{"use strict";c();Object.defineProperty($c,"__esModule",{value:!0});$c.Watch=void 0;var Id=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};$c.Watch=Id;$c.default=Id});var d2=v(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.IWatch=void 0;var mE=class{};Sd.IWatch=mE});var p2=v(wE=>{"use strict";c();Object.defineProperty(wE,"__esModule",{value:!0});var Dj=(ar(),rt(or));Dj.__exportStar(d2(),wE)});var to=v(ou=>{"use strict";c();Object.defineProperty(ou,"__esModule",{value:!0});var Cd=(ar(),rt(or));Cd.__exportStar(f2(),ou);Cd.__exportStar(h2(),ou);Cd.__exportStar(p2(),ou);Cd.__exportStar(yE(),ou)});var EE,g2=ge(()=>{c();EE=class{}});var vE={};ot(vE,{IEvents:()=>EE});var AE=ge(()=>{c();g2()});var y2=v(Td=>{"use strict";c();Object.defineProperty(Td,"__esModule",{value:!0});Td.IHeartBeat=void 0;var Oj=(AE(),rt(vE)),_E=class extends Oj.IEvents{constructor(e){super()}};Td.IHeartBeat=_E});var IE=v(bE=>{"use strict";c();Object.defineProperty(bE,"__esModule",{value:!0});var Pj=(ar(),rt(or));Pj.__exportStar(y2(),bE)});var m2=v(au=>{"use strict";c();Object.defineProperty(au,"__esModule",{value:!0});au.HEARTBEAT_EVENTS=au.HEARTBEAT_INTERVAL=void 0;var Bj=to();au.HEARTBEAT_INTERVAL=Bj.FIVE_SECONDS;au.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var CE=v(SE=>{"use strict";c();Object.defineProperty(SE,"__esModule",{value:!0});var Rj=(ar(),rt(or));Rj.__exportStar(m2(),SE)});var w2=v(xd=>{"use strict";c();Object.defineProperty(xd,"__esModule",{value:!0});xd.HeartBeat=void 0;var TE=(ar(),rt(or)),Lj=Hn(),Fj=to(),Mj=IE(),xE=CE(),Yc=class extends Mj.IHeartBeat{constructor(e){super(e),this.events=new Lj.EventEmitter,this.interval=xE.HEARTBEAT_INTERVAL,this.interval=e?.interval||xE.HEARTBEAT_INTERVAL}static init(e){return TE.__awaiter(this,void 0,void 0,function*(){let r=new Yc(e);return yield r.init(),r})}init(){return TE.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return TE.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),Fj.toMiliseconds(this.interval))})}pulse(){this.events.emit(xE.HEARTBEAT_EVENTS.pulse)}};xd.HeartBeat=Yc});var E2=v(Jc=>{"use strict";c();Object.defineProperty(Jc,"__esModule",{value:!0});var NE=(ar(),rt(or));NE.__exportStar(w2(),Jc);NE.__exportStar(IE(),Jc);NE.__exportStar(CE(),Jc)});var DE=v(uu=>{"use strict";c();Object.defineProperty(uu,"__esModule",{value:!0});uu.PINO_CUSTOM_CONTEXT_KEY=uu.PINO_LOGGER_DEFAULTS=void 0;uu.PINO_LOGGER_DEFAULTS={level:"info"};uu.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var I2=v(nr=>{"use strict";c();Object.defineProperty(nr,"__esModule",{value:!0});nr.generateChildLogger=nr.formatChildLoggerContext=nr.getLoggerContext=nr.setBrowserLoggerContext=nr.getBrowserLoggerContext=nr.getDefaultLoggerOptions=void 0;var cu=DE();function Uj(t){return Object.assign(Object.assign({},t),{level:t?.level||cu.PINO_LOGGER_DEFAULTS.level})}nr.getDefaultLoggerOptions=Uj;function v2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}nr.getBrowserLoggerContext=v2;function A2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}nr.setBrowserLoggerContext=A2;function _2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=v2(t,e):r=t.bindings().context||"",r}nr.getLoggerContext=_2;function b2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=_2(t,r);return n.trim()?`${n}/${e}`:e}nr.formatChildLoggerContext=b2;function qj(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=b2(t,e,r),i=t.child({context:n});return A2(i,n,r)}nr.generateChildLogger=qj});var PE=v(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.pino=void 0;var OE=(ar(),rt(or)),Vj=OE.__importDefault(pd());Object.defineProperty(lu,"pino",{enumerable:!0,get:function(){return Vj.default}});OE.__exportStar(DE(),lu);OE.__exportStar(I2(),lu)});var $E=v(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var fu=(AE(),rt(vE)),S2=Hn();function jj(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var Hj=jj(S2),BE=class extends fu.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},RE=class{constructor(e,r,n){this.core=e,this.logger=r}},LE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},FE=class{constructor(e,r){this.logger=e,this.core=r}},ME=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},UE=class extends fu.IEvents{constructor(e){super()}},qE=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VE=class{constructor(){this.map=new Map}},jE=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},HE=class{constructor(e,r){this.core=e,this.logger=r}},GE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},QE=class{constructor(e,r){this.logger=e,this.core=r}},kE=class extends Hj.default{constructor(){super()}},KE=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},zE=class extends S2.EventEmitter{constructor(){super()}},WE=class{constructor(e){this.client=e}};Dt.ICore=BE,Dt.ICrypto=RE,Dt.IEngine=WE,Dt.IEngineEvents=zE,Dt.IExpirer=GE,Dt.IJsonRpcHistory=LE,Dt.IKeyChain=HE,Dt.IMessageTracker=FE,Dt.IPairing=QE,Dt.IPublisher=ME,Dt.IRelayer=UE,Dt.ISignClient=KE,Dt.ISignClientEvents=kE,Dt.IStore=qE,Dt.ISubscriber=jE,Dt.ISubscriberTopicMap=VE});var C2={};ot(C2,{safeJsonParse:()=>Xc,safeJsonStringify:()=>Zc});function Xc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Qj(t)}catch{return t}}function Zc(t){return typeof t=="string"?t:Gj(t)||""}var Gj,Qj,Nd=ge(()=>{c();Gj=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Qj=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var x2=v(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.BrowserRandomSource=void 0;var T2=65536,YE=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(JE,"__esModule",{value:!0});function kj(t){for(var e=0;e{c()});var D2=v(Od=>{"use strict";c();Object.defineProperty(Od,"__esModule",{value:!0});Od.NodeRandomSource=void 0;var Kj=Cr(),XE=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof U_<"u"){let e=N2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.SystemRandomSource=void 0;var zj=x2(),Wj=D2(),ZE=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new zj.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Wj.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};Pd.SystemRandomSource=ZE});var P2=v(ur=>{"use strict";c();Object.defineProperty(ur,"__esModule",{value:!0});function $j(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}ur.mul=Math.imul||$j;function Yj(t,e){return t+e|0}ur.add=Yj;function Jj(t,e){return t-e|0}ur.sub=Jj;function Xj(t,e){return t<>>32-e}ur.rotl=Xj;function Zj(t,e){return t<<32-e|t>>>e}ur.rotr=Zj;function eH(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}ur.isInteger=Number.isInteger||eH;ur.MAX_SAFE_INTEGER=9007199254740991;ur.isSafeInteger=function(t){return ur.isInteger(t)&&t>=-ur.MAX_SAFE_INTEGER&&t<=ur.MAX_SAFE_INTEGER}});var hu=v(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var B2=P2();function tH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=tH;function rH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=rH;function nH(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=nH;function iH(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=iH;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=R2;Ne.writeInt16BE=R2;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=L2;Ne.writeInt16LE=L2;function e1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=e1;function t1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=t1;function r1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=r1;function n1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=n1;function Bd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Bd;Ne.writeInt32BE=Bd;function Rd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Rd;Ne.writeInt32LE=Rd;function sH(t,e){e===void 0&&(e=0);var r=e1(t,e),n=e1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=sH;function oH(t,e){e===void 0&&(e=0);var r=t1(t,e),n=t1(t,e+4);return r*4294967296+n}Ne.readUint64BE=oH;function aH(t,e){e===void 0&&(e=0);var r=r1(t,e),n=r1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=aH;function uH(t,e){e===void 0&&(e=0);var r=n1(t,e),n=n1(t,e+4);return n*4294967296+r}Ne.readUint64LE=uH;function F2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Bd(t/4294967296>>>0,e,r),Bd(t>>>0,e,r+4),e}Ne.writeUint64BE=F2;Ne.writeInt64BE=F2;function M2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Rd(t>>>0,e,r),Rd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=M2;Ne.writeInt64LE=M2;function cH(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=cH;function lH(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=fH;function hH(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!B2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.randomStringForEntropy=Qt.randomString=Qt.randomUint32=Qt.randomBytes=Qt.defaultRandomSource=void 0;var AH=O2(),_H=hu(),U2=Cr();Qt.defaultRandomSource=new AH.SystemRandomSource;function i1(t,e=Qt.defaultRandomSource){return e.randomBytes(t)}Qt.randomBytes=i1;function bH(t=Qt.defaultRandomSource){let e=i1(4,t),r=(0,_H.readUint32LE)(e);return(0,U2.wipe)(e),r}Qt.randomUint32=bH;var q2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function V2(t,e=q2,r=Qt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=i1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Qn,"__esModule",{value:!0});var pu=hu(),du=Cr();Qn.DIGEST_LENGTH=64;Qn.BLOCK_SIZE=128;var H2=function(){function t(){this.digestLength=Qn.DIGEST_LENGTH,this.blockSize=Qn.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){du.wipe(this._buffer),du.wipe(this._tempHi),du.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(s1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=s1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){du.wipe(e.stateHi),du.wipe(e.stateLo),e.buffer&&du.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Qn.SHA512=H2;var j2=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],y=r[5],w=r[6],E=r[7],N=n[0],R=n[1],M=n[2],x=n[3],b=n[4],T=n[5],P=n[6],B=n[7],_,S,F,Z,K,H,G,$;o>=128;){for(var pe=0;pe<16;pe++){var ae=8*pe+s;t[pe]=pu.readUint32BE(i,ae),e[pe]=pu.readUint32BE(i,ae+4)}for(var pe=0;pe<80;pe++){var re=a,Y=u,ie=l,te=f,ne=d,q=y,ce=w,oe=E,le=N,se=R,ue=M,g=x,m=b,A=T,O=P,I=B;if(_=E,S=B,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=(d>>>14|b<<32-14)^(d>>>18|b<<32-18)^(b>>>41-32|d<<32-(41-32)),S=(b>>>14|d<<32-14)^(b>>>18|d<<32-18)^(d>>>41-32|b<<32-(41-32)),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=d&y^~d&w,S=b&T^~b&P,K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=j2[pe*2],S=j2[pe*2+1],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=t[pe%16],S=e[pe%16],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,F=G&65535|$<<16,Z=K&65535|H<<16,_=F,S=Z,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=(a>>>28|N<<32-28)^(N>>>34-32|a<<32-(34-32))^(N>>>39-32|a<<32-(39-32)),S=(N>>>28|a<<32-28)^(a>>>34-32|N<<32-(34-32))^(a>>>39-32|N<<32-(39-32)),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=a&u^a&l^u&l,S=N&R^N&M^R&M,K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,oe=G&65535|$<<16,I=K&65535|H<<16,_=te,S=g,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=F,S=Z,K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,te=G&65535|$<<16,g=K&65535|H<<16,u=re,l=Y,f=ie,d=te,y=ne,w=q,E=ce,a=oe,R=le,M=se,x=ue,b=g,T=m,P=A,B=O,N=I,pe%16===15)for(var ae=0;ae<16;ae++)_=t[ae],S=e[ae],K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=t[(ae+9)%16],S=e[(ae+9)%16],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,F=t[(ae+1)%16],Z=e[(ae+1)%16],_=(F>>>1|Z<<32-1)^(F>>>8|Z<<32-8)^F>>>7,S=(Z>>>1|F<<32-1)^(Z>>>8|F<<32-8)^(Z>>>7|F<<32-7),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,F=t[(ae+14)%16],Z=e[(ae+14)%16],_=(F>>>19|Z<<32-19)^(Z>>>61-32|F<<32-(61-32))^F>>>6,S=(Z>>>19|F<<32-19)^(F>>>61-32|Z<<32-(61-32))^(Z>>>6|F<<32-6),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,t[ae]=G&65535|$<<16,e[ae]=K&65535|H<<16}_=a,S=N,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[0],S=n[0],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[0]=a=G&65535|$<<16,n[0]=N=K&65535|H<<16,_=u,S=R,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[1],S=n[1],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[1]=u=G&65535|$<<16,n[1]=R=K&65535|H<<16,_=l,S=M,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[2],S=n[2],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[2]=l=G&65535|$<<16,n[2]=M=K&65535|H<<16,_=f,S=x,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[3],S=n[3],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[3]=f=G&65535|$<<16,n[3]=x=K&65535|H<<16,_=d,S=b,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[4],S=n[4],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[4]=d=G&65535|$<<16,n[4]=b=K&65535|H<<16,_=y,S=T,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[5],S=n[5],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[5]=y=G&65535|$<<16,n[5]=T=K&65535|H<<16,_=w,S=P,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[6],S=n[6],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[6]=w=G&65535|$<<16,n[6]=P=K&65535|H<<16,_=E,S=B,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[7],S=n[7],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[7]=E=G&65535|$<<16,n[7]=B=K&65535|H<<16,s+=128,o-=128}return s}function SH(t){var e=new H2;e.update(t);var r=e.digest();return e.clean(),r}Qn.hash=SH});var nN=v(qe=>{"use strict";c();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var CH=el(),tl=G2(),W2=Cr();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function Ee(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,$2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function Y2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function K2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return rl(r,t),rl(n,e),Y2(r,n)}function J2(t){let e=new Uint8Array(32);return rl(e,t),e[0]&1}function OH(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function ro(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function io(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Ge(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,N=0,R=0,M=0,x=0,b=0,T=0,P=0,B=0,_=0,S=0,F=0,Z=0,K=0,H=0,G=0,$=0,pe=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],O=r[11],I=r[12],D=r[13],L=r[14],C=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,N+=n*A,R+=n*O,M+=n*I,x+=n*D,b+=n*L,T+=n*C,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,N+=n*m,R+=n*A,M+=n*O,x+=n*I,b+=n*D,T+=n*L,P+=n*C,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,N+=n*g,R+=n*m,M+=n*A,x+=n*O,b+=n*I,T+=n*D,P+=n*L,B+=n*C,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,N+=n*ue,R+=n*g,M+=n*m,x+=n*A,b+=n*O,T+=n*I,P+=n*D,B+=n*L,_+=n*C,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,N+=n*se,R+=n*ue,M+=n*g,x+=n*m,b+=n*A,T+=n*O,P+=n*I,B+=n*D,_+=n*L,S+=n*C,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,N+=n*le,R+=n*se,M+=n*ue,x+=n*g,b+=n*m,T+=n*A,P+=n*O,B+=n*I,_+=n*D,S+=n*L,F+=n*C,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,N+=n*oe,R+=n*le,M+=n*se,x+=n*ue,b+=n*g,T+=n*m,P+=n*A,B+=n*O,_+=n*I,S+=n*D,F+=n*L,Z+=n*C,n=e[7],y+=n*te,w+=n*ne,E+=n*q,N+=n*ce,R+=n*oe,M+=n*le,x+=n*se,b+=n*ue,T+=n*g,P+=n*m,B+=n*A,_+=n*O,S+=n*I,F+=n*D,Z+=n*L,K+=n*C,n=e[8],w+=n*te,E+=n*ne,N+=n*q,R+=n*ce,M+=n*oe,x+=n*le,b+=n*se,T+=n*ue,P+=n*g,B+=n*m,_+=n*A,S+=n*O,F+=n*I,Z+=n*D,K+=n*L,H+=n*C,n=e[9],E+=n*te,N+=n*ne,R+=n*q,M+=n*ce,x+=n*oe,b+=n*le,T+=n*se,P+=n*ue,B+=n*g,_+=n*m,S+=n*A,F+=n*O,Z+=n*I,K+=n*D,H+=n*L,G+=n*C,n=e[10],N+=n*te,R+=n*ne,M+=n*q,x+=n*ce,b+=n*oe,T+=n*le,P+=n*se,B+=n*ue,_+=n*g,S+=n*m,F+=n*A,Z+=n*O,K+=n*I,H+=n*D,G+=n*L,$+=n*C,n=e[11],R+=n*te,M+=n*ne,x+=n*q,b+=n*ce,T+=n*oe,P+=n*le,B+=n*se,_+=n*ue,S+=n*g,F+=n*m,Z+=n*A,K+=n*O,H+=n*I,G+=n*D,$+=n*L,pe+=n*C,n=e[12],M+=n*te,x+=n*ne,b+=n*q,T+=n*ce,P+=n*oe,B+=n*le,_+=n*se,S+=n*ue,F+=n*g,Z+=n*m,K+=n*A,H+=n*O,G+=n*I,$+=n*D,pe+=n*L,ae+=n*C,n=e[13],x+=n*te,b+=n*ne,T+=n*q,P+=n*ce,B+=n*oe,_+=n*le,S+=n*se,F+=n*ue,Z+=n*g,K+=n*m,H+=n*A,G+=n*O,$+=n*I,pe+=n*D,ae+=n*L,re+=n*C,n=e[14],b+=n*te,T+=n*ne,P+=n*q,B+=n*ce,_+=n*oe,S+=n*le,F+=n*se,Z+=n*ue,K+=n*g,H+=n*m,G+=n*A,$+=n*O,pe+=n*I,ae+=n*D,re+=n*L,Y+=n*C,n=e[15],T+=n*te,P+=n*ne,B+=n*q,_+=n*ce,S+=n*oe,F+=n*le,Z+=n*se,K+=n*ue,H+=n*g,G+=n*m,$+=n*A,pe+=n*O,ae+=n*I,re+=n*D,Y+=n*L,ie+=n*C,s+=38*P,o+=38*B,a+=38*_,u+=38*S,l+=38*F,f+=38*Z,d+=38*K,y+=38*H,w+=38*G,E+=38*$,N+=38*pe,R+=38*ae,M+=38*re,x+=38*Y,b+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=N,t[11]=R,t[12]=M,t[13]=x,t[14]=b,t[15]=T}function no(t,e){Ge(t,e,e)}function X2(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)no(r,r),n!==2&&n!==4&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function PH(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)no(r,r),n!==1&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function c1(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee(),l=Ee(),f=Ee();io(r,t[1],t[0]),io(f,e[1],e[0]),Ge(r,r,f),ro(n,t[0],t[1]),ro(f,e[0],e[1]),Ge(n,n,f),Ge(i,t[3],e[3]),Ge(i,i,NH),Ge(s,t[2],e[2]),ro(s,s,s),io(o,n,r),io(a,s,i),ro(u,s,i),ro(l,n,r),Ge(t[0],o,a),Ge(t[1],l,u),Ge(t[2],u,a),Ge(t[3],o,l)}function z2(t,e,r){for(let n=0;n<4;n++)$2(t[n],e[n],r)}function f1(t,e){let r=Ee(),n=Ee(),i=Ee();X2(i,e[2]),Ge(r,e[0],i),Ge(n,e[1],i),rl(t,n),t[31]^=J2(r)<<7}function Z2(t,e,r){Pi(t[0],u1),Pi(t[1],gu),Pi(t[2],gu),Pi(t[3],u1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;z2(t,e,i),c1(e,t),c1(t,t),z2(t,e,i)}}function h1(t,e){let r=[Ee(),Ee(),Ee(),Ee()];Pi(r[0],Q2),Pi(r[1],k2),Pi(r[2],gu),Ge(r[3],Q2,k2),Z2(t,r,e)}function eN(t){if(t.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,tl.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ee(),Ee(),Ee(),Ee()];h1(n,e),f1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}qe.generateKeyPairFromSeed=eN;function BH(t){let e=(0,CH.randomBytes)(32,t),r=eN(e);return(0,W2.wipe)(e),r}qe.generateKeyPair=BH;function RH(t){if(t.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}qe.extractPublicKeyFromSecretKey=RH;var a1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function tN(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*a1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*a1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function l1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;tN(t,e)}function LH(t,e){let r=new Float64Array(64),n=[Ee(),Ee(),Ee(),Ee()],i=(0,tl.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new tl.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),l1(a),h1(n,a),f1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();l1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return tN(s.subarray(32),r),s}qe.sign=LH;function rN(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee();return Pi(t[2],gu),OH(t[1],e),no(i,t[1]),Ge(s,i,xH),io(i,i,t[2]),ro(s,t[2],s),no(o,s),no(a,o),Ge(u,a,o),Ge(r,u,i),Ge(r,r,s),PH(r,r),Ge(r,r,i),Ge(r,r,s),Ge(r,r,s),Ge(t[0],r,s),no(n,t[0]),Ge(n,n,s),K2(n,i)&&Ge(t[0],t[0],DH),no(n,t[0]),Ge(n,n,s),K2(n,i)?-1:(J2(t[0])===e[31]>>7&&io(t[0],u1,t[0]),Ge(t[3],t[0],t[1]),0)}function FH(t,e,r){let n=new Uint8Array(32),i=[Ee(),Ee(),Ee(),Ee()],s=[Ee(),Ee(),Ee(),Ee()];if(r.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(rN(s,t))return!1;let o=new tl.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return l1(a),Z2(i,s,a),h1(s,r.subarray(32)),c1(i,s),f1(n,i),!Y2(r,n)}qe.verify=FH;function MH(t){let e=[Ee(),Ee(),Ee(),Ee()];if(rN(e,t))throw new Error("Ed25519: invalid public key");let r=Ee(),n=Ee(),i=e[1];ro(r,gu,i),io(n,gu,i),X2(n,n),Ge(r,r,n);let s=new Uint8Array(32);return rl(s,r),s}qe.convertPublicKeyToX25519=MH;function UH(t){let e=(0,tl.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,W2.wipe)(e),r}qe.convertSecretKeyToX25519=UH});var Ld,Fd,so,yu,Md,nl,Ud,qd,Vd,mu,jd,Hd,iN,sN,Gd=ge(()=>{c();Ld="EdDSA",Fd="JWT",so=".",yu="base64url",Md="utf8",nl="utf8",Ud=":",qd="did",Vd="key",mu="base58btc",jd="z",Hd="K36",iN=32,sN=32});function Bi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var il=ge(()=>{c()});function wu(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Bi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Qd=ge(()=>{c();il()});function kd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=wu(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Bi(r)}var d1=ge(()=>{c();Qd();il()});function qH(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,T=new Uint8Array(b);M!==x;){for(var P=E[M],B=0,_=b-1;(P!==0||B>>0,T[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=B,M++}for(var S=b-R;S!==b&&T[S]===0;)S++;for(var F=u.repeat(N);S>>0,b=new Uint8Array(x);E[N];){var T=r[E.charCodeAt(N)];if(T===255)return;for(var P=0,B=x-1;(T!==0||P>>0,b[B]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");M=P,N++}if(E[N]!==" "){for(var _=x-M;_!==x&&b[_]===0;)_++;for(var S=new Uint8Array(R+(x-_)),F=R;_!==x;)S[F++]=b[_++];return S}}}function w(E){var N=y(E);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var VH,jH,oN,aN=ge(()=>{c();VH=qH,jH=VH,oN=jH});var Pse,uN,kn,cN,lN,Ri=ge(()=>{c();Pse=new Uint8Array(0),uN=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},cN=t=>new TextEncoder().encode(t),lN=t=>new TextDecoder().decode(t)});var p1,g1,y1,hN,m1,Eu,Li,HH,GH,ut,Ur=ge(()=>{c();aN();Ri();p1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},g1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hN(this,e)}},y1=class{constructor(e){this.decoders=e}or(e){return hN(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},hN=(t,e)=>new y1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),m1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new p1(e,r,n),this.decoder=new g1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Eu=({name:t,prefix:e,encode:r,decode:n})=>new m1(t,e,r,n),Li=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=oN(r,e);return Eu({prefix:t,name:e,encode:n,decode:s=>kn(i(s))})},HH=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},GH=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Eu({prefix:e,name:t,encode(i){return GH(i,n,r)},decode(i){return HH(i,n,r,t)}})});var w1={};ot(w1,{identity:()=>QH});var QH,dN=ge(()=>{c();Ur();Ri();QH=Eu({prefix:"\0",name:"identity",encode:t=>lN(t),decode:t=>cN(t)})});var E1={};ot(E1,{base2:()=>kH});var kH,pN=ge(()=>{c();Ur();kH=ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var v1={};ot(v1,{base8:()=>KH});var KH,gN=ge(()=>{c();Ur();KH=ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var A1={};ot(A1,{base10:()=>zH});var zH,yN=ge(()=>{c();Ur();zH=Li({prefix:"9",name:"base10",alphabet:"0123456789"})});var _1={};ot(_1,{base16:()=>WH,base16upper:()=>$H});var WH,$H,mN=ge(()=>{c();Ur();WH=ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$H=ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var b1={};ot(b1,{base32:()=>vu,base32hex:()=>ZH,base32hexpad:()=>t7,base32hexpadupper:()=>r7,base32hexupper:()=>e7,base32pad:()=>JH,base32padupper:()=>XH,base32upper:()=>YH,base32z:()=>n7});var vu,YH,JH,XH,ZH,e7,t7,r7,n7,I1=ge(()=>{c();Ur();vu=ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),YH=ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),JH=ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),XH=ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ZH=ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),e7=ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),t7=ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),r7=ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),n7=ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var S1={};ot(S1,{base36:()=>i7,base36upper:()=>s7});var i7,s7,wN=ge(()=>{c();Ur();i7=Li({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),s7=Li({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var C1={};ot(C1,{base58btc:()=>wn,base58flickr:()=>o7});var wn,o7,T1=ge(()=>{c();Ur();wn=Li({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),o7=Li({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var x1={};ot(x1,{base64:()=>a7,base64pad:()=>u7,base64url:()=>c7,base64urlpad:()=>l7});var a7,u7,c7,l7,EN=ge(()=>{c();Ur();a7=ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),u7=ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),c7=ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),l7=ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var N1={};ot(N1,{base256emoji:()=>g7});function d7(t){return t.reduce((e,r)=>(e+=f7[r],e),"")}function p7(t){let e=[];for(let r of t){let n=h7[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var vN,f7,h7,g7,AN=ge(()=>{c();Ur();vN=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),f7=vN.reduce((t,e,r)=>(t[r]=e,t),[]),h7=vN.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);g7=Eu({prefix:"\u{1F680}",name:"base256emoji",encode:d7,decode:p7})});function IN(t,e,r){e=e||[],r=r||0;for(var n=r;t>=E7;)e[r++]=t&255|_N,t/=128;for(;t&w7;)e[r++]=t&255|_N,t>>>=7;return e[r]=t|0,IN.bytes=r-n+1,e}function D1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw D1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&bN)<=A7);return D1.bytes=s-n,r}var y7,_N,m7,w7,E7,v7,A7,bN,_7,b7,I7,S7,C7,T7,x7,N7,D7,O7,P7,B7,sl,SN=ge(()=>{c();y7=IN,_N=128,m7=127,w7=~m7,E7=Math.pow(2,31);v7=D1,A7=128,bN=127;_7=Math.pow(2,7),b7=Math.pow(2,14),I7=Math.pow(2,21),S7=Math.pow(2,28),C7=Math.pow(2,35),T7=Math.pow(2,42),x7=Math.pow(2,49),N7=Math.pow(2,56),D7=Math.pow(2,63),O7=function(t){return t<_7?1:t{c();SN();ol=(t,e=0)=>[sl.decode(t,e),sl.decode.bytes],Au=(t,e,r=0)=>(sl.encode(t,e,r),e),_u=t=>sl.encodingLength(t)});var oo,CN,TN,bu,ul=ge(()=>{c();Ri();zd();oo=(t,e)=>{let r=e.byteLength,n=_u(t),i=n+_u(r),s=new Uint8Array(i+r);return Au(t,s,0),Au(r,s,n),s.set(e,i),new bu(t,r,e,s)},CN=t=>{let e=kn(t),[r,n]=ol(e),[i,s]=ol(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new bu(r,i,o,e)},TN=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&uN(t.bytes,e.bytes),bu=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var P1,O1,B1=ge(()=>{c();ul();P1=({name:t,code:e,encode:r})=>new O1(t,e,r),O1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?oo(this.code,r):r.then(n=>oo(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var R1={};ot(R1,{sha256:()=>R7,sha512:()=>L7});var NN,R7,L7,DN=ge(()=>{c();B1();NN=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),R7=P1({name:"sha2-256",code:18,encode:NN("SHA-256")}),L7=P1({name:"sha2-512",code:19,encode:NN("SHA-512")})});var L1={};ot(L1,{identity:()=>U7});var ON,F7,PN,M7,U7,BN=ge(()=>{c();Ri();ul();ON=0,F7="identity",PN=kn,M7=t=>oo(ON,PN(t)),U7={code:ON,name:F7,encode:PN,digest:M7}});var RN=ge(()=>{c();Ri()});var woe,Eoe,LN=ge(()=>{c();woe=new TextEncoder,Eoe=new TextDecoder});var It,j7,H7,G7,cl,Q7,FN,MN,Wd,$d,k7,K7,z7,UN=ge(()=>{c();zd();ul();T1();I1();Ri();It=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:$d,byteLength:$d,code:Wd,version:Wd,multihash:Wd,bytes:Wd,_baseCache:$d,asCID:$d})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==cl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Q7)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return It.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=oo(e,r);return It.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&TN(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return H7(r,i,e||wn.encoder);default:return G7(r,i,e||vu.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return K7(/^0\.0/,z7),!!(e&&(e[MN]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof It)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new It(r,n,i,s||FN(r,n,i.bytes))}else if(e!=null&&e[MN]===!0){let{version:r,multihash:n,code:i}=e,s=CN(n);return It.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==cl)throw new Error(`Version 0 CID must use dag-pb (code: ${cl}) block encoding`);return new It(e,r,n,n.bytes)}case 1:{let i=FN(e,r,n.bytes);return new It(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return It.create(0,cl,e)}static createV1(e,r){return It.create(1,e,r)}static decode(e){let[r,n]=It.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=It.inspectBytes(e),n=r.size-r.multihashSize,i=kn(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new bu(r.multihashCode,r.digestSize,s,i);return[r.version===0?It.createV0(o):It.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,y]=ol(e.subarray(r));return r+=y,d},i=n(),s=cl;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=j7(e,r),s=It.decode(i);return s._baseCache.set(n,e),s}},j7=(t,e)=>{switch(t[0]){case"Q":{let r=e||wn;return[wn.prefix,r.decode(`${wn.prefix}${t}`)]}case wn.prefix:{let r=e||wn;return[wn.prefix,r.decode(t)]}case vu.prefix:{let r=e||vu;return[vu.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},H7=(t,e,r)=>{let{prefix:n}=r;if(n!==wn.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},G7=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},cl=112,Q7=18,FN=(t,e,r)=>{let n=_u(t),i=n+_u(e),s=new Uint8Array(i+r.byteLength);return Au(t,s,0),Au(e,s,n),s.set(r,i),s},MN=Symbol.for("@ipld/js-cid/CID"),Wd={writable:!1,configurable:!1,enumerable:!0},$d={writable:!1,enumerable:!1,configurable:!1},k7="0.0.0-dev",K7=(t,e)=>{if(t.test(k7))console.warn(e);else throw new Error(e)},z7=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};pe.ErrContractHasNoAddress=yy;var my=class extends Be{constructor(e){super(e)}};pe.ErrMock=my;var wy=class extends Be{constructor(e){super(e)}};pe.ErrTypingSystem=wy;var Ey=class extends Be{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=Ey;var vy=class extends Be{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=vy;var Ay=class extends Be{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Ay;var _y=class extends Be{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=_y;var by=class extends Be{constructor(e){super(e)}};pe.ErrCodec=by;var Iy=class extends Be{constructor(e){super(e)}};pe.ErrContractInteraction=Iy;var Sy=class extends Be{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Sy;var Cy=class extends Be{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Cy;var Ty=class extends Be{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=Ty;var xy=class extends Be{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=xy});var ob=v(ii=>{"use strict";c();var OL=ii&&ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ii,"__esModule",{value:!0});ii.TokenPayment=ii.TokenTransfer=void 0;var cc=OL(Wt()),PL=He(),ib="EGLD",sb=18;cc.default.set({ROUNDING_MODE:1});var zr=class{constructor(e){let r=new cc.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new PL.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new cc.default(e).shiftedBy(sb).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new zr({tokenIdentifier:ib,nonce:0,amountAsBigInteger:e,numDecimals:sb})}static fungibleFromAmount(e,r,n){let i=new cc.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new zr({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new cc.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==ib}isFungible(){return this.nonce==0}};ii.TokenTransfer=zr;var Ny=class extends zr{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ii.TokenPayment=Ny});var Ro=v(ke=>{"use strict";c();Object.defineProperty(ke,"__esModule",{value:!0});ke.ARGUMENTS_SEPARATOR=ke.ESDT_TRANSFER_VALUE=ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_GAS_LIMIT=ke.TRANSACTION_VERSION_WITH_OPTIONS=ke.TRANSACTION_VERSION_DEFAULT=ke.TRANSACTION_OPTIONS_TX_GUARDED=ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=ke.TRANSACTION_OPTIONS_DEFAULT=ke.TRANSACTION_MIN_GAS_PRICE=void 0;ke.TRANSACTION_MIN_GAS_PRICE=1e9;ke.TRANSACTION_OPTIONS_DEFAULT=0;ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ke.TRANSACTION_OPTIONS_TX_GUARDED=2;ke.TRANSACTION_VERSION_DEFAULT=1;ke.TRANSACTION_VERSION_WITH_OPTIONS=2;ke.ESDT_TRANSFER_GAS_LIMIT=5e5;ke.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ke.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ke.ESDT_TRANSFER_VALUE="0";ke.ARGUMENTS_SEPARATOR="@"});var fr=v(Je=>{"use strict";c();var BL=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RL=Je&&Je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LL=Je&&Je.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BL(e,t,r);return RL(e,t),e};Object.defineProperty(Je,"__esModule",{value:!0});Je.isEmpty=Je.guardEmpty=Je.guardNotEmpty=Je.guardLength=Je.guardSameLength=Je.guardValueIsSetWithMessage=Je.guardValueIsSet=Je.guardTrue=void 0;var Lo=LL(He());function FL(t,e){if(!t)throw new Lo.ErrInvariantFailed(`[<${e}>] isn't true`)}Je.guardTrue=FL;function ML(t,e){ab(`${t} isn't set (null or undefined)`,e)}Je.guardValueIsSet=ML;function ab(t,e){if(e==null||e===void 0)throw new Lo.ErrInvariantFailed(t)}Je.guardValueIsSetWithMessage=ab;function UL(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Lo.ErrInvariantFailed("arrays do not have the same length")}Je.guardSameLength=UL;function qL(t,e){let r=t.length||0;if(r!=e)throw new Lo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Je.guardLength=qL;function VL(t,e){if(Dy(t))throw new Lo.ErrInvariantFailed(`${e} is empty`)}Je.guardNotEmpty=VL;function HL(t,e){if(!Dy(t))throw new Lo.ErrInvariantFailed(`${e} is not empty`)}Je.guardEmpty=HL;function Dy(t){return t.isEmpty?t.isEmpty():t.length===0}Je.isEmpty=Dy});var ub=v(mf=>{"use strict";c();Object.defineProperty(mf,"__esModule",{value:!0});mf.getJavascriptPrototypesInHierarchy=void 0;function jL(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}mf.getJavascriptPrototypesInHierarchy=jL});var mt=v(yt=>{"use strict";c();Object.defineProperty(yt,"__esModule",{value:!0});yt.NullType=yt.TypePlaceholder=yt.isTyped=yt.PrimitiveValue=yt.TypedValue=yt.CustomType=yt.PrimitiveType=yt.TypeCardinality=yt.Type=void 0;var Oy=ub(),cb=fr(),sr=class{constructor(e,r=[],n=Rn.fixed(1)){cb.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return sr.ClassName}getClassHierarchy(){return Oy.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return cb.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return sr.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!sr.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return sr.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Oy.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};yt.Type=sr;sr.ClassName="Type";var Rn=class{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new Rn(e,e)}static variable(e){return new Rn(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||Rn.MaxCardinality}};yt.TypeCardinality=Rn;Rn.MaxCardinality=4096;var Fo=class extends sr{constructor(e){super(e)}getClassName(){return Fo.ClassName}};yt.PrimitiveType=Fo;Fo.ClassName="PrimitiveType";var Mo=class extends sr{getClassName(){return Mo.ClassName}};yt.CustomType=Mo;Mo.ClassName="CustomType";var ds=class{constructor(e){this.type=e}getClassName(){return ds.ClassName}getClassHierarchy(){return Oy.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};yt.TypedValue=ds;ds.ClassName="TypedValue";var Uo=class extends ds{constructor(e){super(e)}getClassName(){return Uo.ClassName}};yt.PrimitiveValue=Uo;Uo.ClassName="PrimitiveValue";function GL(t){return t.belongsToTypesystem!==void 0}yt.isTyped=GL;var qo=class extends sr{constructor(){super("...")}getClassName(){return qo.ClassName}};yt.TypePlaceholder=qo;qo.ClassName="TypePlaceholder";var Vo=class extends sr{constructor(){super("?")}getClassName(){return Vo.ClassName}};yt.NullType=Vo;Vo.ClassName="NullType"});var lb=v((Ho,jo)=>{c();(function(t){var e=typeof Ho=="object"&&Ho&&!Ho.nodeType&&Ho,r=typeof jo=="object"&&jo&&!jo.nodeType&&jo,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,y=128,w="-",E=/^xn--/,T=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},B=o-a,x=Math.floor,O=String.fromCharCode,P;function L(Y){throw new RangeError(_[Y])}function b(Y,ie){for(var te=Y.length,ne=[];te--;)ne[te]=ie(Y[te]);return ne}function C(Y,ie){var te=Y.split("@"),ne="";te.length>1&&(ne=te[0]+"@",Y=te[1]),Y=Y.replace(R,".");var q=Y.split("."),ce=b(q,ie).join(".");return ne+ce}function M(Y){for(var ie=[],te=0,ne=Y.length,q,ce;te=55296&&q<=56319&&te65535&&(ie-=65536,te+=O(ie>>>10&1023|55296),ie=56320|ie&1023),te+=O(ie),te}).join("")}function K(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function j(Y,ie){return Y+22+75*(Y<26)-((ie!=0)<<5)}function G(Y,ie,te){var ne=0;for(Y=te?x(Y/f):Y>>1,Y+=x(Y/ie);Y>B*u>>1;ne+=o)Y=x(Y/B);return x(ne+(B+1)*Y/(Y+l))}function $(Y){var ie=[],te=Y.length,ne,q=0,ce=y,oe=d,le,se,ue,g,m,A,D,I,N;for(le=Y.lastIndexOf(w),le<0&&(le=0),se=0;se=128&&L("not-basic"),ie.push(Y.charCodeAt(se));for(ue=le>0?le+1:0;ue=te&&L("invalid-input"),D=K(Y.charCodeAt(ue++)),(D>=o||D>x((s-q)/m))&&L("overflow"),q+=D*m,I=A<=oe?a:A>=oe+u?u:A-oe,!(Dx(s/N)&&L("overflow"),m*=N;ne=ie.length+1,oe=G(q-g,ne,g==0),x(q/ne)>s-ce&&L("overflow"),ce+=x(q/ne),q%=ne,ie.splice(q++,0,ce)}return Z(ie)}function de(Y){var ie,te,ne,q,ce,oe,le,se,ue,g,m,A=[],D,I,N,F;for(Y=M(Y),D=Y.length,ie=y,te=0,ce=d,oe=0;oe=ie&&mx((s-te)/I)&&L("overflow"),te+=(le-ie)*I,ie=le,oe=0;oes&&L("overflow"),m==ie){for(se=te,ue=o;g=ue<=ce?a:ue>=ce+u?u:ue-ce,!(se{"use strict";c();var hb=lb();function QL(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Py(t){return t>="0"&&t<="7"}function kL(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function fb(t){return t=parseInt(t,16),hb.ucs2.encode([t])}function db(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!kL(l))throw new QL(u,"Unexpected token ILLEGAL");return l}for(;e{c();var mb=pb();vb.exports={validate:KL,parse:zL};function KL(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{wf(t,0,e,!1)}catch(n){r=n.message}return r}function zL(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=wf(t,0,e,!0);return r.value}function wb(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function JL(t,e,r,n){for(var i=e,s=",",o=[],a=e;ps(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=wf(t,i,r,n),l=wb(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function XL(t,e){return t.substr(e,4)==="true"}function ZL(t,e){return t.substr(e,5)==="false"}function e5(t,e){return t.substr(e,4)==="null"}var t5=new RegExp(/^\s$/);function ps(t){return t5.test(t)}var r5=new RegExp(/^\d$/);function gb(t){return r5.test(t)}function Ln(t,e,r){var n=10,i;t.length{"use strict";c();var n5=Wr&&Wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i5=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s5=Wr&&Wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n5(e,t,r);return i5(e,t),e};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.TypeExpressionParser=void 0;var _b=s5(He()),o5=mt(),a5=Ab(),Ry=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new _b.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return a5.parse(r)}catch{throw new _b.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new o5.Type(e,n)}};Wr.TypeExpressionParser=Ry});var Ly=v(si=>{"use strict";c();Object.defineProperty(si,"__esModule",{value:!0});si.EndpointParameterDefinition=si.EndpointModifiers=si.EndpointDefinition=void 0;var u5=Ef(),bb="?",c5="N / A",lc=class{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?bb:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>gs.fromJSON(s)),n=e.outputs.map(s=>gs.fromJSON(s)),i=new vf(e.mutability,e.payableInTokens);return new lc(e.name,r,n,i)}};si.EndpointDefinition=lc;var vf=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};si.EndpointModifiers=vf;var gs=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new u5.TypeExpressionParser().parse(e.type);return new gs(e.name||bb,e.description||c5,r)}};si.EndpointParameterDefinition=gs});var Go=v(Xt=>{"use strict";c();var l5=Xt&&Xt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f5=Xt&&Xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h5=Xt&&Xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&l5(e,t,r);return f5(e,t),e};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.Fields=Xt.Field=Xt.FieldDefinition=void 0;var Fy=h5(He()),d5=Ef(),fc=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new d5.TypeExpressionParser().parse(e.type);return new fc(e.name,e.description,r)}};Xt.FieldDefinition=fc;var My=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Fy.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Fy.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};Xt.Field=My;var Uy=class{static checkTyping(e,r){if(e.length!=r.length)throw new Fy.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(ai,"__esModule",{value:!0});ai.EnumValue=ai.EnumVariantDefinition=ai.EnumType=void 0;var p5=He(),qy=fr(),Af=Go(),Sb=mt(),Ib=256,ys=class extends Sb.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return ys.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>Qo.fromJSON(n));return new ys(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return qy.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return qy.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};ai.EnumType=ys;ys.ClassName="EnumType";var Qo=class{constructor(e,r,n=[]){this.fieldsDefinitions=[],qy.guardTrue(rAf.FieldDefinition.fromJSON(n));return new Qo(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ai.EnumVariantDefinition=Qo;var oi=class extends Sb.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Af.Fields.checkTyping(this.fields,i)}getClassName(){return oi.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new oi(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new oi(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Af.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new p5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(r=>e.fields[r.name]=r.value.valueOf()),e}};ai.EnumValue=oi;oi.ClassName="EnumValue"});var zo=v(Ko=>{"use strict";c();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.Struct=Ko.StructType=void 0;var g5=He(),_f=Go(),Cb=mt(),ms=class extends Cb.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return ms.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>_f.FieldDefinition.fromJSON(n));return new ms(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return _f.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ko.StructType=ms;ms.ClassName="StructType";var ko=class extends Cb.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return ko.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();_f.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new g5.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return _f.Fields.equals(r,n)}};Ko.Struct=ko;ko.ClassName="Struct"});var Cf=v((WX,Nb)=>{"use strict";c();var If="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Vy={};for(dc=0;dc>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Tb(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Wo(e)^n>>5}for(e=Wo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=Tb(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Wo(n)^o,i+=If.charAt(o)}for(s=0;s<6;++s)n=Wo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=If.charAt(a)}return i}function xb(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=Tb(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function m5(){var t=xb.apply(null,arguments);if(typeof t=="object")return t}function w5(t){var e=xb.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Sf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var b5=$r&&$r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),I5=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Db=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b5(e,t,r);return I5(e,t),e};Object.defineProperty($r,"__esModule",{value:!0});$r.Address=void 0;var Tf=Db(Cf()),$o=Db(He()),Hy="erd",jy=32,S5="0".repeat(16),_t=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof _t)return _t.fromAddress(e);if(e instanceof h.Buffer)return _t.fromBuffer(e);if(typeof e=="string")return _t.fromString(e);throw new $o.ErrAddressCannotCreate(e)}}static fromAddress(e){return _t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new _t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=jy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e.toString("hex"))}static fromString(e){return _t.isValidHex(e)?_t.fromValidHex(e):_t.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==jy}static fromHex(e){if(!_t.isValidHex(e))throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e)}static empty(){return new _t}static fromBech32(e){let r;try{r=Tf.decode(e)}catch(s){throw new $o.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Hy)throw new $o.ErrAddressBadHrp(Hy,n);let i=h.Buffer.from(Tf.fromWords(r.words));if(i.length!=jy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Tf.toWords(this.pubkey());return Tf.encode(Hy,e)}pubkey(){return this.isEmpty()?h.Buffer.from([]):h.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new _t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(S5)}};$r.Address=_t});var Xo=v(Jo=>{"use strict";c();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.AddressValue=Jo.AddressType=void 0;var C5=Zt(),Ob=mt(),ws=class extends Ob.PrimitiveType{constructor(){super("Address")}getClassName(){return ws.ClassName}};Jo.AddressType=ws;ws.ClassName="AddressType";var Yo=class extends Ob.PrimitiveValue{constructor(e){super(new ws),this.value=new C5.Address(e.bech32())}getClassName(){return Yo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Jo.AddressValue=Yo;Yo.ClassName="AddressValue"});var xf=v(Zo=>{"use strict";c();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.OptionalValue=Zo.OptionalType=void 0;var T5=fr(),pc=mt(),ui=class extends pc.Type{constructor(e){super("Optional",[e],pc.TypeCardinality.variable(1))}getClassName(){return ui.ClassName}isAssignableFrom(e){if(!e.hasExactClass(ui.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(pc.NullType.ClassName);return r||n}};Zo.OptionalType=ui;ui.ClassName="OptionalType";var Es=class extends pc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Es.ClassName}static newMissing(){let e=new ui(new pc.NullType);return new Es(e)}isSet(){return!!this.value}getTypedValue(){return T5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Zo.OptionalValue=Es;Es.ClassName="OptionalValue"});var gc=v(ta=>{"use strict";c();Object.defineProperty(ta,"__esModule",{value:!0});ta.BooleanValue=ta.BooleanType=void 0;var Pb=mt(),vs=class extends Pb.PrimitiveType{constructor(){super("bool")}getClassName(){return vs.ClassName}};ta.BooleanType=vs;vs.ClassName="BooleanType";var ea=class extends Pb.PrimitiveValue{constructor(e){super(new vs),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ta.BooleanValue=ea;ea.ClassName="BooleanValue"});var li=v(ra=>{"use strict";c();Object.defineProperty(ra,"__esModule",{value:!0});ra.BytesValue=ra.BytesType=void 0;var Bb=mt(),As=class extends Bb.PrimitiveType{constructor(){super("bytes")}getClassName(){return As.ClassName}};ra.BytesType=As;As.ClassName="BytesType";var ci=class extends Bb.PrimitiveValue{constructor(e){super(new As),this.value=e}getClassName(){return ci.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new ci(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new ci(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};ra.BytesValue=ci;ci.ClassName="BytesValue"});var Lb=v(na=>{"use strict";c();Object.defineProperty(na,"__esModule",{value:!0});na.CodeMetadataValue=na.CodeMetadataType=void 0;var Rb=mt(),Nf=class extends Rb.PrimitiveType{constructor(){super("CodeMetadata")}};na.CodeMetadataType=Nf;var Gy=class extends Rb.PrimitiveValue{constructor(e){super(new Nf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};na.CodeMetadataValue=Gy});var Df=v(ia=>{"use strict";c();Object.defineProperty(ia,"__esModule",{value:!0});ia.CompositeValue=ia.CompositeType=void 0;var x5=fr(),Qy=mt(),_s=class extends Qy.Type{constructor(...e){super("Composite",e,Qy.TypeCardinality.variable(e.length))}getClassName(){return _s.ClassName}};ia.CompositeType=_s;_s.ClassName="CompositeType";var bs=class extends Qy.TypedValue{constructor(e,r){super(e),x5.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return bs.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new _s(...r);return new bs(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Of,"__esModule",{value:!0});Of.CollectionOfTypedValues=void 0;var ky=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.List=Yr.OptionValue=Yr.ListType=Yr.OptionType=void 0;var N5=fr(),D5=Ky(),Is=mt(),Jr=class extends Is.Type{constructor(e){super("Option",[e])}getClassName(){return Jr.ClassName}isAssignableFrom(e){if(!e.hasExactClass(Jr.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Is.NullType.ClassName);return r||n}};Yr.OptionType=Jr;Jr.ClassName="OptionType";var Ss=class extends Is.Type{constructor(e){super("List",[e])}getClassName(){return Ss.ClassName}};Yr.ListType=Ss;Ss.ClassName="ListType";var Fn=class extends Is.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Fn.ClassName}static newMissing(){let e=new Jr(new Is.NullType);return new Fn(e)}static newMissingTyped(e){return new Fn(new Jr(e))}static newProvided(e){let r=new Jr(e.getType());return new Fn(r,e)}isSet(){return!!this.value}getTypedValue(){return N5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Yr.OptionValue=Fn;Fn.ClassName="OptionValue";var fi=class extends Is.TypedValue{constructor(e,r){super(e),this.backingCollection=new D5.CollectionOfTypedValues(r)}getClassName(){return fi.ClassName}static fromItems(e){if(e.length==0)return new fi(new Is.TypePlaceholder,[]);let r=e[0].getType(),n=new Ss(r);return new fi(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Yr.List=fi;fi.ClassName="List"});var Pf=v(aa=>{"use strict";c();Object.defineProperty(aa,"__esModule",{value:!0});aa.ArrayVec=aa.ArrayVecType=void 0;var Fb=fr(),O5=Ky(),Mb=mt(),sa=class extends Mb.Type{constructor(e,r){super("Array",[r]),Fb.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return sa.ClassName}};aa.ArrayVecType=sa;sa.ClassName="ArrayVecType";var oa=class extends Mb.TypedValue{constructor(e,r){super(e),Fb.guardLength(r,e.length),this.backingCollection=new O5.CollectionOfTypedValues(r)}getClassName(){return oa.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};aa.ArrayVec=oa;oa.ClassName="ArrayVec"});var mc=v(ca=>{"use strict";c();Object.defineProperty(ca,"__esModule",{value:!0});ca.H256Value=ca.H256Type=void 0;var Ub=mt(),Cs=class extends Ub.PrimitiveType{constructor(){super("H256")}getClassName(){return Cs.ClassName}};ca.H256Type=Cs;Cs.ClassName="H256Type";var ua=class extends Ub.PrimitiveValue{constructor(e){super(new Cs),this.value=e}getClassName(){return ua.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ca.H256Value=ua;ua.ClassName="H256Value"});var Bf=v(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.NothingValue=fa.NothingType=void 0;var qb=mt(),Ts=class extends qb.PrimitiveType{constructor(){super("nothing")}getClassName(){return Ts.ClassName}};fa.NothingType=Ts;Ts.ClassName="NothingType";var la=class extends qb.PrimitiveValue{constructor(){super(new Ts)}getClassName(){return la.ClassName}equals(e){return!1}valueOf(){return{}}};fa.NothingValue=la;la.ClassName="NothingValue"});var wc=v(Ae=>{"use strict";c();var P5=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B5=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R5=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P5(e,t,r);return B5(e,t),e},L5=Ae&&Ae.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var Vb=R5(He()),Hb=mt(),Us=L5(Wt()),Vt=class extends Hb.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return Vt.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=Vt;Vt.ClassName="NumericalType";var xs=class extends Vt{constructor(){super("u8",1,!1)}getClassName(){return xs.ClassName}};Ae.U8Type=xs;xs.ClassName="U8Type";var Ns=class extends Vt{constructor(){super("i8",1,!0)}getClassName(){return Ns.ClassName}};Ae.I8Type=Ns;Ns.ClassName="I8Type";var Ds=class extends Vt{constructor(){super("u16",2,!1)}getClassName(){return Ds.ClassName}};Ae.U16Type=Ds;Ds.ClassName="U16Type";var Os=class extends Vt{constructor(){super("i16",2,!0)}getClassName(){return Os.ClassName}};Ae.I16Type=Os;Os.ClassName="I16Type";var Ps=class extends Vt{constructor(){super("u32",4,!1)}getClassName(){return Ps.ClassName}};Ae.U32Type=Ps;Ps.ClassName="U32Type";var Bs=class extends Vt{constructor(){super("i32",4,!0)}getClassName(){return Bs.ClassName}};Ae.I32Type=Bs;Bs.ClassName="I32Type";var Rs=class extends Vt{constructor(){super("u64",8,!1)}getClassName(){return Rs.ClassName}};Ae.U64Type=Rs;Rs.ClassName="U64Type";var Ls=class extends Vt{constructor(){super("i64",8,!0)}getClassName(){return Ls.ClassName}};Ae.I64Type=Ls;Ls.ClassName="I64Type";var Fs=class extends Vt{constructor(){super("BigUint",0,!1)}getClassName(){return Fs.ClassName}};Ae.BigUIntType=Fs;Fs.ClassName="BigUIntType";var Ms=class extends Vt{constructor(){super("Bigint",0,!0)}getClassName(){return Ms.ClassName}};Ae.BigIntType=Ms;Ms.ClassName="BigIntType";var Ht=class extends Hb.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Us.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new Vb.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new Vb.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return Ht.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=Ht;Ht.ClassName="NumericalValue";var ha=class extends Ht{constructor(e){super(new xs,new Us.default(e))}getClassName(){return ha.ClassName}};Ae.U8Value=ha;ha.ClassName="U8Value";var da=class extends Ht{constructor(e){super(new Ns,new Us.default(e))}getClassName(){return da.ClassName}};Ae.I8Value=da;da.ClassName="I8Value";var pa=class extends Ht{constructor(e){super(new Ds,new Us.default(e))}getClassName(){return pa.ClassName}};Ae.U16Value=pa;pa.ClassName="U16Value";var ga=class extends Ht{constructor(e){super(new Os,new Us.default(e))}getClassName(){return ga.ClassName}};Ae.I16Value=ga;ga.ClassName="I16Value";var ya=class extends Ht{constructor(e){super(new Ps,new Us.default(e))}getClassName(){return ya.ClassName}};Ae.U32Value=ya;ya.ClassName="U32Value";var ma=class extends Ht{constructor(e){super(new Bs,new Us.default(e))}getClassName(){return ma.ClassName}};Ae.I32Value=ma;ma.ClassName="I32Value";var wa=class extends Ht{constructor(e){super(new Rs,e)}getClassName(){return wa.ClassName}};Ae.U64Value=wa;wa.ClassName="U64Value";var Ea=class extends Ht{constructor(e){super(new Ls,e)}getClassName(){return Ea.ClassName}};Ae.I64Value=Ea;Ea.ClassName="I64Value";var va=class extends Ht{constructor(e){super(new Fs,e)}getClassName(){return va.ClassName}};Ae.BigUIntValue=va;va.ClassName="BigUIntValue";var Aa=class extends Ht{constructor(e){super(new Ms,e)}getClassName(){return Aa.ClassName}};Ae.BigIntValue=Aa;Aa.ClassName="BigIntValue"});var Rf=v(_a=>{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.StringValue=_a.StringType=void 0;var jb=mt(),qs=class extends jb.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return qs.ClassName}};_a.StringType=qs;qs.ClassName="StringType";var hi=class extends jb.PrimitiveValue{constructor(e){super(new qs),this.value=e}getClassName(){return hi.ClassName}static fromUTF8(e){return new hi(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new hi(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};_a.StringValue=hi;hi.ClassName="StringValue"});var Ia=v(ba=>{"use strict";c();Object.defineProperty(ba,"__esModule",{value:!0});ba.TokenIdentifierValue=ba.TokenIdentifierType=void 0;var Gb=mt(),F5="EGLD",Vs=class extends Gb.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Vs.ClassName}};ba.TokenIdentifierType=Vs;Vs.ClassName="TokenIdentifierType";var di=class extends Gb.PrimitiveValue{constructor(e){super(new Vs),this.value=e}static egld(){return new di(F5)}static esdtTokenIdentifier(e){return new di(e)}getClassName(){return di.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};ba.TokenIdentifierValue=di;di.ClassName="TokenIdentifierValue"});var Lf=v(hr=>{"use strict";c();var M5=hr&&hr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U5=hr&&hr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q5=hr&&hr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M5(e,t,r);return U5(e,t),e};Object.defineProperty(hr,"__esModule",{value:!0});hr.Tuple=hr.TupleType=void 0;var V5=q5(He()),Qb=Go(),kb=zo(),Mn=class extends kb.StructType{constructor(...e){super(Mn.prepareName(e),Mn.prepareFieldDefinitions(e))}getClassName(){return Mn.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new Qb.FieldDefinition(Kb(i),"anonymous tuple field",n))}};hr.TupleType=Mn;Mn.ClassName="TupleType";function Kb(t){return`field${t}`}var Hs=class extends kb.Struct{constructor(e,r){super(e,r)}getClassName(){return Hs.ClassName}static fromItems(e){if(e.length<1)throw new V5.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Mn(...r),i=e.map((s,o)=>new Qb.Field(s,Kb(o)));return new Hs(n,i)}};hr.Tuple=Hs;Hs.ClassName="Tuple"});var Mf=v(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.VariadicValue=Sa.VariadicType=void 0;var Ff=mt(),gi=class extends Ff.Type{constructor(e){super("Variadic",[e],Ff.TypeCardinality.variable())}getClassName(){return gi.ClassName}};Sa.VariadicType=gi;gi.ClassName="VariadicType";var pi=class extends Ff.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return pi.ClassName}static fromItems(...e){if(e.length==0)return new pi(new gi(new Ff.TypePlaceholder),[]);let r=e[0].getType();return new pi(new gi(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var H5=Xr&&Xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j5=Xr&&Xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G5=Xr&&Xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H5(e,t,r);return j5(e,t),e};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.TypeMapper=void 0;var zb=G5(He()),Q5=Xo(),zy=xf(),k5=gc(),K5=li(),z5=Lb(),Uf=Df(),Wy=hc(),W5=Go(),Wb=yc(),qf=Pf(),$5=mc(),$b=Bf(),dr=wc(),Y5=Rf(),Yb=zo(),Jb=Ia(),yi=Lf(),$y=Mf(),Yy=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new Wb.OptionType(r[0])],["List",(...r)=>new Wb.ListType(r[0])],["VarArgs",(...r)=>new $y.VariadicType(r[0])],["MultiResultVec",(...r)=>new $y.VariadicType(r[0])],["variadic",(...r)=>new $y.VariadicType(r[0])],["OptionalArg",(...r)=>new zy.OptionalType(r[0])],["optional",(...r)=>new zy.OptionalType(r[0])],["OptionalResult",(...r)=>new zy.OptionalType(r[0])],["multi",(...r)=>new Uf.CompositeType(...r)],["MultiArg",(...r)=>new Uf.CompositeType(...r)],["MultiResult",(...r)=>new Uf.CompositeType(...r)],["multi",(...r)=>new Uf.CompositeType(...r)],["tuple",(...r)=>new yi.TupleType(...r)],["tuple2",(...r)=>new yi.TupleType(...r)],["tuple3",(...r)=>new yi.TupleType(...r)],["tuple4",(...r)=>new yi.TupleType(...r)],["tuple5",(...r)=>new yi.TupleType(...r)],["tuple6",(...r)=>new yi.TupleType(...r)],["tuple7",(...r)=>new yi.TupleType(...r)],["tuple8",(...r)=>new yi.TupleType(...r)],["array20",(...r)=>new qf.ArrayVecType(20,r[0])],["array32",(...r)=>new qf.ArrayVecType(32,r[0])],["array46",(...r)=>new qf.ArrayVecType(46,r[0])],["array64",(...r)=>new qf.ArrayVecType(64,r[0])]]),this.closedTypesMap=new Map([["u8",new dr.U8Type],["u16",new dr.U16Type],["u32",new dr.U32Type],["u64",new dr.U64Type],["U64",new dr.U64Type],["BigUint",new dr.BigUIntType],["i8",new dr.I8Type],["i16",new dr.I16Type],["i32",new dr.I32Type],["i64",new dr.I64Type],["Bigint",new dr.BigIntType],["BigInt",new dr.BigIntType],["bool",new k5.BooleanType],["bytes",new K5.BytesType],["Address",new Q5.AddressType],["H256",new $5.H256Type],["utf-8 string",new Y5.StringType],["TokenIdentifier",new Jb.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new Jb.TokenIdentifierType],["CodeMetadata",new z5.CodeMetadataType],["nothing",new $b.NothingType],["AsyncCall",new $b.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new zb.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(Wy.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(Yb.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new Yb.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Wy.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Wy.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new W5.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new zb.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};Xr.TypeMapper=Yy});var rI=v(Zr=>{"use strict";c();var J5=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X5=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z5=Zr&&Zr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J5(e,t,r);return X5(e,t),e};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.AbiRegistry=void 0;var Xb=Z5(He()),Xy=fr(),Ec=Ly(),Zb=hc(),eI=zo(),eF=Jy(),tF="?",Ca=class{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||tF,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Ec.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Ec.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let y=s[d];if(y.type=="struct")u.push(eI.StructType.fromJSON({name:d,fields:y.fields}));else if(y.type=="enum")u.push(Zb.EnumType.fromJSON({name:d,variants:y.variants}));else throw new Xb.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new Ca({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(eI.StructType.ClassName));return Xy.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(Zb.EnumType.ClassName));return Xy.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Xy.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new eF.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new Xb.ErrTypingSystem("Did not re-map all custom types");let n=tI(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(tI(o,e));return new Ca({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};Zr.AbiRegistry=Ca;function tI(t,e){let r=t.input.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Ec.EndpointDefinition(t.name,r,n,t.modifiers)}});var iI=v(Ta=>{"use strict";c();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.createListOfTokenIdentifiers=Ta.createListOfAddresses=void 0;var rF=Xo(),nI=yc(),nF=Ia();function iF(t){let e=t.map(n=>new rF.AddressValue(n));return nI.List.fromItems(e)}Ta.createListOfAddresses=iF;function sF(t){let e=t.map(n=>new nF.TokenIdentifierValue(n));return nI.List.fromItems(e)}Ta.createListOfTokenIdentifiers=sF});var wI=v(jt=>{"use strict";c();var oF=jt&&jt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aF=jt&&jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uF=jt&&jt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oF(e,t,r);return aF(e,t),e};Object.defineProperty(jt,"__esModule",{value:!0});jt.onPrimitiveTypeSelect=jt.onPrimitiveValueSelect=jt.onTypedValueSelect=jt.onTypeSelect=void 0;var Hf=uF(He()),sI=Xo(),oI=gc(),aI=li(),uI=hc(),Vf=yc(),cI=mc(),lI=wc(),fI=Bf(),hI=zo(),dI=Ia(),pI=Lf(),gI=mt(),yI=Pf(),mI=Rf();function cF(t,e){if(t.hasExactClass(Vf.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Vf.ListType.ClassName))return e.onList();if(t.hasExactClass(yI.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(gI.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(hI.StructType.ClassName))return e.onStruct();if(t.hasExactClass(pI.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(uI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't known: ${t}`)}jt.onTypeSelect=cF;function lF(t,e){if(t.hasClassOrSuperclass(gI.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Vf.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Vf.List.ClassName))return e.onList();if(t.hasExactClass(yI.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(hI.Struct.ClassName))return e.onStruct();if(t.hasExactClass(pI.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(uI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't typed: ${t}`)}jt.onTypedValueSelect=lF;function fF(t,e){if(t.hasExactClass(oI.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(lI.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(sI.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(aI.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(mI.StringValue.ClassName))return e.onString();if(t.hasExactClass(cI.H256Value.ClassName))return e.onH256();if(t.hasExactClass(dI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(fI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}jt.onPrimitiveValueSelect=fF;function hF(t,e){if(t.hasExactClass(oI.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(lI.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(sI.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(aI.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(mI.StringType.ClassName))return e.onString();if(t.hasExactClass(cI.H256Type.ClassName))return e.onH256();if(t.hasExactClass(dI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(fI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't a known primitive: ${t}`)}jt.onPrimitiveTypeSelect=hF});var Tt=v(Ue=>{"use strict";c();var dF=Ue&&Ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xe=Ue&&Ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dF(e,t,r)};Object.defineProperty(Ue,"__esModule",{value:!0});Xe(rI(),Ue);Xe(Xo(),Ue);Xe(xf(),Ue);Xe(gc(),Ue);Xe(li(),Ue);Xe(Df(),Ue);Xe(Ly(),Ue);Xe(hc(),Ue);Xe(iI(),Ue);Xe(Go(),Ue);Xe(yc(),Ue);Xe(Pf(),Ue);Xe(mc(),Ue);Xe(wI(),Ue);Xe(Bf(),Ue);Xe(wc(),Ue);Xe(Rf(),Ue);Xe(zo(),Ue);Xe(Ia(),Ue);Xe(Lf(),Ue);Xe(Ef(),Ue);Xe(Jy(),Ue);Xe(mt(),Ue);Xe(Mf(),Ue)});var vI=v(en=>{"use strict";c();var pF=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gF=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yF=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pF(e,t,r);return gF(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.OptionValueBinaryCodec=void 0;var EI=yF(He()),jf=Tt(),Zy=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[jf.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new EI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[jf.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new jf.OptionValue(r);if(e[0]!=1)throw new EI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new jf.OptionValue(r,n)}encodeNested(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([])}};en.OptionValueBinaryCodec=Zy});var AI=v(Gf=>{"use strict";c();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.AddressBinaryCodec=void 0;var mF=Zt(),wF=Tt(),em=class{decodeNested(e){let r=e.slice(0,32),n=new mF.Address(r);return[new wF.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Gf.AddressBinaryCodec=em});var bI=v(tn=>{"use strict";c();var EF=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vF=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AF=tn&&tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EF(e,t,r);return vF(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.BooleanBinaryCodec=void 0;var _F=AF(He()),_I=Tt(),Dr=class{decodeNested(e){let r=e.readUInt8(0);return[new _I.BooleanValue(r==Dr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new _F.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new _I.BooleanValue(r==Dr.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([Dr.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([])}};tn.BooleanBinaryCodec=Dr;Dr.TRUE=1;Dr.FALSE=0});var kf=v(Qf=>{"use strict";c();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.SizeOfU32=void 0;Qf.SizeOfU32=4});var tm=v(rn=>{"use strict";c();var bF=rn&&rn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.zeroPadStringIfOddLength=rn.isPaddedHex=rn.numberToPaddedHex=void 0;var IF=bF(Wt());function SF(t){let e=new IF.default(t).toString(16);return II(e)}rn.numberToPaddedHex=SF;function CF(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}rn.isPaddedHex=CF;function II(t){return t=t||"",t.length%2==1?"0"+t:t}rn.zeroPadStringIfOddLength=II});var Kf=v(wt=>{"use strict";c();var TF=wt&&wt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wt,"__esModule",{value:!0});wt.prependByteToBuffer=wt.flipBufferBitsInPlace=wt.getHexMagnitudeOfBigInt=wt.bigIntToBuffer=wt.bufferToBigInt=wt.cloneBuffer=wt.isMsbZero=wt.isMsbOne=void 0;var rm=TF(Wt()),xF=tm();function SI(t,e=0){return t[e]>>7==1}wt.isMsbOne=SI;function NF(t,e=0){return!SI(t,e)}wt.isMsbZero=NF;function DF(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}wt.cloneBuffer=DF;function OF(t){let e=t.toString("hex");return new rm.default(`0x${e}`,16)}wt.bufferToBigInt=OF;function PF(t){let e=CI(t);return h.Buffer.from(e,"hex")}wt.bigIntToBuffer=PF;function CI(t){return t=new rm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new rm.default(-1))),xF.numberToPaddedHex(t)):""}wt.getHexMagnitudeOfBigInt=CI;function BF(t){for(let e=0;e{"use strict";c();var LF=xa&&xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xa,"__esModule",{value:!0});xa.NumericalBinaryCodec=void 0;var vc=LF(Wt()),nm=Tt(),TI=kf(),ht=Kf(),im=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=TI.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=ht.cloneBuffer(e);if(e.length==0)return new nm.NumericalValue(r,new vc.default(0));if(!r.withSign||ht.isMsbZero(n)){let l=ht.bufferToBigInt(n);return new nm.NumericalValue(r,l)}ht.flipBufferBitsInPlace(n);let u=ht.bufferToBigInt(n).multipliedBy(new vc.default(-1)).minus(new vc.default(1));return new nm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(TI.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=ht.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=ht.bigIntToBuffer(e.value);ht.isMsbOne(o)&&(o=ht.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new vc.default(1)),i=ht.bigIntToBuffer(n);ht.flipBufferBitsInPlace(i),ht.isMsbZero(i)&&(i=ht.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):ht.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=ht.bigIntToBuffer(e.value);return ht.isMsbOne(i)&&(i=ht.prependByteToBuffer(i,0)),i}let r=e.value.plus(new vc.default(1)),n=ht.bigIntToBuffer(r);return ht.flipBufferBitsInPlace(n),ht.isMsbZero(n)&&(n=ht.prependByteToBuffer(n,255)),n}};xa.NumericalBinaryCodec=im});var NI=v(zf=>{"use strict";c();Object.defineProperty(zf,"__esModule",{value:!0});zf.H256BinaryCodec=void 0;var FF=mc(),sm=class{decodeNested(e){let r=e.slice(0,32);return[new FF.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};zf.H256BinaryCodec=sm});var Yf=v($f=>{"use strict";c();Object.defineProperty($f,"__esModule",{value:!0});$f.BytesBinaryCodec=void 0;var DI=li(),Wf=kf(),om=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(Wf.SizeOfU32,Wf.SizeOfU32+r);return[new DI.BytesValue(n),Wf.SizeOfU32+r]}decodeTopLevel(e){return new DI.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(Wf.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};$f.BytesBinaryCodec=om});var PI=v(Jf=>{"use strict";c();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.TokenIdentifierCodec=void 0;var MF=li(),OI=Ia(),UF=Yf(),am=class{constructor(){this.bytesCodec=new UF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new OI.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new OI.TokenIdentifierValue(r.toString())}encodeNested(e){let r=MF.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Jf.TokenIdentifierCodec=am});var RI=v(Xf=>{"use strict";c();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.NothingCodec=void 0;var BI=Tt(),um=class{decodeNested(){return[new BI.NothingValue,0]}decodeTopLevel(){return new BI.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Xf.NothingCodec=um});var FI=v(Zf=>{"use strict";c();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.StringBinaryCodec=void 0;var LI=Tt(),qF=li(),VF=Yf(),cm=class{constructor(){this.bytesBinaryCodec=new VF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new LI.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new LI.StringValue(e.toString())}encodeNested(e){let r=qF.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Zf.StringBinaryCodec=cm});var MI=v(th=>{"use strict";c();Object.defineProperty(th,"__esModule",{value:!0});th.PrimitiveBinaryCodec=void 0;var eh=Tt(),HF=AI(),jF=bI(),GF=xI(),QF=NI(),kF=Yf(),KF=PI(),zF=RI(),WF=FI(),lm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new jF.BooleanBinaryCodec,this.numericalCodec=new GF.NumericalBinaryCodec,this.addressCodec=new HF.AddressBinaryCodec,this.h256Codec=new QF.H256BinaryCodec,this.bytesCodec=new kF.BytesBinaryCodec,this.stringCodec=new WF.StringBinaryCodec,this.tokenIdentifierCodec=new KF.TokenIdentifierCodec,this.nothingCodec=new zF.NothingCodec}decodeNested(e,r){return eh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return eh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return eh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return eh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};th.PrimitiveBinaryCodec=lm});var VI=v(rh=>{"use strict";c();Object.defineProperty(rh,"__esModule",{value:!0});rh.ListBinaryCodec=void 0;var UI=Tt(),qI=kf(),fm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=qI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new UI.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(qI.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return h.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return h.Buffer.concat(r)}};rh.ListBinaryCodec=fm});var dm=v(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.FieldsBinaryCodec=void 0;var $F=Tt(),hm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new $F.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return h.Buffer.concat(r)}};nh.FieldsBinaryCodec=hm});var gm=v(ih=>{"use strict";c();Object.defineProperty(ih,"__esModule",{value:!0});ih.StructBinaryCodec=void 0;var YF=Tt(),JF=dm(),pm=class{constructor(e){this.fieldsCodec=new JF.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new YF.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};ih.StructBinaryCodec=pm});var HI=v(oh=>{"use strict";c();Object.defineProperty(oh,"__esModule",{value:!0});oh.EnumBinaryCodec=void 0;var sh=Tt(),XF=dm(),ym=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new XF.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new sh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new sh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new sh.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return h.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new sh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};oh.EnumBinaryCodec=ym});var jI=v(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.TupleBinaryCodec=void 0;var ZF=gm(),mm=class{constructor(e){this.structCodec=new ZF.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};ah.TupleBinaryCodec=mm});var GI=v(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.ArrayVecBinaryCodec=void 0;var e4=Tt(),wm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var t4=pr&&pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r4=pr&&pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n4=pr&&pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t4(e,t,r);return r4(e,t),e};Object.defineProperty(pr,"__esModule",{value:!0});pr.BinaryCodecConstraints=pr.BinaryCodec=void 0;var QI=n4(He()),ch=Tt(),kI=fr(),i4=vI(),s4=MI(),o4=VI(),a4=gm(),u4=HI(),c4=jI(),l4=GI(),Em=class{constructor(e=null){this.constraints=e||new lh,this.optionCodec=new i4.OptionValueBinaryCodec(this),this.listCodec=new o4.ListBinaryCodec(this),this.arrayCodec=new l4.ArrayVecBinaryCodec(this),this.primitiveCodec=new s4.PrimitiveBinaryCodec(this),this.structCodec=new a4.StructBinaryCodec(this),this.tupleCodec=new c4.TupleBinaryCodec(this),this.enumCodec=new u4.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),ch.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=ch.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return kI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),ch.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return kI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),ch.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};pr.BinaryCodec=Em;var lh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new QI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new QI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};pr.BinaryCodecConstraints=lh});var KI=v(gr=>{"use strict";c();var f4=gr&&gr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gr,"__esModule",{value:!0});gr.decodeBigNumber=gr.decodeString=gr.decodeBool=gr.decodeUnsignedNumber=void 0;var h4=f4(Wt()),fh=Tt(),d4=vm(),hh=new d4.BinaryCodec;function p4(t){let e=hh.decodeTopLevel(t,new fh.BigUIntType);return Number(e.valueOf())}gr.decodeUnsignedNumber=p4;function g4(t){return!!hh.decodeTopLevel(t,new fh.BooleanType).valueOf()}gr.decodeBool=g4;function y4(t){let e=hh.decodeTopLevel(t,new fh.BytesType);return String(e.valueOf())}gr.decodeString=y4;function m4(t){let e=hh.decodeTopLevel(t,new fh.BigUIntType);return new h4.default(e.valueOf())}gr.decodeBigNumber=m4});var WI=v(mi=>{"use strict";c();var w4=mi&&mi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zI=mi&&mi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&w4(e,t,r)};Object.defineProperty(mi,"__esModule",{value:!0});zI(vm(),mi);zI(KI(),mi)});var ph=v(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.ArgSerializer=void 0;var $I=Ro(),E4=WI(),Am=xf(),_m=Df(),bm=Mf(),v4={codec:new E4.BinaryCodec},Im=class{constructor(e){e=Object.assign(Object.assign({},v4),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split($I.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let f=0;f=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join($I.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let s of e)i(s);function i(s){if(s.hasExactClass(Am.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(bm.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(_m.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};dh.ArgSerializer=Im});var mh=v(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.Compatibility=void 0;var A4=Zt(),gh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==A4.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};yh.Compatibility=gh;gh.areWarningsEnabled=!0});var YI=v(nn=>{"use strict";c();var _4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_4(e,t,r);return b4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Hash=void 0;var S4=I4(He()),Ac=class{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new S4.ErrBadType("hash","buffer | string",e)}static empty(){return new Ac(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};nn.Hash=Ac});var XI=v(yr=>{"use strict";c();var C4=yr&&yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T4=yr&&yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x4=yr&&yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C4(e,t,r);return T4(e,t),e};Object.defineProperty(yr,"__esModule",{value:!0});yr.TransactionOptions=yr.TransactionVersion=void 0;var Or=Ro(),JI=x4(He()),Na=class{constructor(e){if(e=Number(e),e<1)throw new JI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Na(Or.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new Na(Or.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};yr.TransactionVersion=Na;var Da=class{constructor(e){if(e=Number(e),e<0)throw new JI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new Da(Or.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Or.TRANSACTION_OPTIONS_TX_GUARDED),new Da(r)}isWithHashSign(){return(this.value&Or.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Or.TRANSACTION_OPTIONS_TX_GUARDED)==Or.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Or.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};yr.TransactionOptions=Da});var eS=v((Uee,ZI)=>{"use strict";c();ZI.exports=N4;function N4(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var wh=nS;wh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Oa=new Array(64),rS=new Array(123);for(Pr=0;Pr<64;)rS[Oa[Pr]=Pr<26?Pr+65:Pr<52?Pr+71:Pr<62?Pr-4:Pr-59|43]=Pr++;var Pr;wh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Oa[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Oa[u|l>>6],s[o++]=Oa[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Oa[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var tS="invalid encoding";wh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=rS[u])===void 0)throw Error(tS);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(tS);return n-i};wh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var oS=v((jee,sS)=>{"use strict";c();sS.exports=Eh;function Eh(){this._listeners={}}Eh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Eh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();hS.exports=aS(aS);function aS(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,uS),t.writeFloatBE=e.bind(null,cS);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,lS),t.readFloatBE=r.bind(null,fS)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,uS,0,4),t.writeDoubleBE=e.bind(null,cS,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,y=4294967296*(l&1048575)+u;return d===2047?y?NaN:f*(1/0):d===0?f*5e-324*y:f*Math.pow(2,d-1075)*(y+4503599627370496)}t.readDoubleLE=r.bind(null,lS,0,4),t.readDoubleBE=r.bind(null,fS,4,0)}(),t}function uS(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function cS(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function lS(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function fS(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var pS=v((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var yS=v(gS=>{"use strict";c();var Sm=gS;Sm.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Sm.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var wS=v(($ee,mS)=>{"use strict";c();mS.exports=D4;function D4(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var vS=v((Jee,ES)=>{"use strict";c();ES.exports=xt;var _c=Ei();function xt(t,e){this.lo=t>>>0,this.hi=e>>>0}var js=xt.zero=new xt(0,0);js.toNumber=function(){return 0};js.zzEncode=js.zzDecode=function(){return this};js.length=function(){return 1};var O4=xt.zeroHash="\0\0\0\0\0\0\0\0";xt.fromNumber=function(e){if(e===0)return js;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new xt(n,i)};xt.from=function(e){if(typeof e=="number")return xt.fromNumber(e);if(_c.isString(e))if(_c.Long)e=_c.Long.fromString(e);else return xt.fromNumber(parseInt(e,10));return e.low||e.high?new xt(e.low>>>0,e.high>>>0):js};xt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};xt.prototype.toLong=function(e){return _c.Long?new _c.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var wi=String.prototype.charCodeAt;xt.fromHash=function(e){return e===O4?js:new xt((wi.call(e,0)|wi.call(e,1)<<8|wi.call(e,2)<<16|wi.call(e,3)<<24)>>>0,(wi.call(e,4)|wi.call(e,5)<<8|wi.call(e,6)<<16|wi.call(e,7)<<24)>>>0)};xt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};xt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};xt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};xt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Ei=v(Cm=>{"use strict";c();var me=Cm;me.asPromise=eS();me.base64=iS();me.EventEmitter=oS();me.float=dS();me.inquire=pS();me.utf8=yS();me.pool=wS();me.LongBits=vS();me.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Cm;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};me.Buffer=function(){try{var t=me.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,r){var n=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function AS(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};me.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();CS.exports=Le;var mr=Ei(),Tm,vh=mr.LongBits,bS=mr.base64,IS=mr.utf8;function bc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Nm(){}function P4(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Le(){this.len=0,this.head=new bc(Nm,0,0),this.tail=this.head,this.states=null}var SS=function(){return mr.Buffer?function(){return(Le.create=function(){return new Tm})()}:function(){return new Le}};Le.create=SS();Le.alloc=function(e){return new mr.Array(e)};mr.Array!==Array&&(Le.alloc=mr.pool(Le.alloc,mr.Array.prototype.subarray));Le.prototype._push=function(e,r,n){return this.tail=this.tail.next=new bc(e,r,n),this.len+=r,this};function Dm(t,e,r){e[r]=t&255}function B4(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Om(t,e){this.len=t,this.next=void 0,this.val=e}Om.prototype=Object.create(bc.prototype);Om.prototype.fn=B4;Le.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Om((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Le.prototype.int32=function(e){return e<0?this._push(Pm,10,vh.fromNumber(e)):this.uint32(e)};Le.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Pm(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Le.prototype.uint64=function(e){var r=vh.from(e);return this._push(Pm,r.length(),r)};Le.prototype.int64=Le.prototype.uint64;Le.prototype.sint64=function(e){var r=vh.from(e).zzEncode();return this._push(Pm,r.length(),r)};Le.prototype.bool=function(e){return this._push(Dm,1,e?1:0)};function xm(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Le.prototype.fixed32=function(e){return this._push(xm,4,e>>>0)};Le.prototype.sfixed32=Le.prototype.fixed32;Le.prototype.fixed64=function(e){var r=vh.from(e);return this._push(xm,4,r.lo)._push(xm,4,r.hi)};Le.prototype.sfixed64=Le.prototype.fixed64;Le.prototype.float=function(e){return this._push(mr.float.writeFloatLE,4,e)};Le.prototype.double=function(e){return this._push(mr.float.writeDoubleLE,8,e)};var R4=mr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Dm,1,0);if(mr.isString(e)){var n=Le.alloc(r=bS.length(e));bS.decode(e,n,0),e=n}return this.uint32(r)._push(R4,r,e)};Le.prototype.string=function(e){var r=IS.length(e);return r?this.uint32(r)._push(IS.write,r,e):this._push(Dm,1,0)};Le.prototype.fork=function(){return this.states=new P4(this),this.head=this.tail=new bc(Nm,0,0),this.len=0,this};Le.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new bc(Nm,0,0),this.len=0),this};Le.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Le.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Le._configure=function(t){Tm=t,Le.create=SS(),Tm._configure()}});var NS=v((nte,xS)=>{"use strict";c();xS.exports=sn;var TS=Bm();(sn.prototype=Object.create(TS.prototype)).constructor=sn;var vi=Ei();function sn(){TS.call(this)}sn._configure=function(){sn.alloc=vi._Buffer_allocUnsafe,sn.writeBytesBuffer=vi.Buffer&&vi.Buffer.prototype instanceof Uint8Array&&vi.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(sn.writeBytesBuffer,r,e),this};function L4(t,e,r){t.length<40?vi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}sn.prototype.string=function(e){var r=vi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(L4,r,e),this};sn._configure()});var Fm=v((ste,RS)=>{"use strict";c();RS.exports=dt;var on=Ei(),Lm,PS=on.LongBits,F4=on.utf8;function Br(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function dt(t){this.buf=t,this.pos=0,this.len=t.length}var DS=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new dt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new dt(e);throw Error("illegal buffer")},BS=function(){return on.Buffer?function(r){return(dt.create=function(i){return on.Buffer.isBuffer(i)?new Lm(i):DS(i)})(r)}:DS};dt.create=BS();dt.prototype._slice=on.Array.prototype.subarray||on.Array.prototype.slice;dt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Br(this,10);return e}}();dt.prototype.int32=function(){return this.uint32()|0};dt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Rm(){var t=new PS(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Br(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Br(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}dt.prototype.bool=function(){return this.uint32()!==0};function Ah(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}dt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return Ah(this.buf,this.pos+=4)};dt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return Ah(this.buf,this.pos+=4)|0};function OS(){if(this.pos+8>this.len)throw Br(this,8);return new PS(Ah(this.buf,this.pos+=4),Ah(this.buf,this.pos+=4))}dt.prototype.float=function(){if(this.pos+4>this.len)throw Br(this,4);var e=on.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};dt.prototype.double=function(){if(this.pos+8>this.len)throw Br(this,4);var e=on.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};dt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Br(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};dt.prototype.string=function(){var e=this.bytes();return F4.read(e,0,e.length)};dt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Br(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Br(this);while(this.buf[this.pos++]&128);return this};dt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};dt._configure=function(t){Lm=t,dt.create=BS(),Lm._configure();var e=on.Long?"toLong":"toNumber";on.merge(dt.prototype,{int64:function(){return Rm.call(this)[e](!1)},uint64:function(){return Rm.call(this)[e](!0)},sint64:function(){return Rm.call(this).zzDecode()[e](!1)},fixed64:function(){return OS.call(this)[e](!0)},sfixed64:function(){return OS.call(this)[e](!1)}})}});var US=v((ate,MS)=>{"use strict";c();MS.exports=Gs;var FS=Fm();(Gs.prototype=Object.create(FS.prototype)).constructor=Gs;var LS=Ei();function Gs(t){FS.call(this,t)}Gs._configure=function(){LS.Buffer&&(Gs.prototype._slice=LS.Buffer.prototype.slice)};Gs.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Gs._configure()});var VS=v((cte,qS)=>{"use strict";c();qS.exports=Ic;var Mm=Ei();(Ic.prototype=Object.create(Mm.EventEmitter.prototype)).constructor=Ic;function Ic(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Mm.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Ic.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Mm.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Ic.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var jS=v(HS=>{"use strict";c();var M4=HS;M4.Service=VS()});var QS=v((dte,GS)=>{"use strict";c();GS.exports={}});var zS=v(KS=>{"use strict";c();var er=KS;er.build="minimal";er.Writer=Bm();er.BufferWriter=NS();er.Reader=Fm();er.BufferReader=US();er.util=Ei();er.rpc=jS();er.roots=QS();er.configure=kS;function kS(){er.util._configure(),er.Writer._configure(er.BufferWriter),er.Reader._configure(er.BufferReader)}kS()});var $S=v((mte,WS)=>{"use strict";c();WS.exports=zS()});var JS=v((Ete,YS)=>{"use strict";c();var Pa=$S(),_h=Pa.Reader,U4=Pa.Writer,J=Pa.util,Sc=Pa.roots.default||(Pa.roots.default={});Sc.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof _h||(n=new _h(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Sc.proto.Transaction)return n;var i=new Sc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Pa.util.toJSONOptions)},e}(),t}();YS.exports=Sc});var XS=v(wr=>{"use strict";c();var q4=wr&&wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V4=wr&&wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H4=wr&&wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q4(e,t,r);return V4(e,t),e},j4=wr&&wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wr,"__esModule",{value:!0});wr.ProtoSerializer=void 0;var G4=j4(Wt()),Um=Zt(),Q4=Ro(),k4=H4(He()),K4=Kf(),qm=class{serializeTransaction(e){let r=JS().proto,n=new Um.Address(e.getReceiver().bech32()).pubkey(),i=new Um.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==Q4.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Um.Address(u.bech32()).pubkey(),s.GuardSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return h.Buffer.from(o)}serializeTransactionValue(e){let r=new G4.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=K4.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new k4.ErrUnsupportedOperation("deserializeTransaction")}};wr.ProtoSerializer=qm});var ZS=v(Qs=>{"use strict";c();var z4=Qs&&Qs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W4=Qs&&Qs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&z4(e,t,r)};Object.defineProperty(Qs,"__esModule",{value:!0});W4(XS(),Qs)});var rC=v(an=>{"use strict";c();var $4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$4(e,t,r);return Y4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.Signature=void 0;var eC=J4(He()),tC=64,Rr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Rr.fromHex(e);if(e instanceof h.Buffer)return Rr.fromBuffer(e)}}static empty(){return new Rr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Rr.isValidHex(e))throw new eC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==tC}static fromValidHex(e){let r=new Rr;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=tC)throw new eC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};an.Signature=Rr});var Cc=v(bh=>{"use strict";c();Object.defineProperty(bh,"__esModule",{value:!0});bh.TransactionPayload=void 0;var Ba=class{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ba("");let r=h.Buffer.from(e,"base64").toString();return new Ba(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>h.Buffer.from(e,"hex"))}length(){return h.Buffer.from(this.data).length}};bh.TransactionPayload=Ba});var Vm=v((Nte,nC)=>{c();Un.notEqual=Z4;Un.notOk=eM;Un.equal=X4;Un.ok=Un;nC.exports=Un;function X4(t,e,r){Un(t==e,r)}function Z4(t,e,r){Un(t!=e,r)}function eM(t,e){Un(!t,e)}function Un(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ua=v(Ma=>{"use strict";c();var Hm=q0(),La=H0(),iC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ma.Buffer=z;Ma.SlowBuffer=oM;Ma.INSPECT_MAX_BYTES=50;var Ih=2147483647;Ma.kMaxLength=Ih;z.TYPED_ARRAY_SUPPORT=tM();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function tM(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Ih)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return km(t)}return uC(t,e,r)}z.poolSize=8192;function uC(t,e,r){if(typeof t=="string")return nM(t,e);if(ArrayBuffer.isView(t))return iM(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(un(t,ArrayBuffer)||t&&un(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(un(t,SharedArrayBuffer)||t&&un(t.buffer,SharedArrayBuffer)))return Gm(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=sM(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return uC(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function cC(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function rM(t,e,r){return cC(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return rM(t,e,r)};function km(t){return cC(t),qn(t<0?0:Km(t)|0)}z.allocUnsafe=function(t){return km(t)};z.allocUnsafeSlow=function(t){return km(t)};function nM(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=lC(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function jm(t){let e=t.length<0?0:Km(t.length)|0,r=qn(e);for(let n=0;n=Ih)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ih.toString(16)+" bytes");return t|0}function oM(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),un(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function lC(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||un(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Qm(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return EC(t).length;default:if(i)return n?-1:Qm(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=lC;function aM(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return mM(this,e,r);case"utf8":case"utf-8":return hC(this,e,r);case"ascii":return gM(this,e,r);case"latin1":case"binary":return yM(this,e,r);case"base64":return dM(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wM(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function ks(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};iC&&(z.prototype[iC]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Wm(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:sC(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):sC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function sC(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return uM(this,e,r,n);case"utf8":case"utf-8":return cM(this,e,r,n);case"ascii":case"latin1":case"binary":return lM(this,e,r,n);case"base64":return fM(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hM(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dM(t,e,r){return e===0&&r===t.length?Hm.fromByteArray(t):Hm.fromByteArray(t.slice(e,r))}function hC(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return pM(n)}var oC=4096;function pM(t){let e=t.length;if(e<=oC)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Nt(e,4,this.length),La.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),La.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!1,52,8)};function tr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function dC(t,e,r,n,i){wC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function pC(t,e,r,n,i){wC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=Ai(function(e,r=0){return dC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=Ai(function(e,r=0){return pC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=Ai(function(e,r=0){return dC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=Ai(function(e,r=0){return pC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function gC(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function yC(t,e,r,n,i){return e=+e,r=r>>>0,i||gC(t,e,r,4,34028234663852886e22,-34028234663852886e22),La.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return yC(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return yC(this,e,r,!1,n)};function mC(t,e,r,n,i){return e=+e,r=r>>>0,i||gC(t,e,r,8,17976931348623157e292,-17976931348623157e292),La.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return mC(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return mC(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=aC(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=aC(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function aC(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function EM(t,e,r){Fa(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Tc(e,t.length-(r+1))}function wC(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Ra.ERR_OUT_OF_RANGE("value",a,t)}EM(n,i,s)}function Fa(t,e){if(typeof t!="number")throw new Ra.ERR_INVALID_ARG_TYPE(e,"number",t)}function Tc(t,e,r){throw Math.floor(t)!==t?(Fa(t,r),new Ra.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ra.ERR_BUFFER_OUT_OF_BOUNDS:new Ra.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var vM=/[^+/0-9A-Za-z-_]/g;function AM(t){if(t=t.split("=")[0],t=t.trim().replace(vM,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Qm(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function _M(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function EC(t){return Hm.toByteArray(AM(t))}function Sh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function un(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Wm(t){return t!==t}var IM=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ai(t){return typeof BigInt>"u"?SM:t}function SM(){throw new Error("BigInt not supported")}});var AC=v((Rte,vC)=>{c();vC.exports=$m;$m.supported=typeof WebAssembly<"u";function $m(t){if(!$m.supported)return null;var e=t&&t.imports,r=CM("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function CM(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(TM)):new(Ua()).Buffer(t,"base64")}function TM(t){return t.charCodeAt(0)}});var xC=v((Ute,ln)=>{c();var cn=Vm(),Ke=AC()(),Vn=64,Ch=[];ln.exports=Er;var _C=ln.exports.BYTES_MIN=16,bC=ln.exports.BYTES_MAX=64,Fte=ln.exports.BYTES=32,IC=ln.exports.KEYBYTES_MIN=16,SC=ln.exports.KEYBYTES_MAX=64,Mte=ln.exports.KEYBYTES=32,CC=ln.exports.SALTBYTES=16,TC=ln.exports.PERSONALBYTES=16;function Er(t,e,r,n,i){if(!(this instanceof Er))return new Er(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(cn(t>=_C,"digestLength must be at least "+_C+", was given "+t),cn(t<=bC,"digestLength must be at most "+bC+", was given "+t),e!=null&&cn(e.length>=IC,"key must be at least "+IC+", was given "+e.length),e!=null&&cn(e.length<=SC,"key must be at least "+SC+", was given "+e.length),r!=null&&cn(r.length===CC,"salt must be exactly "+CC+", was given "+r.length),n!=null&&cn(n.length===TC,"personal must be exactly "+TC+", was given "+n.length)),Ch.length||(Ch.push(Vn),Vn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Ch.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,Vn,Vn+e.length),Ke.memory[this.pointer+200]=128)}Er.prototype.update=function(t){return cn(this.finalized===!1,"Hash instance finalized"),cn(t,"input must be TypedArray or Buffer"),Vn+t.length>Ke.memory.length&&Ke.realloc(Vn+t.length),Ke.memory.set(t,Vn),Ke.exports.blake2b_update(this.pointer,Vn,Vn+t.length),this};Er.prototype.digest=function(t){if(cn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Ch.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return NM(Ke.memory,this.pointer+128,this.digestLength);cn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ii=Vm(),Nc=xC();function Th(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function NC(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function FC(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function _i(t,e,r,n,i,s){var o=xc[i],a=xc[i+1],u=xc[s],l=xc[s+1];Th(Ie,t,e),NC(Ie,t,o,a);var f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1];Ie[n]=d,Ie[n+1]=f,Th(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=f>>>24^d<<8,Ie[e+1]=d>>>24^f<<8,Th(Ie,t,e),NC(Ie,t,u,l),f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1],Ie[n]=f>>>16^d<<16,Ie[n+1]=d>>>16^f<<16,Th(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=d>>>31^f<<1,Ie[e+1]=f>>>31^d<<1}var MC=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),OM=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Gt=new Uint8Array(OM.map(function(t){return t*2})),Ie=new Uint32Array(32),xc=new Uint32Array(32);function UC(t,e){var r=0;for(r=0;r<16;r++)Ie[r]=t.h[r],Ie[r+16]=MC[r];for(Ie[24]=Ie[24]^t.t,Ie[25]=Ie[25]^t.t/4294967296,e&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]),r=0;r<32;r++)xc[r]=FC(t.b,4*r);for(r=0;r<12;r++)_i(0,8,16,24,Gt[r*16+0],Gt[r*16+1]),_i(2,10,18,26,Gt[r*16+2],Gt[r*16+3]),_i(4,12,20,28,Gt[r*16+4],Gt[r*16+5]),_i(6,14,22,30,Gt[r*16+6],Gt[r*16+7]),_i(0,10,20,30,Gt[r*16+8],Gt[r*16+9]),_i(2,12,22,24,Gt[r*16+10],Gt[r*16+11]),_i(4,14,16,26,Gt[r*16+12],Gt[r*16+13]),_i(6,8,18,28,Gt[r*16+14],Gt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ie[r]^Ie[r+16]}var bi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function qa(t,e,r,n){bi.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,bi[0]=t,e&&(bi[1]=e.length),bi[2]=1,bi[3]=1,r&&bi.set(r,32),n&&bi.set(n,48);for(var i=0;i<16;i++)this.h[i]=MC[i]^FC(bi,i*4);e&&(qC(this,e),this.c=128)}qa.prototype.update=function(t){return Ii(t!=null,"input must be Uint8Array or Buffer"),qC(this,t),this};qa.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ii(e.length>=this.outlen,"out must have at least outlen bytes of space"),PM(this,e),t==="hex"?BM(e):e};qa.prototype.final=qa.prototype.digest;qa.ready=function(t){Nc.ready(function(){t()})};function qC(t,e){for(var r=0;r>2]>>8*(r&3);return e}function BM(t){for(var e="",r=0;r=DC,"outlen must be at least "+DC+", was given "+e),Ii(e<=OC,"outlen must be at most "+OC+", was given "+e),r!=null&&Ii(r.length>=PC,"key must be at least "+PC+", was given "+r.length),r!=null&&Ii(r.length<=BC,"key must be at most "+BC+", was given "+r.length),n!=null&&Ii(n.length===RC,"salt must be exactly "+RC+", was given "+n.length),i!=null&&Ii(i.length===LC,"personal must be exactly "+LC+", was given "+i.length)),new VC(e,r,n,i)};rr.exports.ready=function(t){Nc.ready(function(){t()})};rr.exports.WASM_SUPPORTED=Nc.SUPPORTED;rr.exports.WASM_LOADED=!1;var DC=rr.exports.BYTES_MIN=16,OC=rr.exports.BYTES_MAX=64,Vte=rr.exports.BYTES=32,PC=rr.exports.KEYBYTES_MIN=16,BC=rr.exports.KEYBYTES_MAX=64,Hte=rr.exports.KEYBYTES=32,RC=rr.exports.SALTBYTES=16,LC=rr.exports.PERSONALBYTES=16;Nc.ready(function(t){t||(rr.exports.WASM_LOADED=!0,VC=Nc)})});var Pc=v(vr=>{"use strict";c();var LM=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FM=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MM=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LM(e,t,r);return FM(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.TransactionHash=vr.Transaction=void 0;var Va=Wt(),Dc=Zt(),UM=mh(),qM=Ro(),VM=MM(He()),HM=YI(),Hn=XI(),jM=ZS(),jC=rC(),GC=Cc(),GM=fr(),QM=HC(),kM=32,Oc=class{constructor({nonce:e,value:r,receiver:n,sender:i,gasPrice:s,gasLimit:o,data:a,chainID:u,version:l,options:f,guardian:d}){this.nonce=e||0,this.value=r?new Va.BigNumber(r.toString()).toFixed(0):0,this.sender=i,this.receiver=n,this.gasPrice=s||qM.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new GC.TransactionPayload,this.chainID=u,this.version=l?new Hn.TransactionVersion(l.valueOf()):Hn.TransactionVersion.withDefaultVersion(),this.options=f?new Hn.TransactionOptions(f.valueOf()):Hn.TransactionOptions.withDefaultOptions(),this.guardian=d||Dc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Si.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new Hn.TransactionVersion(e.valueOf())}getOptions(){return new Hn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new Hn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return GM.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return UM.Compatibility.guardAddressIsSetAndNonZero(new Dc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new Oc({nonce:Number(e.nonce),value:new Va.BigNumber(e.value).toFixed(0),receiver:Dc.Address.fromString(e.receiver),sender:Dc.Address.fromString(e.sender),guardian:e.guardian==null?void 0:Dc.Address.fromString(e.guardian||""),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new GC.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Hn.TransactionVersion(e.version),options:e.options==null?void 0:new Hn.TransactionOptions(e.options)});return e.signature&&r.applySignature(new jC.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new jC.Signature(e.guardianSignature)),r}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}applyGuardianSignature(e){e instanceof h.Buffer?this.guardianSignature=e:this.guardianSignature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new VM.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new Va.BigNumber(this.gasPrice.valueOf()),i=new Va.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new Va.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new Va.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};vr.Transaction=Oc;var Si=class extends HM.Hash{constructor(e){super(e)}static compute(e){let n=new jM.ProtoSerializer().serializeTransaction(e),i=QM(kM).update(n).digest("hex");return new Si(i)}};vr.TransactionHash=Si});var QC=v(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TransferTransactionsFactory=void 0;var Ym=ph(),Lr=Tt(),xh=Pc(),Jm=Cc(),Xm=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new xh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new Ym.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Jm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new xh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new Ym.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.U64Value(e.tokenTransfer.nonce),new Lr.BigUIntValue(e.tokenTransfer.valueOf()),new Lr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Jm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new xh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new Lr.AddressValue(e.destination),new Lr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Lr.BytesValue.fromUTF8(u.tokenIdentifier),new Lr.U64Value(u.nonce),new Lr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Ym.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Jm.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new xh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Nh.TransferTransactionsFactory=Xm});var KC=v(Ks=>{"use strict";c();Object.defineProperty(Ks,"__esModule",{value:!0});Ks.GasEstimator=Ks.DefaultGasConfiguration=void 0;Ks.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var KM=1e5,kC=8e5,Zm=class{constructor(e){this.gasConfiguration=e||Ks.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+KM}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+kC}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+kC)*r+this.gasConfiguration.gasPerDataByte*e}};Ks.GasEstimator=Zm});var Oh=v(Dh=>{"use strict";c();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.Account=void 0;var zM=Zt(),ew=class{constructor(e){this.address=new zM.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};Dh.Account=ew});var tw=v(Ws=>{"use strict";c();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Logger=Ws.LogLevel=void 0;var zs;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(zs=Ws.LogLevel||(Ws.LogLevel={}));var Fr=class{static setLevel(e){Fr.logLevel=e}static trace(e,...r){Fr.logLevel>=zs.Debug||console.debug(e,r)}static debug(e,...r){Fr.logLevel>=zs.Debug||console.debug(e,r)}static info(e,...r){Fr.logLevel>=zs.Info||console.log(e,r)}static warn(e,...r){Fr.logLevel>=zs.Warn||console.warn(e,r)}static error(e,...r){Fr.logLevel>=zs.Error||console.error(e,r)}};Ws.Logger=Fr;Fr.logLevel=zs.Debug});var zC=v(fn=>{"use strict";c();var WM=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$M=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YM=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WM(e,t,r);return $M(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.AsyncTimer=void 0;var JM=YM(He()),XM=He(),rw=tw(),nw=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new JM.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,rw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){rw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new XM.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(rw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};fn.AsyncTimer=nw});var ow=v(ja=>{"use strict";c();var Ar=ja&&ja.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ja,"__esModule",{value:!0});ja.TransactionWatcher=void 0;var iw=zC(),Ha=He(),WC=tw(),_r=class{constructor(e,r={}){this.fetcher=new sw(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||_r.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||_r.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||_r.DefaultPatience}awaitPending(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ha.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ha.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ha.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ha.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Ar(this,void 0,void 0,function*(){let n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ha.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Ar(this,void 0,void 0,function*(){let i=new iw.AsyncTimer("watcher:periodic"),s=new iw.AsyncTimer("watcher:patience"),o=new iw.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(WC.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Ha.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};ja.TransactionWatcher=_r;_r.DefaultPollingInterval=6e3;_r.DefaultTimeout=_r.DefaultPollingInterval*15;_r.DefaultPatience=0;_r.NoopOnStatusReceived=t=>{};var sw=class{constructor(e){this.fetcher=e}getTransaction(e){return Ar(this,void 0,void 0,function*(){return WC.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var $C=v(Rh=>{"use strict";c();Object.defineProperty(Rh,"__esModule",{value:!0});Rh.CodeMetadata=void 0;var aw=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=Ph.Upgradeable),this.readable&&(e|=Ph.Readable),this.payable&&(r|=Bh.Payable),this.payableBySc&&(r|=Bh.PayableBySc),h.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};Rh.CodeMetadata=aw;var Ph;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(Ph||(Ph={}));var Bh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Bh||(Bh={}))});var Lh=v(hn=>{"use strict";c();var ZM=hn&&hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eU=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tU=hn&&hn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZM(e,t,r);return eU(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.ContractFunction=void 0;var rU=tU(He()),Bc=class{constructor(e){if(this.name=e,e==null)throw new rU.ErrInvalidFunctionName}static none(){return new Bc("untitled")}toString(){return this.name}valueOf(){return this.name}};hn.ContractFunction=Bc});var YC=v(br=>{"use strict";c();var nU=br&&br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iU=br&&br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sU=br&&br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nU(e,t,r);return iU(e,t),e},oU=br&&br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(br,"__esModule",{value:!0});br.InteractionChecker=void 0;var uw=sU(He()),aU=oU(Wt()),cw=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new aU.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new uw.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new uw.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(Fh,"__esModule",{value:!0});Fh.Query=void 0;var uU=Zt(),cU=ph(),lw=class{constructor(e){this.caller=e.caller||new uU.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new cU.ArgSerializer().valuesToStrings(this.args)}};Fh.Query=lw});var XC=v(Uh=>{"use strict";c();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.Interaction=void 0;var JC=Zt(),lU=mh(),fw=Ro(),hw=Lh(),fU=YC(),hU=Mh(),Ga=Tt(),dw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new JC.Address,this.sender=new JC.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new Qa([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){lU.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new hw.ContractFunction(fw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new hw.ContractFunction(fw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new hw.ContractFunction(fw.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new hU.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new Qa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new Qa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new Qa(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new fU.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Uh.Interaction=dw;var Qa=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new Ga.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Ga.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Ga.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Ga.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Ga.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Ga.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var ZC=v(qh=>{"use strict";c();Object.defineProperty(qh,"__esModule",{value:!0});qh.ArgumentErrorContext=void 0;var dU=He(),pw=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new dU.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) +Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};qh.ArgumentErrorContext=pw});var tT=v($s=>{"use strict";c();var pU=$s&&$s.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($s,"__esModule",{value:!0});$s.NativeSerializer=void 0;var gU=pU(Wt()),yU=Zt(),eT=He(),mU=tm(),wU=ZC(),_e=Tt(),EU;(function(t){function e(_,B){_=_||[],_=r(_,B);let x=B.input,O=[];for(let P=0;P0&&B[0].type.getCardinality().isComposite()&&(O=1/0,P=!0);for(let L of B){if(L.type.getCardinality().isSingular())break;x-=1}return{min:x,max:O,variadic:P}}function i(_,B,x){if(_&&_.belongsToTypesystem)return _;if(B instanceof _e.OptionType)return s(_,B,x);if(B instanceof _e.OptionalType)return o(_,B,x);if(B instanceof _e.VariadicType)return a(_,B,x);if(B instanceof _e.CompositeType)return l(_,B,x);if(B instanceof _e.TupleType)return f(_,B,x);if(B instanceof _e.StructType)return d(_,B,x);if(B instanceof _e.ListType)return u(_,B,x);if(B instanceof _e.PrimitiveType)return y(_,B,x);x.throwError(`convertToTypedValue: unhandled type ${B}`)}function s(_,B,x){if(_==null)return _e.OptionValue.newMissing();let O=i(_,B.getFirstTypeParameter(),x);return _e.OptionValue.newProvided(O)}function o(_,B,x){if(_==null)return new _e.OptionalValue(B);let O=i(_,B.getFirstTypeParameter(),x);return new _e.OptionalValue(B,O)}function a(_,B,x){_==null&&(_=[]),_.map===void 0&&x.convertError(_,"Variadic");let O=_.map(function(P){return i(P,B.getFirstTypeParameter(),x)});return new _e.VariadicValue(B,O)}function u(_,B,x){_.map===void 0&&x.convertError(_,"List");let O=_.map(function(P){return i(P,B.getFirstTypeParameter(),x)});return new _e.List(B,O)}function l(_,B,x){let O=[],P=B.getTypeParameters();x.guardSameLength(_,P);for(let L=0;L{"use strict";c();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.ContractCallPayloadBuilder=Mr.ContractUpgradePayloadBuilder=Mr.ContractDeployPayloadBuilder=Mr.ArwenVirtualMachine=void 0;var ww=Cc(),Ew=fr(),vU=ph();Mr.ArwenVirtualMachine="0500";var gw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Ew.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Mr.ArwenVirtualMachine}@${r}`;return n=vw(n,this.arguments),new ww.TransactionPayload(n)}};Mr.ContractDeployPayloadBuilder=gw;var yw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Ew.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=vw(n,this.arguments),new ww.TransactionPayload(n)}};Mr.ContractUpgradePayloadBuilder=yw;var mw=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){Ew.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=vw(e,this.arguments),new ww.TransactionPayload(e)}};Mr.ContractCallPayloadBuilder=mw;function vw(t,e){let{argumentsString:r,count:n}=new vU.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var jn=v((vre,Aw)=>{"use strict";c();var ka=typeof Reflect=="object"?Reflect:null,nT=ka&&typeof ka.apply=="function"?ka.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Vh;ka&&typeof ka.ownKeys=="function"?Vh=ka.ownKeys:Object.getOwnPropertySymbols?Vh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Vh=function(e){return Object.getOwnPropertyNames(e)};function AU(t){console&&console.warn&&console.warn(t)}var sT=Number.isNaN||function(e){return e!==e};function je(){je.init.call(this)}Aw.exports=je;Aw.exports.once=SU;je.EventEmitter=je;je.prototype._events=void 0;je.prototype._eventsCount=0;je.prototype._maxListeners=void 0;var iT=10;function Hh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(je,"defaultMaxListeners",{enumerable:!0,get:function(){return iT},set:function(t){if(typeof t!="number"||t<0||sT(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");iT=t}});je.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};je.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||sT(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function oT(t){return t._maxListeners===void 0?je.defaultMaxListeners:t._maxListeners}je.prototype.getMaxListeners=function(){return oT(this)};je.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")nT(u,this,r);else for(var l=u.length,f=fT(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,AU(a)}return t}je.prototype.addListener=function(e,r){return aT(this,e,r,!1)};je.prototype.on=je.prototype.addListener;je.prototype.prependListener=function(e,r){return aT(this,e,r,!0)};function _U(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function uT(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=_U.bind(n);return i.listener=r,n.wrapFn=i,i}je.prototype.once=function(e,r){return Hh(r),this.on(e,uT(this,e,r)),this};je.prototype.prependOnceListener=function(e,r){return Hh(r),this.prependListener(e,uT(this,e,r)),this};je.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Hh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():bU(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};je.prototype.off=je.prototype.removeListener;je.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function cT(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?IU(i):fT(i,i.length)}je.prototype.listeners=function(e){return cT(this,e,!0)};je.prototype.rawListeners=function(e){return cT(this,e,!1)};je.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):lT.call(t,e)};je.prototype.listenerCount=lT;function lT(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}je.prototype.eventNames=function(){return this._eventsCount>0?Vh(this._events):[]};function fT(t,e){for(var r=new Array(e),n=0;n{c();dT.exports=jn().EventEmitter});var bw=v(()=>{c()});var ET=v((Tre,wT)=>{"use strict";c();function pT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function gT(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return jh.alloc(0);for(var n=jh.allocUnsafe(r>>>0),i=this.head,s=0;i;)RU(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=jh.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:BU,value:function(r,n){return Iw(this,gT(gT({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var Cw=v((Nre,AT)=>{"use strict";c();function LU(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(Sw,this,t)):p.default.nextTick(Sw,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(Gh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(vT,r,s)):p.default.nextTick(vT,r,s):e?(p.default.nextTick(Gh,r),e(s)):p.default.nextTick(Gh,r)}),this)}function vT(t,e){Sw(t,e),Gh(t)}function Gh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function FU(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Sw(t,e){t.emit("error",e)}function MU(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}AT.exports={destroy:LU,undestroy:FU,errorOrDestroy:MU}});var Ys=v((Ore,IT)=>{"use strict";c();function UU(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var bT={};function Ir(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){UU(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,bT[t]=i}function _T(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function qU(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function VU(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function HU(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Ir("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ir("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&qU(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(VU(t," argument"))i="The ".concat(t," ").concat(n," ").concat(_T(e,"type"));else{var s=HU(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(_T(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Ir("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ir("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ir("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ir("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ir("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ir("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ir("ERR_STREAM_WRITE_AFTER_END","write after end");Ir("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ir("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ir("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");IT.exports.codes=bT});var Tw=v((Bre,ST)=>{"use strict";c();var jU=Ys().codes.ERR_INVALID_OPT_VALUE;function GU(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function QU(t,e,r,n){var i=GU(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new jU(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}ST.exports={getHighWaterMark:QU}});var Ka=v((Lre,xw)=>{c();typeof Object.create=="function"?xw.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:xw.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var TT=v((Mre,CT)=>{c();CT.exports=kU;function kU(t,e){if(Nw("noDeprecation"))return t;var r=!1;function n(){if(!r){if(Nw("throwDeprecation"))throw new Error(e);Nw("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function Nw(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var Pw=v((qre,BT)=>{"use strict";c();BT.exports=ut;function NT(t){var e=this;this.next=null,this.entry=null,this.finish=function(){wq(e,t)}}var za;ut.WritableState=Lc;var KU={deprecate:TT()},DT=_w(),kh=Ua().Buffer,zU=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function WU(t){return kh.from(t)}function $U(t){return kh.isBuffer(t)||t instanceof zU}var Ow=Cw(),YU=Tw(),JU=YU.getHighWaterMark,Ci=Ys().codes,XU=Ci.ERR_INVALID_ARG_TYPE,ZU=Ci.ERR_METHOD_NOT_IMPLEMENTED,eq=Ci.ERR_MULTIPLE_CALLBACK,tq=Ci.ERR_STREAM_CANNOT_PIPE,rq=Ci.ERR_STREAM_DESTROYED,nq=Ci.ERR_STREAM_NULL_VALUES,iq=Ci.ERR_STREAM_WRITE_AFTER_END,sq=Ci.ERR_UNKNOWN_ENCODING,Wa=Ow.errorOrDestroy;Ka()(ut,DT);function oq(){}function Lc(t,e,r){za=za||Js(),t=t||{},typeof r!="boolean"&&(r=e instanceof za),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=JU(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){dq(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new NT(this)}Lc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Lc.prototype,"buffer",{get:KU.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Qh;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Qh=Function.prototype[Symbol.hasInstance],Object.defineProperty(ut,Symbol.hasInstance,{value:function(e){return Qh.call(this,e)?!0:this!==ut?!1:e&&e._writableState instanceof Lc}})):Qh=function(e){return e instanceof this};function ut(t){za=za||Js();var e=this instanceof za;if(!e&&!Qh.call(ut,this))return new ut(t);this._writableState=new Lc(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),DT.call(this)}ut.prototype.pipe=function(){Wa(this,new tq)};function aq(t,e){var r=new iq;Wa(t,r),p.default.nextTick(e,r)}function uq(t,e,r,n){var i;return r===null?i=new nq:typeof r!="string"&&!e.objectMode&&(i=new XU("chunk",["string","Buffer"],r)),i?(Wa(t,i),p.default.nextTick(n,i),!1):!0}ut.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&$U(t);return s&&!kh.isBuffer(t)&&(t=WU(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=oq),n.ending?aq(this,r):(s||uq(this,n,t,r))&&(n.pendingcb++,i=lq(this,n,s,t,e,r)),i};ut.prototype.cork=function(){this._writableState.corked++};ut.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&OT(this,t))};ut.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new sq(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ut.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function cq(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=kh.from(e,r)),e}Object.defineProperty(ut.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function lq(t,e,r,n,i,s){if(!r){var o=cq(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var Eq=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};LT.exports=dn;var RT=Lw(),Rw=Pw();Ka()(dn,RT);for(Bw=Eq(Rw.prototype),Kh=0;Kh{c();var Wh=Ua(),pn=Wh.Buffer;function FT(t,e){for(var r in t)e[r]=t[r]}pn.from&&pn.alloc&&pn.allocUnsafe&&pn.allocUnsafeSlow?MT.exports=Wh:(FT(Wh,Fw),Fw.Buffer=Xs);function Xs(t,e,r){return pn(t,e,r)}Xs.prototype=Object.create(pn.prototype);FT(pn,Xs);Xs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return pn(t,e,r)};Xs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=pn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Xs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return pn(t)};Xs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Wh.SlowBuffer(t)}});var qw=v(VT=>{"use strict";c();var Uw=UT().Buffer,qT=Uw.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _q(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function bq(t){var e=_q(t);if(typeof e!="string"&&(Uw.isEncoding===qT||!qT(t)))throw new Error("Unknown encoding: "+t);return e||t}VT.StringDecoder=Fc;function Fc(t){this.encoding=bq(t);var e;switch(this.encoding){case"utf16le":this.text=Nq,this.end=Dq,e=4;break;case"utf8":this.fillLast=Cq,e=4;break;case"base64":this.text=Oq,this.end=Pq,e=3;break;default:this.write=Bq,this.end=Rq;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Uw.allocUnsafe(e)}Fc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Iq(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Sq(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Cq(t){var e=this.lastTotal-this.lastNeed,r=Sq(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Tq(t,e){var r=Iq(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function xq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Nq(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Dq(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Oq(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Pq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Bq(t){return t.toString(this.encoding)}function Rq(t){return t&&t.length?this.write(t):""}});var $h=v((Kre,GT)=>{"use strict";c();var HT=Ys().codes.ERR_STREAM_PREMATURE_CLOSE;function Lq(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var Yh;function Ti(t,e,r){return e=Uq(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Uq(t){var e=qq(t,"string");return typeof e=="symbol"?e:String(e)}function qq(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vq=$h(),xi=Symbol("lastResolve"),Zs=Symbol("lastReject"),Mc=Symbol("error"),Jh=Symbol("ended"),eo=Symbol("lastPromise"),Vw=Symbol("handlePromise"),to=Symbol("stream");function Ni(t,e){return{value:t,done:e}}function Hq(t){var e=t[xi];if(e!==null){var r=t[to].read();r!==null&&(t[eo]=null,t[xi]=null,t[Zs]=null,e(Ni(r,!1)))}}function jq(t){p.default.nextTick(Hq,t)}function Gq(t,e){return function(r,n){t.then(function(){if(e[Jh]){r(Ni(void 0,!0));return}e[Vw](r,n)},n)}}var Qq=Object.getPrototypeOf(function(){}),kq=Object.setPrototypeOf((Yh={get stream(){return this[to]},next:function(){var e=this,r=this[Mc];if(r!==null)return Promise.reject(r);if(this[Jh])return Promise.resolve(Ni(void 0,!0));if(this[to].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Mc]?a(e[Mc]):o(Ni(void 0,!0))})});var n=this[eo],i;if(n)i=new Promise(Gq(n,this));else{var s=this[to].read();if(s!==null)return Promise.resolve(Ni(s,!1));i=new Promise(this[Vw])}return this[eo]=i,i}},Ti(Yh,Symbol.asyncIterator,function(){return this}),Ti(Yh,"return",function(){var e=this;return new Promise(function(r,n){e[to].destroy(null,function(i){if(i){n(i);return}r(Ni(void 0,!0))})})}),Yh),Qq),Kq=function(e){var r,n=Object.create(kq,(r={},Ti(r,to,{value:e,writable:!0}),Ti(r,xi,{value:null,writable:!0}),Ti(r,Zs,{value:null,writable:!0}),Ti(r,Mc,{value:null,writable:!0}),Ti(r,Jh,{value:e._readableState.endEmitted,writable:!0}),Ti(r,Vw,{value:function(s,o){var a=n[to].read();a?(n[eo]=null,n[xi]=null,n[Zs]=null,s(Ni(a,!1))):(n[xi]=s,n[Zs]=o)},writable:!0}),r));return n[eo]=null,Vq(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Zs];s!==null&&(n[eo]=null,n[xi]=null,n[Zs]=null,s(i)),n[Mc]=i;return}var o=n[xi];o!==null&&(n[eo]=null,n[xi]=null,n[Zs]=null,o(Ni(void 0,!0))),n[Jh]=!0}),e.on("readable",jq.bind(null,n)),n};QT.exports=Kq});var zT=v((Yre,KT)=>{c();KT.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Lw=v((Zre,nx)=>{"use strict";c();nx.exports=Fe;var $a;Fe.ReadableState=JT;var Xre=jn().EventEmitter,YT=function(e,r){return e.listeners(r).length},qc=_w(),Xh=Ua().Buffer,zq=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Wq(t){return Xh.from(t)}function $q(t){return Xh.isBuffer(t)||t instanceof zq}var Hw=bw(),xe;Hw&&Hw.debuglog?xe=Hw.debuglog("stream"):xe=function(){};var Yq=ET(),Ww=Cw(),Jq=Tw(),Xq=Jq.getHighWaterMark,Zh=Ys().codes,Zq=Zh.ERR_INVALID_ARG_TYPE,eV=Zh.ERR_STREAM_PUSH_AFTER_EOF,tV=Zh.ERR_METHOD_NOT_IMPLEMENTED,rV=Zh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ya,jw,Gw;Ka()(Fe,qc);var Uc=Ww.errorOrDestroy,Qw=["error","close","destroy","pause","resume"];function nV(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function JT(t,e,r){$a=$a||Js(),t=t||{},typeof r!="boolean"&&(r=e instanceof $a),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Xq(this,t,"readableHighWaterMark",r),this.buffer=new Yq,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Ya||(Ya=qw().StringDecoder),this.decoder=new Ya(t.encoding),this.encoding=t.encoding)}function Fe(t){if($a=$a||Js(),!(this instanceof Fe))return new Fe(t);var e=this instanceof $a;this._readableState=new JT(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),qc.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=Ww.destroy;Fe.prototype._undestroy=Ww.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Xh.from(t,e),e=""),n=!0),XT(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return XT(this,t,null,!0,!1)};function XT(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,oV(t,s);else{var o;if(i||(o=iV(s,e)),o)Uc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Xh.prototype&&(e=Wq(e)),n)s.endEmitted?Uc(t,new rV):kw(t,s,e,!0);else if(s.ended)Uc(t,new eV);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?kw(t,s,e,!1):zw(t,s)):kw(t,s,e,!1)}else n||(s.reading=!1,zw(t,s))}return!s.ended&&(s.length=WT?t=WT:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function $T(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=sV(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Kw(this):ed(this),null;if(t=$T(t,e),t===0&&e.ended)return e.length===0&&Kw(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=tx(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Kw(this)),i!==null&&this.emit("data",i),i};function oV(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ed(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,ZT(t)))}}function ed(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(ZT,t))}function ZT(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,$w(t)}function zw(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(aV,t,e))}function aV(t,e){for(;!e.reading&&!e.ended&&(e.length1&&rx(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function y(R){xe("onerror",R),T(),t.removeListener("error",y),YT(t,"error")===0&&Uc(t,R)}nV(t,"error",y);function w(){t.removeListener("finish",E),T()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),T()}t.once("finish",E);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function uV(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&YT(t,"data")&&(r.flowing=!0,$w(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?ed(this):n.reading||p.default.nextTick(cV,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=qc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(ex,this),r};Fe.prototype.removeAllListeners=function(t){var e=qc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(ex,this),e};function ex(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function cV(t){xe("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,lV(this,t)),t.paused=!1,this};function lV(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(fV,t,e))}function fV(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),$w(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function $w(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Kw(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(hV,e,t))}function hV(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return Gw===void 0&&(Gw=zT()),Gw(Fe,t,e)});function rx(t,e){for(var r=0,n=t.length;r{"use strict";c();sx.exports=Gn;var td=Ys().codes,dV=td.ERR_METHOD_NOT_IMPLEMENTED,pV=td.ERR_MULTIPLE_CALLBACK,gV=td.ERR_TRANSFORM_ALREADY_TRANSFORMING,yV=td.ERR_TRANSFORM_WITH_LENGTH_0,rd=Js();Ka()(Gn,rd);function mV(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new pV);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();ax.exports=Vc;var ox=Yw();Ka()(Vc,ox);function Vc(t){if(!(this instanceof Vc))return new Vc(t);ox.call(this,t)}Vc.prototype._transform=function(t,e,r){r(null,t)}});var dx=v((sne,hx)=>{"use strict";c();var Jw;function EV(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var fx=Ys().codes,vV=fx.ERR_MISSING_ARGS,AV=fx.ERR_STREAM_DESTROYED;function cx(t){if(t)throw t}function _V(t){return t.setHeader&&typeof t.abort=="function"}function bV(t,e,r,n){n=EV(n);var i=!1;t.on("close",function(){i=!0}),Jw===void 0&&(Jw=$h()),Jw(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,_V(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new AV("pipe"))}}}function lx(t){t()}function IV(t,e){return t.pipe(e)}function SV(t){return!t.length||typeof t[t.length-1]!="function"?cx:t.pop()}function CV(){for(var t=arguments.length,e=new Array(t),r=0;r0;return bV(o,u,l,function(f){i||(i=f),f&&s.forEach(lx),!u&&(s.forEach(lx),n(i))})});return e.reduce(IV)}hx.exports=CV});var Xw=v((Sr,px)=>{c();Sr=px.exports=Lw();Sr.Stream=Sr;Sr.Readable=Sr;Sr.Writable=Pw();Sr.Duplex=Js();Sr.Transform=Yw();Sr.PassThrough=ux();Sr.finished=$h();Sr.pipeline=dx()});var mx=v((une,yx)=>{c();var{Transform:TV}=Xw();yx.exports=t=>class gx extends TV{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new gx(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var vx=v((lne,Ex)=>{c();var{Transform:xV}=Xw();Ex.exports=t=>class wx extends xV{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new wx(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _x=v((hne,Ax)=>{c();var NV=mx(),DV=vx();Ax.exports=function(t){let e=NV(t),r=DV(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var Sx=v(Ix=>{c();var bx=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Ix.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],y=f^(i<<1|s>>>31),w=d^(s<<1|i>>>31),E=t[0]^y,T=t[1]^w,R=t[10]^y,_=t[11]^w,B=t[20]^y,x=t[21]^w,O=t[30]^y,P=t[31]^w,L=t[40]^y,b=t[41]^w;y=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let C=t[2]^y,M=t[3]^w,Z=t[12]^y,K=t[13]^w,j=t[22]^y,G=t[23]^w,$=t[32]^y,de=t[33]^w,ae=t[42]^y,re=t[43]^w;y=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^y,ie=t[5]^w,te=t[14]^y,ne=t[15]^w,q=t[24]^y,ce=t[25]^w,oe=t[34]^y,le=t[35]^w,se=t[44]^y,ue=t[45]^w;y=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let g=t[6]^y,m=t[7]^w,A=t[16]^y,D=t[17]^w,I=t[26]^y,N=t[27]^w,F=t[36]^y,S=t[37]^w,U=t[46]^y,H=t[47]^w;y=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let V=t[8]^y,X=t[9]^w,ye=t[18]^y,we=t[19]^w,Pe=t[28]^y,$e=t[29]^w,ot=t[38]^y,De=t[39]^w,Me=t[48]^y,vt=t[49]^w,ni=E,us=T,cs=_<<4|R>>>28,Yt=R<<4|_>>>28,Dn=B<<3|x>>>29,qt=x<<3|B>>>29,At=P<<9|O>>>23,Qe=O<<9|P>>>23,Yg=L<<18|b>>>14,Jg=b<<18|L>>>14,Xg=C<<1|M>>>31,Zg=M<<1|C>>>31,e0=K<<12|Z>>>20,t0=Z<<12|K>>>20,r0=j<<10|G>>>22,n0=G<<10|j>>>22,i0=de<<13|$>>>19,s0=$<<13|de>>>19,o0=ae<<2|re>>>30,a0=re<<2|ae>>>30,u0=ie<<30|Y>>>2,c0=Y<<30|ie>>>2,l0=te<<6|ne>>>26,f0=ne<<6|te>>>26,h0=ce<<11|q>>>21,d0=q<<11|ce>>>21,p0=oe<<15|le>>>17,g0=le<<15|oe>>>17,y0=ue<<29|se>>>3,m0=se<<29|ue>>>3,w0=g<<28|m>>>4,E0=m<<28|g>>>4,v0=D<<23|A>>>9,A0=A<<23|D>>>9,_0=I<<25|N>>>7,b0=N<<25|I>>>7,I0=F<<21|S>>>11,S0=S<<21|F>>>11,C0=H<<24|U>>>8,T0=U<<24|H>>>8,x0=V<<27|X>>>5,N0=X<<27|V>>>5,D0=ye<<20|we>>>12,O0=we<<20|ye>>>12,P0=$e<<7|Pe>>>25,B0=Pe<<7|$e>>>25,R0=ot<<8|De>>>24,L0=De<<8|ot>>>24,F0=Me<<14|vt>>>18,M0=vt<<14|Me>>>18;t[0]=ni^~e0&h0,t[1]=us^~t0&d0,t[10]=w0^~D0&Dn,t[11]=E0^~O0&qt,t[20]=Xg^~l0&_0,t[21]=Zg^~f0&b0,t[30]=x0^~cs&r0,t[31]=N0^~Yt&n0,t[40]=u0^~v0&P0,t[41]=c0^~A0&B0,t[2]=e0^~h0&I0,t[3]=t0^~d0&S0,t[12]=D0^~Dn&i0,t[13]=O0^~qt&s0,t[22]=l0^~_0&R0,t[23]=f0^~b0&L0,t[32]=cs^~r0&p0,t[33]=Yt^~n0&g0,t[42]=v0^~P0&At,t[43]=A0^~B0&Qe,t[4]=h0^~I0&F0,t[5]=d0^~S0&M0,t[14]=Dn^~i0&y0,t[15]=qt^~s0&m0,t[24]=_0^~R0&Yg,t[25]=b0^~L0&Jg,t[34]=r0^~p0&C0,t[35]=n0^~g0&T0,t[44]=P0^~At&o0,t[45]=B0^~Qe&a0,t[6]=I0^~F0&ni,t[7]=S0^~M0&us,t[16]=i0^~y0&w0,t[17]=s0^~m0&E0,t[26]=R0^~Yg&Xg,t[27]=L0^~Jg&Zg,t[36]=p0^~C0&x0,t[37]=g0^~T0&N0,t[46]=At^~o0&u0,t[47]=Qe^~a0&c0,t[8]=F0^~ni&e0,t[9]=M0^~us&t0,t[18]=y0^~w0&D0,t[19]=m0^~E0&O0,t[28]=Yg^~Xg&l0,t[29]=Jg^~Zg&f0,t[38]=C0^~x0&cs,t[39]=T0^~N0&Yt,t[48]=o0^~u0&v0,t[49]=a0^~c0&A0,t[0]^=bx[e*2],t[1]^=bx[e*2+1]}}});var Tx=v((yne,Cx)=>{c();var nd=Sx();function Ja(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Ja.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};Ja.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(nd.p1600(this.state),this.count=0);return e};Ja.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};Cx.exports=Ja});var Nx=v((wne,xx)=>{c();xx.exports=_x()(Tx())});var Bx=v(Xa=>{"use strict";c();var OV=Xa&&Xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xa,"__esModule",{value:!0});Xa.SmartContract=void 0;var PV=OV(Wt()),Hc=Zt(),Zw=mh(),BV=He(),eE=Pc(),RV=fr(),LV=Kf(),Dx=$C(),Ox=Lh(),Px=XC(),FV=tT(),MV=Mh(),id=rT(),UV=Nx(),tE=class{constructor(e={}){this.address=new Hc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Hc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new Ox.ContractFunction(i);return new Px.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new Ox.ContractFunction(i),a=FV.NativeSerializer.nativeToTypedValues(s||[],n);return new Px.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return RV.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){Zw.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new Dx.CodeMetadata,i=i||[],s=s||0;let l=new id.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new eE.Transaction({receiver:Hc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){Zw.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new Dx.CodeMetadata,i=i||[],s=s||0;let l=new id.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new eE.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){Zw.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new id.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new eE.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new MV.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new BV.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Hc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new PV.default(r.valueOf().toString(10)),u=LV.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=UV("keccak256").update(l).digest(),d=h.Buffer.from(id.ArwenVirtualMachine,"hex"),y=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Hc.Address(y)}};Xa.SmartContract=tE});var Rx=v(Za=>{"use strict";c();Object.defineProperty(Za,"__esModule",{value:!0});Za.Signature=Za.Address=void 0;var rE=class{constructor(e){this.value=e}bech32(){return this.value}};Za.Address=rE;var nE=class{constructor(e){this.value=e}hex(){return this.value}};Za.Signature=nE});var Lx=v(jc=>{"use strict";c();Object.defineProperty(jc,"__esModule",{value:!0});jc.Operation=void 0;var qV;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(qV=jc.Operation||(jc.Operation={}))});var Fx=v(Di=>{"use strict";c();Object.defineProperty(Di,"__esModule",{value:!0});Di.ErrAccountNotConnected=Di.ErrCannotSignSingleTransaction=Di.Err=void 0;var Gc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Di.Err=Gc;var iE=class extends Gc{constructor(){super("Cannot sign single transaction.")}};Di.ErrCannotSignSingleTransaction=iE;var sE=class extends Gc{constructor(){super("Account is not connected.")}};Di.ErrAccountNotConnected=sE});var oE=v(eu=>{"use strict";c();var Oi=eu&&eu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(eu,"__esModule",{value:!0});eu.ExtensionProvider=void 0;var sd=Rx(),Qc=Lx(),Mx=Fx(),gn=class{constructor(){if(this.account={address:""},this.initialized=!1,gn._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");gn._instance=this}static getInstance(){return gn._instance}setAddress(e){return this.account.address=e,gn._instance}init(){return Oi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Qc.Operation.Connect,n),this.account.address})}logout(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Qc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Oi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new Mx.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new Mx.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Qc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{for(let n=0;n{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};eu.ExtensionProvider=gn;gn._instance=new gn});var Gx=v((qne,jx)=>{"use strict";c();function VV(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}jx.exports=HV;function HV(t,e,r){var n=r&&r.stringify||VV,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var Qx=Gx();zx.exports=mn;var kc=JV().console||{},jV={mapHttpRequest:ld,mapHttpResponse:ld,wrapRequestSerializer:aE,wrapResponseSerializer:aE,wrapErrorSerializer:aE,req:ld,res:ld,err:zV};function GV(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function mn(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||kc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=GV(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=Kc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:y});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:WV(t)};u.levels=mn.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Kc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=uE());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function y(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,tu(l,u,"error","log"),tu(l,u,"fatal","error"),tu(l,u,"warn","error"),tu(l,u,"info","log"),tu(l,u,"debug","log"),tu(l,u,"trace","log")}function w(E,T){if(!E)throw new Error("missing bindings for child Pino");T=T||{},i&&E.serializers&&(T.serializers=E.serializers);let R=T.serializers;if(i&&R){var _=Object.assign({},n,R),B=t.browser.serialize===!0?Object.keys(_):i;delete E.serializers,fd([E],B,_,this._stdErrSerialize)}function x(O){this._childLevel=(O._childLevel|0)+1,this.error=ru(O,E,"error"),this.fatal=ru(O,E,"fatal"),this.warn=ru(O,E,"warn"),this.info=ru(O,E,"info"),this.debug=ru(O,E,"debug"),this.trace=ru(O,E,"trace"),_&&(this.serializers=_,this._serialize=B),e&&(this._logEvent=uE([].concat(O._logEvent.bindings,E)))}return x.prototype=this,new x(this)}return u}mn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};mn.stdSerializers=jV;mn.stdTimeFunctions=Object.assign({},{nullTime:kx,epochTime:Kx,unixTime:$V,isoTime:YV});function tu(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Kc:i[r]?i[r]:kc[r]||kc[n]||Kc,QV(t,e,r)}function QV(t,e,r){!t.transmit&&e[r]===Kc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===kc?kc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ru(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;ilE,__asyncDelegator:()=>lH,__asyncGenerator:()=>cH,__asyncValues:()=>fH,__await:()=>zc,__awaiter:()=>nH,__classPrivateFieldGet:()=>gH,__classPrivateFieldSet:()=>yH,__createBinding:()=>sH,__decorate:()=>eH,__exportStar:()=>oH,__extends:()=>XV,__generator:()=>iH,__importDefault:()=>pH,__importStar:()=>dH,__makeTemplateObject:()=>hH,__metadata:()=>rH,__param:()=>tH,__read:()=>Wx,__rest:()=>ZV,__spread:()=>aH,__spreadArrays:()=>uH,__values:()=>fE});function XV(t,e){cE(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function ZV(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function tH(t,e){return function(r,n){e(r,n,t)}}function rH(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function nH(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function iH(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Wx(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function aH(){for(var t=[],e=0;e1||a(y,w)})})}function a(y,w){try{u(n[y](w))}catch(E){d(s[0][3],E)}}function u(y){y.value instanceof zc?Promise.resolve(y.value.v).then(l,f):d(s[0][2],y)}function l(y){a("next",y)}function f(y){a("throw",y)}function d(y,w){y(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function lH(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:zc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function fH(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof fE=="function"?fE(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function hH(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function dH(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function pH(t){return t&&t.__esModule?t:{default:t}}function gH(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function yH(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var cE,lE,ar=ge(()=>{c();cE=function(t,e){return cE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},cE(t,e)};lE=function(){return lE=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(dd,"__esModule",{value:!0});function mH(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}dd.safeJsonParse=mH;function wH(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}dd.safeJsonStringify=wH});var $x=v((Kne,pd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?pd.exports=global.localStorage:typeof window<"u"&&window.localStorage?pd.exports=window.localStorage:pd.exports=new e})()});var Yx=v(gd=>{"use strict";c();Object.defineProperty(gd,"__esModule",{value:!0});gd.IKeyValueStorage=void 0;var dE=class{};gd.IKeyValueStorage=dE});var Jx=v(yd=>{"use strict";c();Object.defineProperty(yd,"__esModule",{value:!0});yd.parseEntry=void 0;var EH=hE();function vH(t){var e;return[t[0],EH.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}yd.parseEntry=vH});var Zx=v(md=>{"use strict";c();Object.defineProperty(md,"__esModule",{value:!0});var Xx=(ar(),nt(or));Xx.__exportStar(Yx(),md);Xx.__exportStar(Jx(),md)});var t2=v(Wc=>{"use strict";c();Object.defineProperty(Wc,"__esModule",{value:!0});Wc.KeyValueStorage=void 0;var nu=(ar(),nt(or)),e2=hE(),AH=nu.__importDefault($x()),_H=Zx(),wd=class{constructor(){this.localStorage=AH.default}getKeys(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_H.parseEntry)})}getItem(e){return nu.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return e2.safeJsonParse(r)})}setItem(e,r){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,e2.safeJsonStringify(r))})}removeItem(e){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Wc.KeyValueStorage=wd;Wc.default=wd});var r2=v(Ed=>{"use strict";c();Object.defineProperty(Ed,"__esModule",{value:!0});Ed.delay=void 0;function bH(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ed.delay=bH});var n2=v(iu=>{"use strict";c();Object.defineProperty(iu,"__esModule",{value:!0});iu.ONE_THOUSAND=iu.ONE_HUNDRED=void 0;iu.ONE_HUNDRED=100;iu.ONE_THOUSAND=1e3});var i2=v(fe=>{"use strict";c();Object.defineProperty(fe,"__esModule",{value:!0});fe.ONE_YEAR=fe.FOUR_WEEKS=fe.THREE_WEEKS=fe.TWO_WEEKS=fe.ONE_WEEK=fe.THIRTY_DAYS=fe.SEVEN_DAYS=fe.FIVE_DAYS=fe.THREE_DAYS=fe.ONE_DAY=fe.TWENTY_FOUR_HOURS=fe.TWELVE_HOURS=fe.SIX_HOURS=fe.THREE_HOURS=fe.ONE_HOUR=fe.SIXTY_MINUTES=fe.THIRTY_MINUTES=fe.TEN_MINUTES=fe.FIVE_MINUTES=fe.ONE_MINUTE=fe.SIXTY_SECONDS=fe.THIRTY_SECONDS=fe.TEN_SECONDS=fe.FIVE_SECONDS=fe.ONE_SECOND=void 0;fe.ONE_SECOND=1;fe.FIVE_SECONDS=5;fe.TEN_SECONDS=10;fe.THIRTY_SECONDS=30;fe.SIXTY_SECONDS=60;fe.ONE_MINUTE=fe.SIXTY_SECONDS;fe.FIVE_MINUTES=fe.ONE_MINUTE*5;fe.TEN_MINUTES=fe.ONE_MINUTE*10;fe.THIRTY_MINUTES=fe.ONE_MINUTE*30;fe.SIXTY_MINUTES=fe.ONE_MINUTE*60;fe.ONE_HOUR=fe.SIXTY_MINUTES;fe.THREE_HOURS=fe.ONE_HOUR*3;fe.SIX_HOURS=fe.ONE_HOUR*6;fe.TWELVE_HOURS=fe.ONE_HOUR*12;fe.TWENTY_FOUR_HOURS=fe.ONE_HOUR*24;fe.ONE_DAY=fe.TWENTY_FOUR_HOURS;fe.THREE_DAYS=fe.ONE_DAY*3;fe.FIVE_DAYS=fe.ONE_DAY*5;fe.SEVEN_DAYS=fe.ONE_DAY*7;fe.THIRTY_DAYS=fe.ONE_DAY*30;fe.ONE_WEEK=fe.SEVEN_DAYS;fe.TWO_WEEKS=fe.ONE_WEEK*2;fe.THREE_WEEKS=fe.ONE_WEEK*3;fe.FOUR_WEEKS=fe.ONE_WEEK*4;fe.ONE_YEAR=fe.ONE_DAY*365});var pE=v(vd=>{"use strict";c();Object.defineProperty(vd,"__esModule",{value:!0});var s2=(ar(),nt(or));s2.__exportStar(n2(),vd);s2.__exportStar(i2(),vd)});var a2=v(su=>{"use strict";c();Object.defineProperty(su,"__esModule",{value:!0});su.fromMiliseconds=su.toMiliseconds=void 0;var o2=pE();function IH(t){return t*o2.ONE_THOUSAND}su.toMiliseconds=IH;function SH(t){return Math.floor(t/o2.ONE_THOUSAND)}su.fromMiliseconds=SH});var c2=v(Ad=>{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});var u2=(ar(),nt(or));u2.__exportStar(r2(),Ad);u2.__exportStar(a2(),Ad)});var l2=v($c=>{"use strict";c();Object.defineProperty($c,"__esModule",{value:!0});$c.Watch=void 0;var _d=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};$c.Watch=_d;$c.default=_d});var f2=v(bd=>{"use strict";c();Object.defineProperty(bd,"__esModule",{value:!0});bd.IWatch=void 0;var gE=class{};bd.IWatch=gE});var h2=v(yE=>{"use strict";c();Object.defineProperty(yE,"__esModule",{value:!0});var CH=(ar(),nt(or));CH.__exportStar(f2(),yE)});var ro=v(ou=>{"use strict";c();Object.defineProperty(ou,"__esModule",{value:!0});var Id=(ar(),nt(or));Id.__exportStar(c2(),ou);Id.__exportStar(l2(),ou);Id.__exportStar(h2(),ou);Id.__exportStar(pE(),ou)});var mE,d2=ge(()=>{c();mE=class{}});var wE={};at(wE,{IEvents:()=>mE});var EE=ge(()=>{c();d2()});var p2=v(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.IHeartBeat=void 0;var TH=(EE(),nt(wE)),vE=class extends TH.IEvents{constructor(e){super()}};Sd.IHeartBeat=vE});var _E=v(AE=>{"use strict";c();Object.defineProperty(AE,"__esModule",{value:!0});var xH=(ar(),nt(or));xH.__exportStar(p2(),AE)});var g2=v(au=>{"use strict";c();Object.defineProperty(au,"__esModule",{value:!0});au.HEARTBEAT_EVENTS=au.HEARTBEAT_INTERVAL=void 0;var NH=ro();au.HEARTBEAT_INTERVAL=NH.FIVE_SECONDS;au.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var IE=v(bE=>{"use strict";c();Object.defineProperty(bE,"__esModule",{value:!0});var DH=(ar(),nt(or));DH.__exportStar(g2(),bE)});var y2=v(Cd=>{"use strict";c();Object.defineProperty(Cd,"__esModule",{value:!0});Cd.HeartBeat=void 0;var SE=(ar(),nt(or)),OH=jn(),PH=ro(),BH=_E(),CE=IE(),Yc=class extends BH.IHeartBeat{constructor(e){super(e),this.events=new OH.EventEmitter,this.interval=CE.HEARTBEAT_INTERVAL,this.interval=e?.interval||CE.HEARTBEAT_INTERVAL}static init(e){return SE.__awaiter(this,void 0,void 0,function*(){let r=new Yc(e);return yield r.init(),r})}init(){return SE.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return SE.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),PH.toMiliseconds(this.interval))})}pulse(){this.events.emit(CE.HEARTBEAT_EVENTS.pulse)}};Cd.HeartBeat=Yc});var m2=v(Jc=>{"use strict";c();Object.defineProperty(Jc,"__esModule",{value:!0});var TE=(ar(),nt(or));TE.__exportStar(y2(),Jc);TE.__exportStar(_E(),Jc);TE.__exportStar(IE(),Jc)});var xE=v(uu=>{"use strict";c();Object.defineProperty(uu,"__esModule",{value:!0});uu.PINO_CUSTOM_CONTEXT_KEY=uu.PINO_LOGGER_DEFAULTS=void 0;uu.PINO_LOGGER_DEFAULTS={level:"info"};uu.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var _2=v(nr=>{"use strict";c();Object.defineProperty(nr,"__esModule",{value:!0});nr.generateChildLogger=nr.formatChildLoggerContext=nr.getLoggerContext=nr.setBrowserLoggerContext=nr.getBrowserLoggerContext=nr.getDefaultLoggerOptions=void 0;var cu=xE();function RH(t){return Object.assign(Object.assign({},t),{level:t?.level||cu.PINO_LOGGER_DEFAULTS.level})}nr.getDefaultLoggerOptions=RH;function w2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}nr.getBrowserLoggerContext=w2;function E2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}nr.setBrowserLoggerContext=E2;function v2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=w2(t,e):r=t.bindings().context||"",r}nr.getLoggerContext=v2;function A2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=v2(t,r);return n.trim()?`${n}/${e}`:e}nr.formatChildLoggerContext=A2;function LH(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=A2(t,e,r),i=t.child({context:n});return E2(i,n,r)}nr.generateChildLogger=LH});var DE=v(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.pino=void 0;var NE=(ar(),nt(or)),FH=NE.__importDefault(hd());Object.defineProperty(lu,"pino",{enumerable:!0,get:function(){return FH.default}});NE.__exportStar(xE(),lu);NE.__exportStar(_2(),lu)});var zE=v(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var fu=(EE(),nt(wE)),b2=jn();function MH(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var UH=MH(b2),OE=class extends fu.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},PE=class{constructor(e,r,n){this.core=e,this.logger=r}},BE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},RE=class{constructor(e,r){this.logger=e,this.core=r}},LE=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},FE=class extends fu.IEvents{constructor(e){super()}},ME=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},UE=class{constructor(){this.map=new Map}},qE=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},VE=class{constructor(e,r){this.core=e,this.logger=r}},HE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},jE=class{constructor(e,r){this.logger=e,this.core=r}},GE=class extends UH.default{constructor(){super()}},QE=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},kE=class extends b2.EventEmitter{constructor(){super()}},KE=class{constructor(e){this.client=e}};Dt.ICore=OE,Dt.ICrypto=PE,Dt.IEngine=KE,Dt.IEngineEvents=kE,Dt.IExpirer=HE,Dt.IJsonRpcHistory=BE,Dt.IKeyChain=VE,Dt.IMessageTracker=RE,Dt.IPairing=jE,Dt.IPublisher=LE,Dt.IRelayer=FE,Dt.ISignClient=QE,Dt.ISignClientEvents=GE,Dt.IStore=ME,Dt.ISubscriber=qE,Dt.ISubscriberTopicMap=UE});var I2={};at(I2,{safeJsonParse:()=>Xc,safeJsonStringify:()=>Zc});function Xc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return VH(t)}catch{return t}}function Zc(t){return typeof t=="string"?t:qH(t)||""}var qH,VH,Td=ge(()=>{c();qH=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),VH=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var C2=v(xd=>{"use strict";c();Object.defineProperty(xd,"__esModule",{value:!0});xd.BrowserRandomSource=void 0;var S2=65536,WE=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty($E,"__esModule",{value:!0});function HH(t){for(var e=0;e{c()});var x2=v(Nd=>{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});Nd.NodeRandomSource=void 0;var jH=Cr(),YE=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof F_<"u"){let e=T2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.SystemRandomSource=void 0;var GH=C2(),QH=x2(),JE=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new GH.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new QH.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};Dd.SystemRandomSource=JE});var D2=v(ur=>{"use strict";c();Object.defineProperty(ur,"__esModule",{value:!0});function kH(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}ur.mul=Math.imul||kH;function KH(t,e){return t+e|0}ur.add=KH;function zH(t,e){return t-e|0}ur.sub=zH;function WH(t,e){return t<>>32-e}ur.rotl=WH;function $H(t,e){return t<<32-e|t>>>e}ur.rotr=$H;function YH(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}ur.isInteger=Number.isInteger||YH;ur.MAX_SAFE_INTEGER=9007199254740991;ur.isSafeInteger=function(t){return ur.isInteger(t)&&t>=-ur.MAX_SAFE_INTEGER&&t<=ur.MAX_SAFE_INTEGER}});var hu=v(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var O2=D2();function JH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=JH;function XH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=XH;function ZH(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=ZH;function ej(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=ej;function P2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=P2;Ne.writeInt16BE=P2;function B2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=B2;Ne.writeInt16LE=B2;function XE(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=XE;function ZE(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=ZE;function e1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=e1;function t1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=t1;function Od(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Od;Ne.writeInt32BE=Od;function Pd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Pd;Ne.writeInt32LE=Pd;function tj(t,e){e===void 0&&(e=0);var r=XE(t,e),n=XE(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=tj;function rj(t,e){e===void 0&&(e=0);var r=ZE(t,e),n=ZE(t,e+4);return r*4294967296+n}Ne.readUint64BE=rj;function nj(t,e){e===void 0&&(e=0);var r=e1(t,e),n=e1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=nj;function ij(t,e){e===void 0&&(e=0);var r=t1(t,e),n=t1(t,e+4);return n*4294967296+r}Ne.readUint64LE=ij;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Od(t/4294967296>>>0,e,r),Od(t>>>0,e,r+4),e}Ne.writeUint64BE=R2;Ne.writeInt64BE=R2;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Pd(t>>>0,e,r),Pd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=L2;Ne.writeInt64LE=L2;function sj(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=sj;function oj(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=aj;function uj(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!O2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.randomStringForEntropy=Qt.randomString=Qt.randomUint32=Qt.randomBytes=Qt.defaultRandomSource=void 0;var mj=N2(),wj=hu(),F2=Cr();Qt.defaultRandomSource=new mj.SystemRandomSource;function r1(t,e=Qt.defaultRandomSource){return e.randomBytes(t)}Qt.randomBytes=r1;function Ej(t=Qt.defaultRandomSource){let e=r1(4,t),r=(0,wj.readUint32LE)(e);return(0,F2.wipe)(e),r}Qt.randomUint32=Ej;var M2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function U2(t,e=M2,r=Qt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=r1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Qn,"__esModule",{value:!0});var pu=hu(),du=Cr();Qn.DIGEST_LENGTH=64;Qn.BLOCK_SIZE=128;var V2=function(){function t(){this.digestLength=Qn.DIGEST_LENGTH,this.blockSize=Qn.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){du.wipe(this._buffer),du.wipe(this._tempHi),du.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(n1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=n1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){du.wipe(e.stateHi),du.wipe(e.stateLo),e.buffer&&du.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Qn.SHA512=V2;var q2=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function n1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],y=r[5],w=r[6],E=r[7],T=n[0],R=n[1],_=n[2],B=n[3],x=n[4],O=n[5],P=n[6],L=n[7],b,C,M,Z,K,j,G,$;o>=128;){for(var de=0;de<16;de++){var ae=8*de+s;t[de]=pu.readUint32BE(i,ae),e[de]=pu.readUint32BE(i,ae+4)}for(var de=0;de<80;de++){var re=a,Y=u,ie=l,te=f,ne=d,q=y,ce=w,oe=E,le=T,se=R,ue=_,g=B,m=x,A=O,D=P,I=L;if(b=E,C=L,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=(d>>>14|x<<32-14)^(d>>>18|x<<32-18)^(x>>>41-32|d<<32-(41-32)),C=(x>>>14|d<<32-14)^(x>>>18|d<<32-18)^(d>>>41-32|x<<32-(41-32)),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=d&y^~d&w,C=x&O^~x&P,K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=q2[de*2],C=q2[de*2+1],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=t[de%16],C=e[de%16],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,M=G&65535|$<<16,Z=K&65535|j<<16,b=M,C=Z,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),C=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=a&u^a&l^u&l,C=T&R^T&_^R&_,K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,oe=G&65535|$<<16,I=K&65535|j<<16,b=te,C=g,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=M,C=Z,K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,te=G&65535|$<<16,g=K&65535|j<<16,u=re,l=Y,f=ie,d=te,y=ne,w=q,E=ce,a=oe,R=le,_=se,B=ue,x=g,O=m,P=A,L=D,T=I,de%16===15)for(var ae=0;ae<16;ae++)b=t[ae],C=e[ae],K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=t[(ae+9)%16],C=e[(ae+9)%16],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,M=t[(ae+1)%16],Z=e[(ae+1)%16],b=(M>>>1|Z<<32-1)^(M>>>8|Z<<32-8)^M>>>7,C=(Z>>>1|M<<32-1)^(Z>>>8|M<<32-8)^(Z>>>7|M<<32-7),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,M=t[(ae+14)%16],Z=e[(ae+14)%16],b=(M>>>19|Z<<32-19)^(Z>>>61-32|M<<32-(61-32))^M>>>6,C=(Z>>>19|M<<32-19)^(M>>>61-32|Z<<32-(61-32))^(Z>>>6|M<<32-6),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,t[ae]=G&65535|$<<16,e[ae]=K&65535|j<<16}b=a,C=T,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[0],C=n[0],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[0]=a=G&65535|$<<16,n[0]=T=K&65535|j<<16,b=u,C=R,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[1],C=n[1],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[1]=u=G&65535|$<<16,n[1]=R=K&65535|j<<16,b=l,C=_,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[2],C=n[2],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[2]=l=G&65535|$<<16,n[2]=_=K&65535|j<<16,b=f,C=B,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[3],C=n[3],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[3]=f=G&65535|$<<16,n[3]=B=K&65535|j<<16,b=d,C=x,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[4],C=n[4],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[4]=d=G&65535|$<<16,n[4]=x=K&65535|j<<16,b=y,C=O,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[5],C=n[5],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[5]=y=G&65535|$<<16,n[5]=O=K&65535|j<<16,b=w,C=P,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[6],C=n[6],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[6]=w=G&65535|$<<16,n[6]=P=K&65535|j<<16,b=E,C=L,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[7],C=n[7],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[7]=E=G&65535|$<<16,n[7]=L=K&65535|j<<16,s+=128,o-=128}return s}function Aj(t){var e=new V2;e.update(t);var r=e.digest();return e.clean(),r}Qn.hash=Aj});var tN=v(qe=>{"use strict";c();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var _j=el(),tl=H2(),K2=Cr();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function Ee(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,z2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function W2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function Q2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return rl(r,t),rl(n,e),W2(r,n)}function $2(t){let e=new Uint8Array(32);return rl(e,t),e[0]&1}function Tj(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function no(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function so(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Ge(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,T=0,R=0,_=0,B=0,x=0,O=0,P=0,L=0,b=0,C=0,M=0,Z=0,K=0,j=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],D=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,T+=n*A,R+=n*D,_+=n*I,B+=n*N,x+=n*F,O+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,T+=n*m,R+=n*A,_+=n*D,B+=n*I,x+=n*N,O+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,T+=n*g,R+=n*m,_+=n*A,B+=n*D,x+=n*I,O+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,T+=n*ue,R+=n*g,_+=n*m,B+=n*A,x+=n*D,O+=n*I,P+=n*N,L+=n*F,b+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,T+=n*se,R+=n*ue,_+=n*g,B+=n*m,x+=n*A,O+=n*D,P+=n*I,L+=n*N,b+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,T+=n*le,R+=n*se,_+=n*ue,B+=n*g,x+=n*m,O+=n*A,P+=n*D,L+=n*I,b+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,T+=n*oe,R+=n*le,_+=n*se,B+=n*ue,x+=n*g,O+=n*m,P+=n*A,L+=n*D,b+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,w+=n*ne,E+=n*q,T+=n*ce,R+=n*oe,_+=n*le,B+=n*se,x+=n*ue,O+=n*g,P+=n*m,L+=n*A,b+=n*D,C+=n*I,M+=n*N,Z+=n*F,K+=n*S,n=e[8],w+=n*te,E+=n*ne,T+=n*q,R+=n*ce,_+=n*oe,B+=n*le,x+=n*se,O+=n*ue,P+=n*g,L+=n*m,b+=n*A,C+=n*D,M+=n*I,Z+=n*N,K+=n*F,j+=n*S,n=e[9],E+=n*te,T+=n*ne,R+=n*q,_+=n*ce,B+=n*oe,x+=n*le,O+=n*se,P+=n*ue,L+=n*g,b+=n*m,C+=n*A,M+=n*D,Z+=n*I,K+=n*N,j+=n*F,G+=n*S,n=e[10],T+=n*te,R+=n*ne,_+=n*q,B+=n*ce,x+=n*oe,O+=n*le,P+=n*se,L+=n*ue,b+=n*g,C+=n*m,M+=n*A,Z+=n*D,K+=n*I,j+=n*N,G+=n*F,$+=n*S,n=e[11],R+=n*te,_+=n*ne,B+=n*q,x+=n*ce,O+=n*oe,P+=n*le,L+=n*se,b+=n*ue,C+=n*g,M+=n*m,Z+=n*A,K+=n*D,j+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],_+=n*te,B+=n*ne,x+=n*q,O+=n*ce,P+=n*oe,L+=n*le,b+=n*se,C+=n*ue,M+=n*g,Z+=n*m,K+=n*A,j+=n*D,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],B+=n*te,x+=n*ne,O+=n*q,P+=n*ce,L+=n*oe,b+=n*le,C+=n*se,M+=n*ue,Z+=n*g,K+=n*m,j+=n*A,G+=n*D,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,O+=n*ne,P+=n*q,L+=n*ce,b+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,K+=n*g,j+=n*m,G+=n*A,$+=n*D,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],O+=n*te,P+=n*ne,L+=n*q,b+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,K+=n*ue,j+=n*g,G+=n*m,$+=n*A,de+=n*D,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*b,u+=38*C,l+=38*M,f+=38*Z,d+=38*K,y+=38*j,w+=38*G,E+=38*$,T+=38*de,R+=38*ae,_+=38*re,B+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=T,t[11]=R,t[12]=_,t[13]=B,t[14]=x,t[15]=O}function io(t,e){Ge(t,e,e)}function Y2(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)io(r,r),n!==2&&n!==4&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function xj(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)io(r,r),n!==1&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function a1(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee(),l=Ee(),f=Ee();so(r,t[1],t[0]),so(f,e[1],e[0]),Ge(r,r,f),no(n,t[0],t[1]),no(f,e[0],e[1]),Ge(n,n,f),Ge(i,t[3],e[3]),Ge(i,i,Sj),Ge(s,t[2],e[2]),no(s,s,s),so(o,n,r),so(a,s,i),no(u,s,i),no(l,n,r),Ge(t[0],o,a),Ge(t[1],l,u),Ge(t[2],u,a),Ge(t[3],o,l)}function k2(t,e,r){for(let n=0;n<4;n++)z2(t[n],e[n],r)}function c1(t,e){let r=Ee(),n=Ee(),i=Ee();Y2(i,e[2]),Ge(r,e[0],i),Ge(n,e[1],i),rl(t,n),t[31]^=$2(r)<<7}function J2(t,e,r){Pi(t[0],o1),Pi(t[1],gu),Pi(t[2],gu),Pi(t[3],o1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;k2(t,e,i),a1(e,t),a1(t,t),k2(t,e,i)}}function l1(t,e){let r=[Ee(),Ee(),Ee(),Ee()];Pi(r[0],j2),Pi(r[1],G2),Pi(r[2],gu),Ge(r[3],j2,G2),J2(t,r,e)}function X2(t){if(t.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,tl.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ee(),Ee(),Ee(),Ee()];l1(n,e),c1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}qe.generateKeyPairFromSeed=X2;function Nj(t){let e=(0,_j.randomBytes)(32,t),r=X2(e);return(0,K2.wipe)(e),r}qe.generateKeyPair=Nj;function Dj(t){if(t.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}qe.extractPublicKeyFromSecretKey=Dj;var s1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Z2(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*s1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*s1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function u1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;Z2(t,e)}function Oj(t,e){let r=new Float64Array(64),n=[Ee(),Ee(),Ee(),Ee()],i=(0,tl.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new tl.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),u1(a),l1(n,a),c1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();u1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return Z2(s.subarray(32),r),s}qe.sign=Oj;function eN(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee();return Pi(t[2],gu),Tj(t[1],e),io(i,t[1]),Ge(s,i,Ij),so(i,i,t[2]),no(s,t[2],s),io(o,s),io(a,o),Ge(u,a,o),Ge(r,u,i),Ge(r,r,s),xj(r,r),Ge(r,r,i),Ge(r,r,s),Ge(r,r,s),Ge(t[0],r,s),io(n,t[0]),Ge(n,n,s),Q2(n,i)&&Ge(t[0],t[0],Cj),io(n,t[0]),Ge(n,n,s),Q2(n,i)?-1:($2(t[0])===e[31]>>7&&so(t[0],o1,t[0]),Ge(t[3],t[0],t[1]),0)}function Pj(t,e,r){let n=new Uint8Array(32),i=[Ee(),Ee(),Ee(),Ee()],s=[Ee(),Ee(),Ee(),Ee()];if(r.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(eN(s,t))return!1;let o=new tl.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return u1(a),J2(i,s,a),l1(s,r.subarray(32)),a1(i,s),c1(n,i),!W2(r,n)}qe.verify=Pj;function Bj(t){let e=[Ee(),Ee(),Ee(),Ee()];if(eN(e,t))throw new Error("Ed25519: invalid public key");let r=Ee(),n=Ee(),i=e[1];no(r,gu,i),so(n,gu,i),Y2(n,n),Ge(r,r,n);let s=new Uint8Array(32);return rl(s,r),s}qe.convertPublicKeyToX25519=Bj;function Rj(t){let e=(0,tl.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,K2.wipe)(e),r}qe.convertSecretKeyToX25519=Rj});var Bd,Rd,oo,yu,Ld,nl,Fd,Md,Ud,mu,qd,Vd,rN,nN,Hd=ge(()=>{c();Bd="EdDSA",Rd="JWT",oo=".",yu="base64url",Ld="utf8",nl="utf8",Fd=":",Md="did",Ud="key",mu="base58btc",qd="z",Vd="K36",rN=32,nN=32});function Bi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var il=ge(()=>{c()});function wu(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Bi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var jd=ge(()=>{c();il()});function Gd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=wu(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Bi(r)}var f1=ge(()=>{c();jd();il()});function Lj(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,O=new Uint8Array(x);_!==B;){for(var P=E[_],L=0,b=x-1;(P!==0||L>>0,O[b]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=L,_++}for(var C=x-R;C!==x&&O[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(B);E[T];){var O=r[E.charCodeAt(T)];if(O===255)return;for(var P=0,L=B-1;(O!==0||P<_)&&L!==-1;L--,P++)O+=a*x[L]>>>0,x[L]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");_=P,T++}if(E[T]!==" "){for(var b=B-_;b!==B&&x[b]===0;)b++;for(var C=new Uint8Array(R+(B-b)),M=R;b!==B;)C[M++]=x[b++];return C}}}function w(E){var T=y(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var Fj,Mj,iN,sN=ge(()=>{c();Fj=Lj,Mj=Fj,iN=Mj});var xse,oN,kn,aN,uN,Ri=ge(()=>{c();xse=new Uint8Array(0),oN=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aN=t=>new TextEncoder().encode(t),uN=t=>new TextDecoder().decode(t)});var h1,d1,p1,lN,g1,Eu,Li,Uj,qj,ct,Ur=ge(()=>{c();sN();Ri();h1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},d1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return lN(this,e)}},p1=class{constructor(e){this.decoders=e}or(e){return lN(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},lN=(t,e)=>new p1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),g1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new h1(e,r,n),this.decoder=new d1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Eu=({name:t,prefix:e,encode:r,decode:n})=>new g1(t,e,r,n),Li=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=iN(r,e);return Eu({prefix:t,name:e,encode:n,decode:s=>kn(i(s))})},Uj=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},qj=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Eu({prefix:e,name:t,encode(i){return qj(i,n,r)},decode(i){return Uj(i,n,r,t)}})});var y1={};at(y1,{identity:()=>Vj});var Vj,fN=ge(()=>{c();Ur();Ri();Vj=Eu({prefix:"\0",name:"identity",encode:t=>uN(t),decode:t=>aN(t)})});var m1={};at(m1,{base2:()=>Hj});var Hj,hN=ge(()=>{c();Ur();Hj=ct({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var w1={};at(w1,{base8:()=>jj});var jj,dN=ge(()=>{c();Ur();jj=ct({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var E1={};at(E1,{base10:()=>Gj});var Gj,pN=ge(()=>{c();Ur();Gj=Li({prefix:"9",name:"base10",alphabet:"0123456789"})});var v1={};at(v1,{base16:()=>Qj,base16upper:()=>kj});var Qj,kj,gN=ge(()=>{c();Ur();Qj=ct({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),kj=ct({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var A1={};at(A1,{base32:()=>vu,base32hex:()=>$j,base32hexpad:()=>Jj,base32hexpadupper:()=>Xj,base32hexupper:()=>Yj,base32pad:()=>zj,base32padupper:()=>Wj,base32upper:()=>Kj,base32z:()=>Zj});var vu,Kj,zj,Wj,$j,Yj,Jj,Xj,Zj,_1=ge(()=>{c();Ur();vu=ct({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kj=ct({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zj=ct({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wj=ct({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$j=ct({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yj=ct({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Jj=ct({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xj=ct({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Zj=ct({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var b1={};at(b1,{base36:()=>e7,base36upper:()=>t7});var e7,t7,yN=ge(()=>{c();Ur();e7=Li({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),t7=Li({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var I1={};at(I1,{base58btc:()=>wn,base58flickr:()=>r7});var wn,r7,S1=ge(()=>{c();Ur();wn=Li({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),r7=Li({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var C1={};at(C1,{base64:()=>n7,base64pad:()=>i7,base64url:()=>s7,base64urlpad:()=>o7});var n7,i7,s7,o7,mN=ge(()=>{c();Ur();n7=ct({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),i7=ct({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),s7=ct({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),o7=ct({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var T1={};at(T1,{base256emoji:()=>f7});function c7(t){return t.reduce((e,r)=>(e+=a7[r],e),"")}function l7(t){let e=[];for(let r of t){let n=u7[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var wN,a7,u7,f7,EN=ge(()=>{c();Ur();wN=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),a7=wN.reduce((t,e,r)=>(t[r]=e,t),[]),u7=wN.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);f7=Eu({prefix:"\u{1F680}",name:"base256emoji",encode:c7,decode:l7})});function _N(t,e,r){e=e||[],r=r||0;for(var n=r;t>=g7;)e[r++]=t&255|vN,t/=128;for(;t&p7;)e[r++]=t&255|vN,t>>>=7;return e[r]=t|0,_N.bytes=r-n+1,e}function x1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw x1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&AN)<=m7);return x1.bytes=s-n,r}var h7,vN,d7,p7,g7,y7,m7,AN,w7,E7,v7,A7,_7,b7,I7,S7,C7,T7,x7,N7,sl,bN=ge(()=>{c();h7=_N,vN=128,d7=127,p7=~d7,g7=Math.pow(2,31);y7=x1,m7=128,AN=127;w7=Math.pow(2,7),E7=Math.pow(2,14),v7=Math.pow(2,21),A7=Math.pow(2,28),_7=Math.pow(2,35),b7=Math.pow(2,42),I7=Math.pow(2,49),S7=Math.pow(2,56),C7=Math.pow(2,63),T7=function(t){return t{c();bN();ol=(t,e=0)=>[sl.decode(t,e),sl.decode.bytes],Au=(t,e,r=0)=>(sl.encode(t,e,r),e),_u=t=>sl.encodingLength(t)});var ao,IN,SN,bu,ul=ge(()=>{c();Ri();kd();ao=(t,e)=>{let r=e.byteLength,n=_u(t),i=n+_u(r),s=new Uint8Array(i+r);return Au(t,s,0),Au(r,s,n),s.set(e,i),new bu(t,r,e,s)},IN=t=>{let e=kn(t),[r,n]=ol(e),[i,s]=ol(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new bu(r,i,o,e)},SN=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&oN(t.bytes,e.bytes),bu=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var D1,N1,O1=ge(()=>{c();ul();D1=({name:t,code:e,encode:r})=>new N1(t,e,r),N1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ao(this.code,r):r.then(n=>ao(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var P1={};at(P1,{sha256:()=>D7,sha512:()=>O7});var TN,D7,O7,xN=ge(()=>{c();O1();TN=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),D7=D1({name:"sha2-256",code:18,encode:TN("SHA-256")}),O7=D1({name:"sha2-512",code:19,encode:TN("SHA-512")})});var B1={};at(B1,{identity:()=>R7});var NN,P7,DN,B7,R7,ON=ge(()=>{c();Ri();ul();NN=0,P7="identity",DN=kn,B7=t=>ao(NN,DN(t)),R7={code:NN,name:P7,encode:DN,digest:B7}});var PN=ge(()=>{c();Ri()});var poe,goe,BN=ge(()=>{c();poe=new TextEncoder,goe=new TextDecoder});var bt,M7,U7,q7,cl,V7,RN,LN,Kd,zd,H7,j7,G7,FN=ge(()=>{c();kd();ul();S1();_1();Ri();bt=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:zd,byteLength:zd,code:Kd,version:Kd,multihash:Kd,bytes:Kd,_baseCache:zd,asCID:zd})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==cl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==V7)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return bt.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ao(e,r);return bt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&SN(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return U7(r,i,e||wn.encoder);default:return q7(r,i,e||vu.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return j7(/^0\.0/,G7),!!(e&&(e[LN]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof bt)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new bt(r,n,i,s||RN(r,n,i.bytes))}else if(e!=null&&e[LN]===!0){let{version:r,multihash:n,code:i}=e,s=IN(n);return bt.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==cl)throw new Error(`Version 0 CID must use dag-pb (code: ${cl}) block encoding`);return new bt(e,r,n,n.bytes)}case 1:{let i=RN(e,r,n.bytes);return new bt(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return bt.create(0,cl,e)}static createV1(e,r){return bt.create(1,e,r)}static decode(e){let[r,n]=bt.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=bt.inspectBytes(e),n=r.size-r.multihashSize,i=kn(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new bu(r.multihashCode,r.digestSize,s,i);return[r.version===0?bt.createV0(o):bt.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,y]=ol(e.subarray(r));return r+=y,d},i=n(),s=cl;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=M7(e,r),s=bt.decode(i);return s._baseCache.set(n,e),s}},M7=(t,e)=>{switch(t[0]){case"Q":{let r=e||wn;return[wn.prefix,r.decode(`${wn.prefix}${t}`)]}case wn.prefix:{let r=e||wn;return[wn.prefix,r.decode(t)]}case vu.prefix:{let r=e||vu;return[vu.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},U7=(t,e,r)=>{let{prefix:n}=r;if(n!==wn.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},q7=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},cl=112,V7=18,RN=(t,e,r)=>{let n=_u(t),i=n+_u(e),s=new Uint8Array(i+r.byteLength);return Au(t,s,0),Au(e,s,n),s.set(r,i),s},LN=Symbol.for("@ipld/js-cid/CID"),Kd={writable:!1,configurable:!1,enumerable:!0},zd={writable:!1,enumerable:!1,configurable:!1},H7="0.0.0-dev",j7=(t,e)=>{if(t.test(H7))console.warn(e);else throw new Error(e)},G7=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -21,26 +17,26 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var qN=ge(()=>{c();UN();zd();Ri();B1();ul()});var F1,Doe,VN=ge(()=>{c();dN();pN();gN();yN();mN();I1();wN();T1();EN();AN();DN();BN();RN();LN();qN();F1={...w1,...E1,...v1,...A1,..._1,...b1,...S1,...C1,...x1,...N1},Doe={...R1,...L1}});function HN(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var jN,M1,W7,Yd,U1=ge(()=>{c();VN();Qd();jN=HN("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),M1=HN("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=wu(t.length);for(let r=0;r{c();U1()});function En(t,e="utf8"){let r=Yd[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Bi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var V1=ge(()=>{c();U1();il()});function ll(t){return Xc(Kn(En(t,yu),Md))}function fl(t){return Kn(En(Zc(t),Md),yu)}function j1(t){let e=En(Hd,mu),r=jd+Kn(kd([e,t]),mu);return[qd,Vd,r].join(Ud)}function H1(t){let[e,r,n]=t.split(Ud);if(e!==qd||r!==Vd)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==jd)throw new Error("Issuer must be a key in mulicodec format");let s=En(n.slice(1),mu);if(Kn(s.slice(0,2),mu)!==Hd)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function GN(t){return Kn(t,yu)}function QN(t){return En(t,yu)}function G1(t){return En([fl(t.header),fl(t.payload)].join(so),nl)}function $7(t){let e=Kn(t,nl).split(so),r=ll(e[0]),n=ll(e[1]);return{header:r,payload:n}}function Q1(t){return[fl(t.header),fl(t.payload),GN(t.signature)].join(so)}function k1(t){let e=t.split(so),r=ll(e[0]),n=ll(e[1]),i=QN(e[2]),s=En(e.slice(0,2).join(so),nl);return{header:r,payload:n,signature:i,data:s}}var K1=ge(()=>{c();d1();q1();V1();Nd();Gd()});function Y7(t=(0,kN.randomBytes)(32)){return Iu.generateKeyPairFromSeed(t)}async function J7(t,e,r,n,i=(0,KN.fromMiliseconds)(Date.now())){let s={alg:Ld,typ:Fd},o=j1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=G1({header:s,payload:u}),f=Iu.sign(n.secretKey,l);return Q1({header:s,payload:u,signature:f})}async function X7(t){let{header:e,payload:r,data:n,signature:i}=k1(t);if(e.alg!==Ld||e.typ!==Fd)throw new Error("JWT must use EdDSA algorithm");let s=H1(r.iss);return Iu.verify(s,n,i)}var Iu,kN,KN,zN=ge(()=>{c();Iu=_e(nN()),kN=_e(el()),KN=_e(to());Gd();K1()});var WN=ge(()=>{c()});var $N={};ot($N,{DATA_ENCODING:()=>nl,DID_DELIMITER:()=>Ud,DID_METHOD:()=>Vd,DID_PREFIX:()=>qd,JSON_ENCODING:()=>Md,JWT_DELIMITER:()=>so,JWT_ENCODING:()=>yu,JWT_IRIDIUM_ALG:()=>Ld,JWT_IRIDIUM_TYP:()=>Fd,KEY_PAIR_SEED_LENGTH:()=>sN,MULTICODEC_ED25519_BASE:()=>jd,MULTICODEC_ED25519_ENCODING:()=>mu,MULTICODEC_ED25519_HEADER:()=>Hd,MULTICODEC_ED25519_LENGTH:()=>iN,decodeData:()=>$7,decodeIss:()=>H1,decodeJSON:()=>ll,decodeJWT:()=>k1,decodeSig:()=>QN,encodeData:()=>G1,encodeIss:()=>j1,encodeJSON:()=>fl,encodeJWT:()=>Q1,encodeSig:()=>GN,generateKeyPair:()=>Y7,signJWT:()=>J7,verifyJWT:()=>X7});var YN=ge(()=>{c();zN();Gd();WN();K1()});var XN=v(Jd=>{"use strict";c();Object.defineProperty(Jd,"__esModule",{value:!0});var kt=hu(),z1=Cr(),Z7=20;function eG(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],M=e[11]<<24|e[10]<<16|e[9]<<8|e[8],x=e[15]<<24|e[14]<<16|e[13]<<8|e[12],b=n,T=i,P=s,B=o,_=a,S=u,F=l,Z=f,K=d,H=y,G=w,$=E,pe=N,ae=R,re=M,Y=x,ie=0;ie>>32-16|pe<<16,K=K+pe|0,_^=K,_=_>>>32-12|_<<12,T=T+S|0,ae^=T,ae=ae>>>32-16|ae<<16,H=H+ae|0,S^=H,S=S>>>32-12|S<<12,P=P+F|0,re^=P,re=re>>>32-16|re<<16,G=G+re|0,F^=G,F=F>>>32-12|F<<12,B=B+Z|0,Y^=B,Y=Y>>>32-16|Y<<16,$=$+Y|0,Z^=$,Z=Z>>>32-12|Z<<12,P=P+F|0,re^=P,re=re>>>32-8|re<<8,G=G+re|0,F^=G,F=F>>>32-7|F<<7,B=B+Z|0,Y^=B,Y=Y>>>32-8|Y<<8,$=$+Y|0,Z^=$,Z=Z>>>32-7|Z<<7,T=T+S|0,ae^=T,ae=ae>>>32-8|ae<<8,H=H+ae|0,S^=H,S=S>>>32-7|S<<7,b=b+_|0,pe^=b,pe=pe>>>32-8|pe<<8,K=K+pe|0,_^=K,_=_>>>32-7|_<<7,b=b+S|0,Y^=b,Y=Y>>>32-16|Y<<16,G=G+Y|0,S^=G,S=S>>>32-12|S<<12,T=T+F|0,pe^=T,pe=pe>>>32-16|pe<<16,$=$+pe|0,F^=$,F=F>>>32-12|F<<12,P=P+Z|0,ae^=P,ae=ae>>>32-16|ae<<16,K=K+ae|0,Z^=K,Z=Z>>>32-12|Z<<12,B=B+_|0,re^=B,re=re>>>32-16|re<<16,H=H+re|0,_^=H,_=_>>>32-12|_<<12,P=P+Z|0,ae^=P,ae=ae>>>32-8|ae<<8,K=K+ae|0,Z^=K,Z=Z>>>32-7|Z<<7,B=B+_|0,re^=B,re=re>>>32-8|re<<8,H=H+re|0,_^=H,_=_>>>32-7|_<<7,T=T+F|0,pe^=T,pe=pe>>>32-8|pe<<8,$=$+pe|0,F^=$,F=F>>>32-7|F<<7,b=b+S|0,Y^=b,Y=Y>>>32-8|Y<<8,G=G+Y|0,S^=G,S=S>>>32-7|S<<7;kt.writeUint32LE(b+n|0,t,0),kt.writeUint32LE(T+i|0,t,4),kt.writeUint32LE(P+s|0,t,8),kt.writeUint32LE(B+o|0,t,12),kt.writeUint32LE(_+a|0,t,16),kt.writeUint32LE(S+u|0,t,20),kt.writeUint32LE(F+l|0,t,24),kt.writeUint32LE(Z+f|0,t,28),kt.writeUint32LE(K+d|0,t,32),kt.writeUint32LE(H+y|0,t,36),kt.writeUint32LE(G+w|0,t,40),kt.writeUint32LE($+E|0,t,44),kt.writeUint32LE(pe+N|0,t,48),kt.writeUint32LE(ae+R|0,t,52),kt.writeUint32LE(re+M|0,t,56),kt.writeUint32LE(Y+x|0,t,60)}function JN(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var Xd=v(Su=>{"use strict";c();Object.defineProperty(Su,"__esModule",{value:!0});function nG(t,e,r){return~(t-1)&e|t-1&r}Su.select=nG;function iG(t,e){return(t|0)-(e|0)-1>>>31&1}Su.lessOrEqual=iG;function ZN(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Su.compare=ZN;function sG(t,e){return t.length===0||e.length===0?!1:ZN(t,e)!==0}Su.equal=sG});var tD=v(zn=>{"use strict";c();Object.defineProperty(zn,"__esModule",{value:!0});var oG=Xd(),Zd=Cr();zn.DIGEST_LENGTH=16;var eD=function(){function t(e){this.digestLength=zn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],y=this._h[7],w=this._h[8],E=this._h[9],N=this._r[0],R=this._r[1],M=this._r[2],x=this._r[3],b=this._r[4],T=this._r[5],P=this._r[6],B=this._r[7],_=this._r[8],S=this._r[9];n>=16;){var F=e[r+0]|e[r+1]<<8;s+=F&8191;var Z=e[r+2]|e[r+3]<<8;o+=(F>>>13|Z<<3)&8191;var K=e[r+4]|e[r+5]<<8;a+=(Z>>>10|K<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(K>>>7|H<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(H>>>4|G<<12)&8191,f+=G>>>1&8191;var $=e[r+10]|e[r+11]<<8;d+=(G>>>14|$<<2)&8191;var pe=e[r+12]|e[r+13]<<8;y+=($>>>11|pe<<5)&8191;var ae=e[r+14]|e[r+15]<<8;w+=(pe>>>8|ae<<8)&8191,E+=ae>>>5|i;var re=0,Y=re;Y+=s*N,Y+=o*(5*S),Y+=a*(5*_),Y+=u*(5*B),Y+=l*(5*P),re=Y>>>13,Y&=8191,Y+=f*(5*T),Y+=d*(5*b),Y+=y*(5*x),Y+=w*(5*M),Y+=E*(5*R),re+=Y>>>13,Y&=8191;var ie=re;ie+=s*R,ie+=o*N,ie+=a*(5*S),ie+=u*(5*_),ie+=l*(5*B),re=ie>>>13,ie&=8191,ie+=f*(5*P),ie+=d*(5*T),ie+=y*(5*b),ie+=w*(5*x),ie+=E*(5*M),re+=ie>>>13,ie&=8191;var te=re;te+=s*M,te+=o*R,te+=a*N,te+=u*(5*S),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*B),te+=d*(5*P),te+=y*(5*T),te+=w*(5*b),te+=E*(5*x),re+=te>>>13,te&=8191;var ne=re;ne+=s*x,ne+=o*M,ne+=a*R,ne+=u*N,ne+=l*(5*S),re=ne>>>13,ne&=8191,ne+=f*(5*_),ne+=d*(5*B),ne+=y*(5*P),ne+=w*(5*T),ne+=E*(5*b),re+=ne>>>13,ne&=8191;var q=re;q+=s*b,q+=o*x,q+=a*M,q+=u*R,q+=l*N,re=q>>>13,q&=8191,q+=f*(5*S),q+=d*(5*_),q+=y*(5*B),q+=w*(5*P),q+=E*(5*T),re+=q>>>13,q&=8191;var ce=re;ce+=s*T,ce+=o*b,ce+=a*x,ce+=u*M,ce+=l*R,re=ce>>>13,ce&=8191,ce+=f*N,ce+=d*(5*S),ce+=y*(5*_),ce+=w*(5*B),ce+=E*(5*P),re+=ce>>>13,ce&=8191;var oe=re;oe+=s*P,oe+=o*T,oe+=a*b,oe+=u*x,oe+=l*M,re=oe>>>13,oe&=8191,oe+=f*R,oe+=d*N,oe+=y*(5*S),oe+=w*(5*_),oe+=E*(5*B),re+=oe>>>13,oe&=8191;var le=re;le+=s*B,le+=o*P,le+=a*T,le+=u*b,le+=l*x,re=le>>>13,le&=8191,le+=f*M,le+=d*R,le+=y*N,le+=w*(5*S),le+=E*(5*_),re+=le>>>13,le&=8191;var se=re;se+=s*_,se+=o*B,se+=a*P,se+=u*T,se+=l*b,re=se>>>13,se&=8191,se+=f*x,se+=d*M,se+=y*R,se+=w*N,se+=E*(5*S),re+=se>>>13,se&=8191;var ue=re;ue+=s*S,ue+=o*_,ue+=a*B,ue+=u*P,ue+=l*T,re=ue>>>13,ue&=8191,ue+=f*b,ue+=d*x,ue+=y*M,ue+=w*R,ue+=E*N,re+=ue>>>13,ue&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,ie+=re,s=Y,o=ie,a=te,u=ne,l=q,f=ce,d=oe,y=le,w=se,E=ue,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=y,this._h[8]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=1<<13,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Wn,"__esModule",{value:!0});var ep=XN(),cG=tD(),hl=Cr(),rD=hu(),lG=Xd();Wn.KEY_LENGTH=32;Wn.NONCE_LENGTH=12;Wn.TAG_LENGTH=16;var nD=new Uint8Array(16),fG=function(){function t(e){if(this.nonceLength=Wn.NONCE_LENGTH,this.tagLength=Wn.TAG_LENGTH,e.length!==Wn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);ep.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return ep.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),hl.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(nD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(nD.subarray(n.length%16));var o=new Uint8Array(8);i&&rD.writeUint64LE(i.length,o),s.update(o),rD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(W1,"__esModule",{value:!0});function hG(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}W1.isSerializableHash=hG});var aD=v(dl=>{"use strict";c();Object.defineProperty(dl,"__esModule",{value:!0});var vn=sD(),dG=Xd(),pG=Cr(),oD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty($1,"__esModule",{value:!0});var uD=aD(),cD=Cr(),yG=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=uD.hmac(this._hash,n,r);this._hmac=new uD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});var rp=hu(),tp=Cr();Fi.DIGEST_LENGTH=32;Fi.BLOCK_SIZE=64;var fD=function(){function t(){this.digestLength=Fi.DIGEST_LENGTH,this.blockSize=Fi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){tp.wipe(this._buffer),tp.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(Y1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=Y1(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){tp.wipe(e.state),e.buffer&&tp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Fi.SHA256=fD;var mG=new Int32Array([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]);function Y1(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],y=e[7],w=0;w<16;w++){var E=n+w*4;t[w]=rp.readUint32BE(r,E)}for(var w=16;w<64;w++){var N=t[w-2],R=(N>>>17|N<<32-17)^(N>>>19|N<<32-19)^N>>>10;N=t[w-15];var M=(N>>>7|N<<32-7)^(N>>>18|N<<32-18)^N>>>3;t[w]=(R+t[w-7]|0)+(M+t[w-16]|0)}for(var w=0;w<64;w++){var R=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(y+(mG[w]+t[w]|0)|0)|0,M=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;y=d,d=f,f=l,l=u+R|0,u=a,a=o,o=s,s=R+M|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=y,n+=64,i-=64}return n}function wG(t){var e=new fD;e.update(t);var r=e.digest();return e.clean(),r}Fi.hash=wG});var yD=v(ct=>{"use strict";c();Object.defineProperty(ct,"__esModule",{value:!0});ct.sharedKey=ct.generateKeyPair=ct.generateKeyPairFromSeed=ct.scalarMultBase=ct.scalarMult=ct.SHARED_KEY_LENGTH=ct.SECRET_KEY_LENGTH=ct.PUBLIC_KEY_LENGTH=void 0;var EG=el(),vG=Cr();ct.PUBLIC_KEY_LENGTH=32;ct.SECRET_KEY_LENGTH=32;ct.SHARED_KEY_LENGTH=32;function An(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,pl(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function bG(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function np(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ip(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $n(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,N=0,R=0,M=0,x=0,b=0,T=0,P=0,B=0,_=0,S=0,F=0,Z=0,K=0,H=0,G=0,$=0,pe=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],O=r[11],I=r[12],D=r[13],L=r[14],C=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,N+=n*A,R+=n*O,M+=n*I,x+=n*D,b+=n*L,T+=n*C,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,N+=n*m,R+=n*A,M+=n*O,x+=n*I,b+=n*D,T+=n*L,P+=n*C,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,N+=n*g,R+=n*m,M+=n*A,x+=n*O,b+=n*I,T+=n*D,P+=n*L,B+=n*C,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,N+=n*ue,R+=n*g,M+=n*m,x+=n*A,b+=n*O,T+=n*I,P+=n*D,B+=n*L,_+=n*C,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,N+=n*se,R+=n*ue,M+=n*g,x+=n*m,b+=n*A,T+=n*O,P+=n*I,B+=n*D,_+=n*L,S+=n*C,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,N+=n*le,R+=n*se,M+=n*ue,x+=n*g,b+=n*m,T+=n*A,P+=n*O,B+=n*I,_+=n*D,S+=n*L,F+=n*C,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,N+=n*oe,R+=n*le,M+=n*se,x+=n*ue,b+=n*g,T+=n*m,P+=n*A,B+=n*O,_+=n*I,S+=n*D,F+=n*L,Z+=n*C,n=e[7],y+=n*te,w+=n*ne,E+=n*q,N+=n*ce,R+=n*oe,M+=n*le,x+=n*se,b+=n*ue,T+=n*g,P+=n*m,B+=n*A,_+=n*O,S+=n*I,F+=n*D,Z+=n*L,K+=n*C,n=e[8],w+=n*te,E+=n*ne,N+=n*q,R+=n*ce,M+=n*oe,x+=n*le,b+=n*se,T+=n*ue,P+=n*g,B+=n*m,_+=n*A,S+=n*O,F+=n*I,Z+=n*D,K+=n*L,H+=n*C,n=e[9],E+=n*te,N+=n*ne,R+=n*q,M+=n*ce,x+=n*oe,b+=n*le,T+=n*se,P+=n*ue,B+=n*g,_+=n*m,S+=n*A,F+=n*O,Z+=n*I,K+=n*D,H+=n*L,G+=n*C,n=e[10],N+=n*te,R+=n*ne,M+=n*q,x+=n*ce,b+=n*oe,T+=n*le,P+=n*se,B+=n*ue,_+=n*g,S+=n*m,F+=n*A,Z+=n*O,K+=n*I,H+=n*D,G+=n*L,$+=n*C,n=e[11],R+=n*te,M+=n*ne,x+=n*q,b+=n*ce,T+=n*oe,P+=n*le,B+=n*se,_+=n*ue,S+=n*g,F+=n*m,Z+=n*A,K+=n*O,H+=n*I,G+=n*D,$+=n*L,pe+=n*C,n=e[12],M+=n*te,x+=n*ne,b+=n*q,T+=n*ce,P+=n*oe,B+=n*le,_+=n*se,S+=n*ue,F+=n*g,Z+=n*m,K+=n*A,H+=n*O,G+=n*I,$+=n*D,pe+=n*L,ae+=n*C,n=e[13],x+=n*te,b+=n*ne,T+=n*q,P+=n*ce,B+=n*oe,_+=n*le,S+=n*se,F+=n*ue,Z+=n*g,K+=n*m,H+=n*A,G+=n*O,$+=n*I,pe+=n*D,ae+=n*L,re+=n*C,n=e[14],b+=n*te,T+=n*ne,P+=n*q,B+=n*ce,_+=n*oe,S+=n*le,F+=n*se,Z+=n*ue,K+=n*g,H+=n*m,G+=n*A,$+=n*O,pe+=n*I,ae+=n*D,re+=n*L,Y+=n*C,n=e[15],T+=n*te,P+=n*ne,B+=n*q,_+=n*ce,S+=n*oe,F+=n*le,Z+=n*se,K+=n*ue,H+=n*g,G+=n*m,$+=n*A,pe+=n*O,ae+=n*I,re+=n*D,Y+=n*L,ie+=n*C,s+=38*P,o+=38*B,a+=38*_,u+=38*S,l+=38*F,f+=38*Z,d+=38*K,y+=38*H,w+=38*G,E+=38*$,N+=38*pe,R+=38*ae,M+=38*re,x+=38*Y,b+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=N,t[11]=R,t[12]=M,t[13]=x,t[14]=b,t[15]=T}function gl(t,e){$n(t,e,e)}function IG(t,e){let r=An();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)gl(r,r),n!==2&&n!==4&&$n(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function X1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=An(),s=An(),o=An(),a=An(),u=An(),l=An();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,bG(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;pl(i,s,E),pl(o,a,E),np(u,i,o),ip(i,i,o),np(o,s,a),ip(s,s,a),gl(a,u),gl(l,i),$n(i,o,i),$n(o,s,u),np(u,i,o),ip(i,i,o),gl(s,i),ip(o,a,l),$n(i,o,AG),np(i,i,a),$n(o,o,i),$n(i,a,l),$n(a,s,n),gl(s,u),pl(i,s,E),pl(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);IG(f,f),$n(d,d,f);let y=new Uint8Array(32);return _G(y,d),y}ct.scalarMult=X1;function pD(t){return X1(t,dD)}ct.scalarMultBase=pD;function gD(t){if(t.length!==ct.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${ct.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:pD(e),secretKey:e}}ct.generateKeyPairFromSeed=gD;function SG(t){let e=(0,EG.randomBytes)(32,t),r=gD(e);return(0,vG.wipe)(e),r}ct.generateKeyPair=SG;function CG(t,e,r=!1){if(t.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=X1(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function ED(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function AD(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=wu(t.length);for(let n=0;n{c();Qd();il()});var Z1={};ot(Z1,{compare:()=>mD,concat:()=>kd,equals:()=>ED,fromString:()=>En,toString:()=>Kn,xor:()=>AD});var ev=ge(()=>{c();wD();d1();vD();V1();q1();_D()});var RD=v(Ze=>{"use strict";c();var bD=Ze&&Ze.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new DD:typeof navigator<"u"?tv(navigator.userAgent):BD()}Ze.detect=DG;function OD(t){return t!==""&&NG.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function OG(t){var e=OD(t);return e?e[0]:null}Ze.browserName=OG;function tv(t){var e=OD(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new ND;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.getLocalStorage=ze.getLocalStorageOrThrow=ze.getCrypto=ze.getCryptoOrThrow=ze.getLocation=ze.getLocationOrThrow=ze.getNavigator=ze.getNavigatorOrThrow=ze.getDocument=ze.getDocumentOrThrow=ze.getFromWindowOrThrow=ze.getFromWindow=void 0;function ao(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ze.getFromWindow=ao;function Cu(t){let e=ao(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ze.getFromWindowOrThrow=Cu;function BG(){return Cu("document")}ze.getDocumentOrThrow=BG;function RG(){return ao("document")}ze.getDocument=RG;function LG(){return Cu("navigator")}ze.getNavigatorOrThrow=LG;function FG(){return ao("navigator")}ze.getNavigator=FG;function MG(){return Cu("location")}ze.getLocationOrThrow=MG;function UG(){return ao("location")}ze.getLocation=UG;function qG(){return Cu("crypto")}ze.getCryptoOrThrow=qG;function VG(){return ao("crypto")}ze.getCrypto=VG;function jG(){return Cu("localStorage")}ze.getLocalStorageOrThrow=jG;function HG(){return ao("localStorage")}ze.getLocalStorage=HG});var FD=v(sp=>{"use strict";c();Object.defineProperty(sp,"__esModule",{value:!0});sp.getWindowMetadata=void 0;var LD=rv();function GG(){let t,e;try{t=LD.getDocumentOrThrow(),e=LD.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),y=[];for(let w=0;w-1){let R=E.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let M=e.protocol+"//"+e.host;if(R.indexOf("/")===0)M+=R;else{let x=e.pathname.split("/");x.pop();let b=x.join("/");M+=b+"/"+R}y.push(M)}else if(R.indexOf("//")===0){let M=e.protocol+R;y.push(M)}else y.push(R)}}return y}function n(...d){let y=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(R)).filter(R=>R?d.includes(R):!1);if(N.length&&N){let R=E.getAttribute("content");if(R)return R}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}sp.getWindowMetadata=GG});var UD=v((Kae,MD)=>{"use strict";c();MD.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var GD=v((Wae,HD)=>{"use strict";c();var jD="%[a-f0-9]{2}",qD=new RegExp("("+jD+")|([^%]+?)","gi"),VD=new RegExp("("+jD+")+","gi");function nv(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],nv(r),nv(n))}function QG(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(qD)||[],r=1;r{"use strict";c();QD.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var zD=v((Xae,KD)=>{"use strict";c();KD.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var KG=UD(),zG=GD(),$D=kD(),WG=zD(),$G=t=>t==null,iv=Symbol("encodeFragmentIdentifier");function YG(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[",i,"]"].join("")]:[...r,[pt(e,t),"[",pt(i,t),"]=",pt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[]"].join("")]:[...r,[pt(e,t),"[]=",pt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),":list="].join("")]:[...r,[pt(e,t),":list=",pt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[pt(r,t),e,pt(i,t)].join("")]:[[n,pt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,pt(e,t)]:[...r,[pt(e,t),"=",pt(n,t)].join("")]}}function JG(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&Yn(n,t).includes(t.arrayFormatSeparator);n=o?Yn(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>Yn(u,t)):n===null?n:Yn(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Yn(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>Yn(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function YD(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function pt(t,e){return e.encode?e.strict?KG(t):encodeURIComponent(t):t}function Yn(t,e){return e.decode?zG(t):t}function JD(t){return Array.isArray(t)?t.sort():typeof t=="object"?JD(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function XD(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function XG(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function ZD(t){t=XD(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function WD(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function eO(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),YD(e.arrayFormatSeparator);let r=JG(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=$D(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Yn(o,e),r(Yn(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=WD(s[o],e);else n[i]=WD(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=JD(o):i[s]=o,i},Object.create(null))}ir.extract=ZD;ir.parse=eO;ir.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),YD(e.arrayFormatSeparator);let r=o=>e.skipNull&&$G(t[o])||e.skipEmptyString&&t[o]==="",n=YG(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?pt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?pt(o,e)+"[]":a.reduce(n(o),[]).join("&"):pt(o,e)+"="+pt(a,e)}).filter(o=>o.length>0).join("&")};ir.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=$D(t,"#");return Object.assign({url:r.split("?")[0]||"",query:eO(ZD(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Yn(n,e)}:{})};ir.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[iv]:!0},e);let r=XD(t.url).split("?")[0]||"",n=ir.extract(t.url),i=ir.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=ir.stringify(s,e);o&&(o=`?${o}`);let a=XG(t.url);return t.fragmentIdentifier&&(a=`#${e[iv]?pt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};ir.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[iv]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=ir.parseUrl(t,r);return ir.stringifyUrl({url:n,query:WG(i,e),fragmentIdentifier:s},r)};ir.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return ir.pick(t,n,r)}});var rO=ge(()=>{c()});function Mi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function ZG(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function e9(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function t9(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function yl(t,e,r){return(!r.length?e9(t,e.length):t9(t,e.length))?ZG(t,e):!1}function ml(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var sv=ge(()=>{c()});function r9(t){return op(t.method)&&ap(t.params)}function op(t){return ml(t,"subscribe")}function ap(t){return yl(t,["topic"],[])}function n9(t){return up(t.method)&&cp(t.params)}function up(t){return ml(t,"publish")}function cp(t){return yl(t,["message","topic","ttl"],["prompt","tag"])}function i9(t){return lp(t.method)&&fp(t.params)}function lp(t){return ml(t,"unsubscribe")}function fp(t){return yl(t,["id","topic"],[])}function s9(t){return hp(t.method)&&dp(t.params)}function hp(t){return ml(t,"subscription")}function dp(t){return yl(t,["id","data"],[])}var ov=ge(()=>{c();sv()});function o9(t){if(!op(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!ap(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Mi(e,"topic"),e}function a9(t){if(!up(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!cp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Mi(e,"topic"),Mi(e,"message"),Mi(e,"ttl","number"),e}function u9(t){if(!lp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!fp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Mi(e,"id"),e}function c9(t){if(!hp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!dp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Mi(e,"id"),Mi(e,"data"),e}var nO=ge(()=>{c();sv();ov()});var l9,iO=ge(()=>{c();l9={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var sO={};ot(sO,{RELAY_JSONRPC:()=>l9,isPublishMethod:()=>up,isPublishParams:()=>cp,isPublishRequest:()=>n9,isSubscribeMethod:()=>op,isSubscribeParams:()=>ap,isSubscribeRequest:()=>r9,isSubscriptionMethod:()=>hp,isSubscriptionParams:()=>dp,isSubscriptionRequest:()=>s9,isUnsubscribeMethod:()=>lp,isUnsubscribeParams:()=>fp,isUnsubscribeRequest:()=>i9,parsePublishRequest:()=>a9,parseSubscribeRequest:()=>o9,parseSubscriptionRequest:()=>c9,parseUnsubscribeRequest:()=>u9});var oO=ge(()=>{c();rO();nO();iO();ov()});var Ip=v(Q=>{"use strict";c();Object.defineProperty(Q,"__esModule",{value:!0});var yO=iD(),f9=lD(),mO=el(),lv=hD(),h9=yD(),et=(ev(),rt(Z1)),d9=RD(),xu=to(),wl=rv(),p9=FD(),g9=tO(),y9=(oO(),rt(sO));function wO(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var EO=wO(h9),pp=wO(g9),mp=":";function vO(t){let[e,r]=t.split(mp);return{namespace:e,reference:r}}function AO(t){let{namespace:e,reference:r}=t;return[e,r].join(mp)}function fv(t){let[e,r,n]=t.split(mp);return{namespace:e,reference:r,address:n}}function _O(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(mp)}function hv(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function bO(t){let{address:e}=fv(t);return e}function IO(t){let{namespace:e,reference:r}=fv(t);return AO({namespace:e,reference:r})}function m9(t,e){let{namespace:r,reference:n}=vO(e);return _O({namespace:r,reference:n,address:t})}function w9(t){return hv(t,bO)}function SO(t){return hv(t,IO)}function E9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function v9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...SO(i.accounts))}),r}function A9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...wp(n,i))}),r}function wp(t,e){return t.includes(":")?[t]:e.chains||[]}var Ep=t=>t?.split(":"),CO=t=>{let e=t&&Ep(t);if(e)return e[3]},_9=t=>{let e=t&&Ep(t);if(e)return e[2]+":"+e[3]},TO=t=>{let e=t&&Ep(t);if(e)return e.pop()},b9=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=TO(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${CO(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var MN=ge(()=>{c();FN();kd();Ri();O1();ul()});var R1,Coe,UN=ge(()=>{c();fN();hN();dN();pN();gN();_1();yN();S1();mN();EN();xN();ON();PN();BN();MN();R1={...y1,...m1,...w1,...E1,...v1,...A1,...b1,...I1,...C1,...T1},Coe={...P1,...B1}});function VN(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var qN,L1,Q7,Wd,F1=ge(()=>{c();UN();jd();qN=VN("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),L1=VN("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=wu(t.length);for(let r=0;r{c();F1()});function En(t,e="utf8"){let r=Wd[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Bi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var U1=ge(()=>{c();F1();il()});function ll(t){return Xc(Kn(En(t,yu),Ld))}function fl(t){return Kn(En(Zc(t),Ld),yu)}function q1(t){let e=En(Vd,mu),r=qd+Kn(Gd([e,t]),mu);return[Md,Ud,r].join(Fd)}function V1(t){let[e,r,n]=t.split(Fd);if(e!==Md||r!==Ud)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==qd)throw new Error("Issuer must be a key in mulicodec format");let s=En(n.slice(1),mu);if(Kn(s.slice(0,2),mu)!==Vd)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function HN(t){return Kn(t,yu)}function jN(t){return En(t,yu)}function H1(t){return En([fl(t.header),fl(t.payload)].join(oo),nl)}function k7(t){let e=Kn(t,nl).split(oo),r=ll(e[0]),n=ll(e[1]);return{header:r,payload:n}}function j1(t){return[fl(t.header),fl(t.payload),HN(t.signature)].join(oo)}function G1(t){let e=t.split(oo),r=ll(e[0]),n=ll(e[1]),i=jN(e[2]),s=En(e.slice(0,2).join(oo),nl);return{header:r,payload:n,signature:i,data:s}}var Q1=ge(()=>{c();f1();M1();U1();Td();Hd()});function K7(t=(0,GN.randomBytes)(32)){return Iu.generateKeyPairFromSeed(t)}async function z7(t,e,r,n,i=(0,QN.fromMiliseconds)(Date.now())){let s={alg:Bd,typ:Rd},o=q1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=H1({header:s,payload:u}),f=Iu.sign(n.secretKey,l);return j1({header:s,payload:u,signature:f})}async function W7(t){let{header:e,payload:r,data:n,signature:i}=G1(t);if(e.alg!==Bd||e.typ!==Rd)throw new Error("JWT must use EdDSA algorithm");let s=V1(r.iss);return Iu.verify(s,n,i)}var Iu,GN,QN,kN=ge(()=>{c();Iu=be(tN()),GN=be(el()),QN=be(ro());Hd();Q1()});var KN=ge(()=>{c()});var zN={};at(zN,{DATA_ENCODING:()=>nl,DID_DELIMITER:()=>Fd,DID_METHOD:()=>Ud,DID_PREFIX:()=>Md,JSON_ENCODING:()=>Ld,JWT_DELIMITER:()=>oo,JWT_ENCODING:()=>yu,JWT_IRIDIUM_ALG:()=>Bd,JWT_IRIDIUM_TYP:()=>Rd,KEY_PAIR_SEED_LENGTH:()=>nN,MULTICODEC_ED25519_BASE:()=>qd,MULTICODEC_ED25519_ENCODING:()=>mu,MULTICODEC_ED25519_HEADER:()=>Vd,MULTICODEC_ED25519_LENGTH:()=>rN,decodeData:()=>k7,decodeIss:()=>V1,decodeJSON:()=>ll,decodeJWT:()=>G1,decodeSig:()=>jN,encodeData:()=>H1,encodeIss:()=>q1,encodeJSON:()=>fl,encodeJWT:()=>j1,encodeSig:()=>HN,generateKeyPair:()=>K7,signJWT:()=>z7,verifyJWT:()=>W7});var WN=ge(()=>{c();kN();Hd();KN();Q1()});var YN=v($d=>{"use strict";c();Object.defineProperty($d,"__esModule",{value:!0});var kt=hu(),k1=Cr(),$7=20;function Y7(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],_=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],x=n,O=i,P=s,L=o,b=a,C=u,M=l,Z=f,K=d,j=y,G=w,$=E,de=T,ae=R,re=_,Y=B,ie=0;ie<$7;ie+=2)x=x+b|0,de^=x,de=de>>>32-16|de<<16,K=K+de|0,b^=K,b=b>>>32-12|b<<12,O=O+C|0,ae^=O,ae=ae>>>32-16|ae<<16,j=j+ae|0,C^=j,C=C>>>32-12|C<<12,P=P+M|0,re^=P,re=re>>>32-16|re<<16,G=G+re|0,M^=G,M=M>>>32-12|M<<12,L=L+Z|0,Y^=L,Y=Y>>>32-16|Y<<16,$=$+Y|0,Z^=$,Z=Z>>>32-12|Z<<12,P=P+M|0,re^=P,re=re>>>32-8|re<<8,G=G+re|0,M^=G,M=M>>>32-7|M<<7,L=L+Z|0,Y^=L,Y=Y>>>32-8|Y<<8,$=$+Y|0,Z^=$,Z=Z>>>32-7|Z<<7,O=O+C|0,ae^=O,ae=ae>>>32-8|ae<<8,j=j+ae|0,C^=j,C=C>>>32-7|C<<7,x=x+b|0,de^=x,de=de>>>32-8|de<<8,K=K+de|0,b^=K,b=b>>>32-7|b<<7,x=x+C|0,Y^=x,Y=Y>>>32-16|Y<<16,G=G+Y|0,C^=G,C=C>>>32-12|C<<12,O=O+M|0,de^=O,de=de>>>32-16|de<<16,$=$+de|0,M^=$,M=M>>>32-12|M<<12,P=P+Z|0,ae^=P,ae=ae>>>32-16|ae<<16,K=K+ae|0,Z^=K,Z=Z>>>32-12|Z<<12,L=L+b|0,re^=L,re=re>>>32-16|re<<16,j=j+re|0,b^=j,b=b>>>32-12|b<<12,P=P+Z|0,ae^=P,ae=ae>>>32-8|ae<<8,K=K+ae|0,Z^=K,Z=Z>>>32-7|Z<<7,L=L+b|0,re^=L,re=re>>>32-8|re<<8,j=j+re|0,b^=j,b=b>>>32-7|b<<7,O=O+M|0,de^=O,de=de>>>32-8|de<<8,$=$+de|0,M^=$,M=M>>>32-7|M<<7,x=x+C|0,Y^=x,Y=Y>>>32-8|Y<<8,G=G+Y|0,C^=G,C=C>>>32-7|C<<7;kt.writeUint32LE(x+n|0,t,0),kt.writeUint32LE(O+i|0,t,4),kt.writeUint32LE(P+s|0,t,8),kt.writeUint32LE(L+o|0,t,12),kt.writeUint32LE(b+a|0,t,16),kt.writeUint32LE(C+u|0,t,20),kt.writeUint32LE(M+l|0,t,24),kt.writeUint32LE(Z+f|0,t,28),kt.writeUint32LE(K+d|0,t,32),kt.writeUint32LE(j+y|0,t,36),kt.writeUint32LE(G+w|0,t,40),kt.writeUint32LE($+E|0,t,44),kt.writeUint32LE(de+T|0,t,48),kt.writeUint32LE(ae+R|0,t,52),kt.writeUint32LE(re+_|0,t,56),kt.writeUint32LE(Y+B|0,t,60)}function $N(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var Yd=v(Su=>{"use strict";c();Object.defineProperty(Su,"__esModule",{value:!0});function Z7(t,e,r){return~(t-1)&e|t-1&r}Su.select=Z7;function eG(t,e){return(t|0)-(e|0)-1>>>31&1}Su.lessOrEqual=eG;function JN(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Su.compare=JN;function tG(t,e){return t.length===0||e.length===0?!1:JN(t,e)!==0}Su.equal=tG});var ZN=v(zn=>{"use strict";c();Object.defineProperty(zn,"__esModule",{value:!0});var rG=Yd(),Jd=Cr();zn.DIGEST_LENGTH=16;var XN=function(){function t(e){this.digestLength=zn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],y=this._h[7],w=this._h[8],E=this._h[9],T=this._r[0],R=this._r[1],_=this._r[2],B=this._r[3],x=this._r[4],O=this._r[5],P=this._r[6],L=this._r[7],b=this._r[8],C=this._r[9];n>=16;){var M=e[r+0]|e[r+1]<<8;s+=M&8191;var Z=e[r+2]|e[r+3]<<8;o+=(M>>>13|Z<<3)&8191;var K=e[r+4]|e[r+5]<<8;a+=(Z>>>10|K<<6)&8191;var j=e[r+6]|e[r+7]<<8;u+=(K>>>7|j<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(j>>>4|G<<12)&8191,f+=G>>>1&8191;var $=e[r+10]|e[r+11]<<8;d+=(G>>>14|$<<2)&8191;var de=e[r+12]|e[r+13]<<8;y+=($>>>11|de<<5)&8191;var ae=e[r+14]|e[r+15]<<8;w+=(de>>>8|ae<<8)&8191,E+=ae>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*C),Y+=a*(5*b),Y+=u*(5*L),Y+=l*(5*P),re=Y>>>13,Y&=8191,Y+=f*(5*O),Y+=d*(5*x),Y+=y*(5*B),Y+=w*(5*_),Y+=E*(5*R),re+=Y>>>13,Y&=8191;var ie=re;ie+=s*R,ie+=o*T,ie+=a*(5*C),ie+=u*(5*b),ie+=l*(5*L),re=ie>>>13,ie&=8191,ie+=f*(5*P),ie+=d*(5*O),ie+=y*(5*x),ie+=w*(5*B),ie+=E*(5*_),re+=ie>>>13,ie&=8191;var te=re;te+=s*_,te+=o*R,te+=a*T,te+=u*(5*C),te+=l*(5*b),re=te>>>13,te&=8191,te+=f*(5*L),te+=d*(5*P),te+=y*(5*O),te+=w*(5*x),te+=E*(5*B),re+=te>>>13,te&=8191;var ne=re;ne+=s*B,ne+=o*_,ne+=a*R,ne+=u*T,ne+=l*(5*C),re=ne>>>13,ne&=8191,ne+=f*(5*b),ne+=d*(5*L),ne+=y*(5*P),ne+=w*(5*O),ne+=E*(5*x),re+=ne>>>13,ne&=8191;var q=re;q+=s*x,q+=o*B,q+=a*_,q+=u*R,q+=l*T,re=q>>>13,q&=8191,q+=f*(5*C),q+=d*(5*b),q+=y*(5*L),q+=w*(5*P),q+=E*(5*O),re+=q>>>13,q&=8191;var ce=re;ce+=s*O,ce+=o*x,ce+=a*B,ce+=u*_,ce+=l*R,re=ce>>>13,ce&=8191,ce+=f*T,ce+=d*(5*C),ce+=y*(5*b),ce+=w*(5*L),ce+=E*(5*P),re+=ce>>>13,ce&=8191;var oe=re;oe+=s*P,oe+=o*O,oe+=a*x,oe+=u*B,oe+=l*_,re=oe>>>13,oe&=8191,oe+=f*R,oe+=d*T,oe+=y*(5*C),oe+=w*(5*b),oe+=E*(5*L),re+=oe>>>13,oe&=8191;var le=re;le+=s*L,le+=o*P,le+=a*O,le+=u*x,le+=l*B,re=le>>>13,le&=8191,le+=f*_,le+=d*R,le+=y*T,le+=w*(5*C),le+=E*(5*b),re+=le>>>13,le&=8191;var se=re;se+=s*b,se+=o*L,se+=a*P,se+=u*O,se+=l*x,re=se>>>13,se&=8191,se+=f*B,se+=d*_,se+=y*R,se+=w*T,se+=E*(5*C),re+=se>>>13,se&=8191;var ue=re;ue+=s*C,ue+=o*b,ue+=a*L,ue+=u*P,ue+=l*O,re=ue>>>13,ue&=8191,ue+=f*x,ue+=d*B,ue+=y*_,ue+=w*R,ue+=E*T,re+=ue>>>13,ue&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,ie+=re,s=Y,o=ie,a=te,u=ne,l=q,f=ce,d=oe,y=le,w=se,E=ue,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=y,this._h[8]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Wn,"__esModule",{value:!0});var Xd=YN(),sG=ZN(),hl=Cr(),eD=hu(),oG=Yd();Wn.KEY_LENGTH=32;Wn.NONCE_LENGTH=12;Wn.TAG_LENGTH=16;var tD=new Uint8Array(16),aG=function(){function t(e){if(this.nonceLength=Wn.NONCE_LENGTH,this.tagLength=Wn.TAG_LENGTH,e.length!==Wn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);Xd.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return Xd.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),hl.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(tD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(tD.subarray(n.length%16));var o=new Uint8Array(8);i&&eD.writeUint64LE(i.length,o),s.update(o),eD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(K1,"__esModule",{value:!0});function uG(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}K1.isSerializableHash=uG});var sD=v(dl=>{"use strict";c();Object.defineProperty(dl,"__esModule",{value:!0});var vn=nD(),cG=Yd(),lG=Cr(),iD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(z1,"__esModule",{value:!0});var oD=sD(),aD=Cr(),hG=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=oD.hmac(this._hash,n,r);this._hmac=new oD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});var ep=hu(),Zd=Cr();Fi.DIGEST_LENGTH=32;Fi.BLOCK_SIZE=64;var cD=function(){function t(){this.digestLength=Fi.DIGEST_LENGTH,this.blockSize=Fi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Zd.wipe(this._buffer),Zd.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(W1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=W1(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Zd.wipe(e.state),e.buffer&&Zd.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Fi.SHA256=cD;var dG=new Int32Array([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]);function W1(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],y=e[7],w=0;w<16;w++){var E=n+w*4;t[w]=ep.readUint32BE(r,E)}for(var w=16;w<64;w++){var T=t[w-2],R=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[w-15];var _=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[w]=(R+t[w-7]|0)+(_+t[w-16]|0)}for(var w=0;w<64;w++){var R=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(y+(dG[w]+t[w]|0)|0)|0,_=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;y=d,d=f,f=l,l=u+R|0,u=a,a=o,o=s,s=R+_|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=y,n+=64,i-=64}return n}function pG(t){var e=new cD;e.update(t);var r=e.digest();return e.clean(),r}Fi.hash=pG});var pD=v(lt=>{"use strict";c();Object.defineProperty(lt,"__esModule",{value:!0});lt.sharedKey=lt.generateKeyPair=lt.generateKeyPairFromSeed=lt.scalarMultBase=lt.scalarMult=lt.SHARED_KEY_LENGTH=lt.SECRET_KEY_LENGTH=lt.PUBLIC_KEY_LENGTH=void 0;var gG=el(),yG=Cr();lt.PUBLIC_KEY_LENGTH=32;lt.SECRET_KEY_LENGTH=32;lt.SHARED_KEY_LENGTH=32;function An(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,pl(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function EG(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function tp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function rp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $n(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,T=0,R=0,_=0,B=0,x=0,O=0,P=0,L=0,b=0,C=0,M=0,Z=0,K=0,j=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],D=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,T+=n*A,R+=n*D,_+=n*I,B+=n*N,x+=n*F,O+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,T+=n*m,R+=n*A,_+=n*D,B+=n*I,x+=n*N,O+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,T+=n*g,R+=n*m,_+=n*A,B+=n*D,x+=n*I,O+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,T+=n*ue,R+=n*g,_+=n*m,B+=n*A,x+=n*D,O+=n*I,P+=n*N,L+=n*F,b+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,T+=n*se,R+=n*ue,_+=n*g,B+=n*m,x+=n*A,O+=n*D,P+=n*I,L+=n*N,b+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,T+=n*le,R+=n*se,_+=n*ue,B+=n*g,x+=n*m,O+=n*A,P+=n*D,L+=n*I,b+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,T+=n*oe,R+=n*le,_+=n*se,B+=n*ue,x+=n*g,O+=n*m,P+=n*A,L+=n*D,b+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,w+=n*ne,E+=n*q,T+=n*ce,R+=n*oe,_+=n*le,B+=n*se,x+=n*ue,O+=n*g,P+=n*m,L+=n*A,b+=n*D,C+=n*I,M+=n*N,Z+=n*F,K+=n*S,n=e[8],w+=n*te,E+=n*ne,T+=n*q,R+=n*ce,_+=n*oe,B+=n*le,x+=n*se,O+=n*ue,P+=n*g,L+=n*m,b+=n*A,C+=n*D,M+=n*I,Z+=n*N,K+=n*F,j+=n*S,n=e[9],E+=n*te,T+=n*ne,R+=n*q,_+=n*ce,B+=n*oe,x+=n*le,O+=n*se,P+=n*ue,L+=n*g,b+=n*m,C+=n*A,M+=n*D,Z+=n*I,K+=n*N,j+=n*F,G+=n*S,n=e[10],T+=n*te,R+=n*ne,_+=n*q,B+=n*ce,x+=n*oe,O+=n*le,P+=n*se,L+=n*ue,b+=n*g,C+=n*m,M+=n*A,Z+=n*D,K+=n*I,j+=n*N,G+=n*F,$+=n*S,n=e[11],R+=n*te,_+=n*ne,B+=n*q,x+=n*ce,O+=n*oe,P+=n*le,L+=n*se,b+=n*ue,C+=n*g,M+=n*m,Z+=n*A,K+=n*D,j+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],_+=n*te,B+=n*ne,x+=n*q,O+=n*ce,P+=n*oe,L+=n*le,b+=n*se,C+=n*ue,M+=n*g,Z+=n*m,K+=n*A,j+=n*D,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],B+=n*te,x+=n*ne,O+=n*q,P+=n*ce,L+=n*oe,b+=n*le,C+=n*se,M+=n*ue,Z+=n*g,K+=n*m,j+=n*A,G+=n*D,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,O+=n*ne,P+=n*q,L+=n*ce,b+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,K+=n*g,j+=n*m,G+=n*A,$+=n*D,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],O+=n*te,P+=n*ne,L+=n*q,b+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,K+=n*ue,j+=n*g,G+=n*m,$+=n*A,de+=n*D,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*b,u+=38*C,l+=38*M,f+=38*Z,d+=38*K,y+=38*j,w+=38*G,E+=38*$,T+=38*de,R+=38*ae,_+=38*re,B+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=T,t[11]=R,t[12]=_,t[13]=B,t[14]=x,t[15]=O}function gl(t,e){$n(t,e,e)}function vG(t,e){let r=An();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)gl(r,r),n!==2&&n!==4&&$n(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function Y1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=An(),s=An(),o=An(),a=An(),u=An(),l=An();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,EG(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;pl(i,s,E),pl(o,a,E),tp(u,i,o),rp(i,i,o),tp(o,s,a),rp(s,s,a),gl(a,u),gl(l,i),$n(i,o,i),$n(o,s,u),tp(u,i,o),rp(i,i,o),gl(s,i),rp(o,a,l),$n(i,o,mG),tp(i,i,a),$n(o,o,i),$n(i,a,l),$n(a,s,n),gl(s,u),pl(i,s,E),pl(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);vG(f,f),$n(d,d,f);let y=new Uint8Array(32);return wG(y,d),y}lt.scalarMult=Y1;function hD(t){return Y1(t,fD)}lt.scalarMultBase=hD;function dD(t){if(t.length!==lt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${lt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:hD(e),secretKey:e}}lt.generateKeyPairFromSeed=dD;function AG(t){let e=(0,gG.randomBytes)(32,t),r=dD(e);return(0,yG.wipe)(e),r}lt.generateKeyPair=AG;function _G(t,e,r=!1){if(t.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=Y1(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function mD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function ED(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=wu(t.length);for(let n=0;n{c();jd();il()});var J1={};at(J1,{compare:()=>gD,concat:()=>Gd,equals:()=>mD,fromString:()=>En,toString:()=>Kn,xor:()=>ED});var X1=ge(()=>{c();yD();f1();wD();U1();M1();vD()});var PD=v(Ze=>{"use strict";c();var AD=Ze&&Ze.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new xD:typeof navigator<"u"?Z1(navigator.userAgent):OD()}Ze.detect=CG;function ND(t){return t!==""&&SG.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function TG(t){var e=ND(t);return e?e[0]:null}Ze.browserName=TG;function Z1(t){var e=ND(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new TD;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_D&&(i=AD(AD([],i,!0),xG(_D-i.length),!0)):i=[];var s=i.join("."),o=DD(t),a=IG.exec(t);return a&&a[1]?new CD(r,s,o,a[1]):new ID(r,s,o)}Ze.parseUserAgent=Z1;function DD(t){for(var e=0,r=bD.length;e{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.getLocalStorage=ze.getLocalStorageOrThrow=ze.getCrypto=ze.getCryptoOrThrow=ze.getLocation=ze.getLocationOrThrow=ze.getNavigator=ze.getNavigatorOrThrow=ze.getDocument=ze.getDocumentOrThrow=ze.getFromWindowOrThrow=ze.getFromWindow=void 0;function uo(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ze.getFromWindow=uo;function Cu(t){let e=uo(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ze.getFromWindowOrThrow=Cu;function NG(){return Cu("document")}ze.getDocumentOrThrow=NG;function DG(){return uo("document")}ze.getDocument=DG;function OG(){return Cu("navigator")}ze.getNavigatorOrThrow=OG;function PG(){return uo("navigator")}ze.getNavigator=PG;function BG(){return Cu("location")}ze.getLocationOrThrow=BG;function RG(){return uo("location")}ze.getLocation=RG;function LG(){return Cu("crypto")}ze.getCryptoOrThrow=LG;function FG(){return uo("crypto")}ze.getCrypto=FG;function MG(){return Cu("localStorage")}ze.getLocalStorageOrThrow=MG;function UG(){return uo("localStorage")}ze.getLocalStorage=UG});var RD=v(np=>{"use strict";c();Object.defineProperty(np,"__esModule",{value:!0});np.getWindowMetadata=void 0;var BD=ev();function qG(){let t,e;try{t=BD.getDocumentOrThrow(),e=BD.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),y=[];for(let w=0;w-1){let R=E.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let _=e.protocol+"//"+e.host;if(R.indexOf("/")===0)_+=R;else{let B=e.pathname.split("/");B.pop();let x=B.join("/");_+=x+"/"+R}y.push(_)}else if(R.indexOf("//")===0){let _=e.protocol+R;y.push(_)}else y.push(R)}}return y}function n(...d){let y=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(R)).filter(R=>R?d.includes(R):!1);if(T.length&&T){let R=E.getAttribute("content");if(R)return R}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}np.getWindowMetadata=qG});var FD=v((jae,LD)=>{"use strict";c();LD.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var HD=v((Qae,VD)=>{"use strict";c();var qD="%[a-f0-9]{2}",MD=new RegExp("("+qD+")|([^%]+?)","gi"),UD=new RegExp("("+qD+")+","gi");function tv(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],tv(r),tv(n))}function VG(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(MD)||[],r=1;r{"use strict";c();jD.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var kD=v((Wae,QD)=>{"use strict";c();QD.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var jG=FD(),GG=HD(),zD=GD(),QG=kD(),kG=t=>t==null,rv=Symbol("encodeFragmentIdentifier");function KG(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[",i,"]"].join("")]:[...r,[pt(e,t),"[",pt(i,t),"]=",pt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[]"].join("")]:[...r,[pt(e,t),"[]=",pt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),":list="].join("")]:[...r,[pt(e,t),":list=",pt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[pt(r,t),e,pt(i,t)].join("")]:[[n,pt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,pt(e,t)]:[...r,[pt(e,t),"=",pt(n,t)].join("")]}}function zG(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&Yn(n,t).includes(t.arrayFormatSeparator);n=o?Yn(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>Yn(u,t)):n===null?n:Yn(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Yn(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>Yn(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function WD(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function pt(t,e){return e.encode?e.strict?jG(t):encodeURIComponent(t):t}function Yn(t,e){return e.decode?GG(t):t}function $D(t){return Array.isArray(t)?t.sort():typeof t=="object"?$D(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function YD(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function WG(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function JD(t){t=YD(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function KD(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function XD(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),WD(e.arrayFormatSeparator);let r=zG(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=zD(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Yn(o,e),r(Yn(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=KD(s[o],e);else n[i]=KD(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=$D(o):i[s]=o,i},Object.create(null))}ir.extract=JD;ir.parse=XD;ir.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),WD(e.arrayFormatSeparator);let r=o=>e.skipNull&&kG(t[o])||e.skipEmptyString&&t[o]==="",n=KG(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?pt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?pt(o,e)+"[]":a.reduce(n(o),[]).join("&"):pt(o,e)+"="+pt(a,e)}).filter(o=>o.length>0).join("&")};ir.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=zD(t,"#");return Object.assign({url:r.split("?")[0]||"",query:XD(JD(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Yn(n,e)}:{})};ir.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[rv]:!0},e);let r=YD(t.url).split("?")[0]||"",n=ir.extract(t.url),i=ir.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=ir.stringify(s,e);o&&(o=`?${o}`);let a=WG(t.url);return t.fragmentIdentifier&&(a=`#${e[rv]?pt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};ir.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[rv]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=ir.parseUrl(t,r);return ir.stringifyUrl({url:n,query:QG(i,e),fragmentIdentifier:s},r)};ir.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return ir.pick(t,n,r)}});var eO=ge(()=>{c()});function Mi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function $G(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function YG(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function JG(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function yl(t,e,r){return(!r.length?YG(t,e.length):JG(t,e.length))?$G(t,e):!1}function ml(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var nv=ge(()=>{c()});function XG(t){return ip(t.method)&&sp(t.params)}function ip(t){return ml(t,"subscribe")}function sp(t){return yl(t,["topic"],[])}function ZG(t){return op(t.method)&&ap(t.params)}function op(t){return ml(t,"publish")}function ap(t){return yl(t,["message","topic","ttl"],["prompt","tag"])}function e9(t){return up(t.method)&&cp(t.params)}function up(t){return ml(t,"unsubscribe")}function cp(t){return yl(t,["id","topic"],[])}function t9(t){return lp(t.method)&&fp(t.params)}function lp(t){return ml(t,"subscription")}function fp(t){return yl(t,["id","data"],[])}var iv=ge(()=>{c();nv()});function r9(t){if(!ip(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!sp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Mi(e,"topic"),e}function n9(t){if(!op(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!ap(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Mi(e,"topic"),Mi(e,"message"),Mi(e,"ttl","number"),e}function i9(t){if(!up(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!cp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Mi(e,"id"),e}function s9(t){if(!lp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!fp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Mi(e,"id"),Mi(e,"data"),e}var tO=ge(()=>{c();nv();iv()});var o9,rO=ge(()=>{c();o9={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var nO={};at(nO,{RELAY_JSONRPC:()=>o9,isPublishMethod:()=>op,isPublishParams:()=>ap,isPublishRequest:()=>ZG,isSubscribeMethod:()=>ip,isSubscribeParams:()=>sp,isSubscribeRequest:()=>XG,isSubscriptionMethod:()=>lp,isSubscriptionParams:()=>fp,isSubscriptionRequest:()=>t9,isUnsubscribeMethod:()=>up,isUnsubscribeParams:()=>cp,isUnsubscribeRequest:()=>e9,parsePublishRequest:()=>n9,parseSubscribeRequest:()=>r9,parseSubscriptionRequest:()=>s9,parseUnsubscribeRequest:()=>i9});var iO=ge(()=>{c();eO();tO();rO();iv()});var _p=v(Q=>{"use strict";c();Object.defineProperty(Q,"__esModule",{value:!0});var pO=rD(),a9=uD(),gO=el(),uv=lD(),u9=pD(),et=(X1(),nt(J1)),c9=PD(),xu=ro(),wl=ev(),l9=RD(),f9=ZD(),h9=(iO(),nt(nO));function yO(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var mO=yO(u9),hp=yO(f9),gp=":";function wO(t){let[e,r]=t.split(gp);return{namespace:e,reference:r}}function EO(t){let{namespace:e,reference:r}=t;return[e,r].join(gp)}function cv(t){let[e,r,n]=t.split(gp);return{namespace:e,reference:r,address:n}}function vO(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(gp)}function lv(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function AO(t){let{address:e}=cv(t);return e}function _O(t){let{namespace:e,reference:r}=cv(t);return EO({namespace:e,reference:r})}function d9(t,e){let{namespace:r,reference:n}=wO(e);return vO({namespace:r,reference:n,address:t})}function p9(t){return lv(t,AO)}function bO(t){return lv(t,_O)}function g9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function y9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...bO(i.accounts))}),r}function m9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...yp(n,i))}),r}function yp(t,e){return t.includes(":")?[t]:e.chains||[]}var mp=t=>t?.split(":"),IO=t=>{let e=t&&mp(t);if(e)return e[3]},w9=t=>{let e=t&&mp(t);if(e)return e[2]+":"+e[3]},SO=t=>{let e=t&&mp(t);if(e)return e.pop()},E9=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=SO(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${IO(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: ${t.resources.map(d=>`- ${d}`).join(` `)}`:void 0;return[r,n,"",i,"",s,o,a,u,l,f].filter(d=>d!=null).join(` -`)},dv="base10",$t="base16",gp="base64pad",vp="utf8",pv=0,Nu=1,I9=0,aO=1,av=12,gv=32;function S9(){let t=EO.generateKeyPair();return{privateKey:et.toString(t.secretKey,$t),publicKey:et.toString(t.publicKey,$t)}}function C9(){let t=mO.randomBytes(gv);return et.toString(t,$t)}function T9(t,e){let r=EO.sharedKey(et.fromString(t,$t),et.fromString(e,$t)),n=new f9.HKDF(lv.SHA256,r).expand(gv);return et.toString(n,$t)}function x9(t){let e=lv.hash(et.fromString(t,$t));return et.toString(e,$t)}function N9(t){let e=lv.hash(et.fromString(t,vp));return et.toString(e,$t)}function xO(t){return et.fromString(`${t}`,dv)}function El(t){return Number(et.toString(t,dv))}function D9(t){let e=xO(typeof t.type<"u"?t.type:pv);if(El(e)===Nu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?et.fromString(t.senderPublicKey,$t):void 0,n=typeof t.iv<"u"?et.fromString(t.iv,$t):mO.randomBytes(av),i=new yO.ChaCha20Poly1305(et.fromString(t.symKey,$t)).seal(n,et.fromString(t.message,vp));return NO({type:e,sealed:i,iv:n,senderPublicKey:r})}function O9(t){let e=new yO.ChaCha20Poly1305(et.fromString(t.symKey,$t)),{sealed:r,iv:n}=yv(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return et.toString(i,vp)}function NO(t){if(El(t.type)===Nu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return et.toString(et.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),gp)}return et.toString(et.concat([t.type,t.iv,t.sealed]),gp)}function yv(t){let e=et.fromString(t,gp),r=e.slice(I9,aO),n=aO;if(El(r)===Nu){let a=n+gv,u=a+av,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+av,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function P9(t,e){let r=yv(t);return DO({type:El(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?et.toString(r.senderPublicKey,$t):void 0,receiverPublicKey:e?.receiverPublicKey})}function DO(t){let e=t?.type||pv;if(e===Nu){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function B9(t){return t.type===Nu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var R9=Object.defineProperty,uO=Object.getOwnPropertySymbols,L9=Object.prototype.hasOwnProperty,F9=Object.prototype.propertyIsEnumerable,cO=(t,e,r)=>e in t?R9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lO=(t,e)=>{for(var r in e||(e={}))L9.call(e,r)&&cO(t,r,e[r]);if(uO)for(var r of uO(e))F9.call(e,r)&&cO(t,r,e[r]);return t},OO="ReactNative",Tu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},yp=" ",M9=":",PO="/",mv=2,U9=1e3,BO="js";function wv(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function RO(){return!wl.getDocument()&&!!wl.getNavigator()&&navigator.product===OO}function LO(){return!wv()&&!!wl.getNavigator()}function Ev(){return RO()?Tu.reactNative:wv()?Tu.node:LO()?Tu.browser:Tu.unknown}function FO(t,e){let r=pp.parse(t);return r=lO(lO({},r),e),t=pp.stringify(r),t}function q9(){return p9.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function V9(t,e){var r;let n=Ev(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=wl.getLocation())==null?void 0:r.host)||"unknown"),i}function MO(){let t=d9.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function UO(){var t;let e=Ev();return e===Tu.browser?[e,((t=wl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function qO(t,e,r){let n=MO(),i=UO();return[[t,e].join("-"),[BO,r].join("-"),n,i].join("/")}function j9({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=qO(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=FO(a[1]||"",l);return a[0]+"?"+f}function H9(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function G9(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function VO(t,e=mv){return jO(t.split(PO),e)}function Q9(t){return VO(t).join(yp)}function Ui(t,e){return t.filter(r=>e.includes(r)).length===t.length}function jO(t,e=mv){return t.slice(Math.max(t.length-e,0))}function k9(t){return Object.fromEntries(t.entries())}function K9(t){return new Map(Object.entries(t))}function z9(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var W9=t=>t;function HO(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function $9(t){return t.split(yp).map(e=>HO(e)).join(yp)}function Y9(t=xu.FIVE_MINUTES,e){let r=xu.toMiliseconds(t||xu.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function J9(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function vv(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function X9(t){return vv("topic",t)}function Z9(t){return vv("id",t)}function eQ(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function tQ(t,e){return xu.fromMiliseconds((e||Date.now())+xu.toMiliseconds(t))}function rQ(t){return Date.now()>=xu.toMiliseconds(t)}function nQ(t,e){return`${t}${e?`:${e}`:""}`}function qi(t=[],e=[]){return[...new Set([...t,...e])]}var GO="irn";function iQ(t){return t?.relay||{protocol:GO}}function sQ(t){let e=y9.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var oQ=Object.defineProperty,fO=Object.getOwnPropertySymbols,aQ=Object.prototype.hasOwnProperty,uQ=Object.prototype.propertyIsEnumerable,hO=(t,e,r)=>e in t?oQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cQ=(t,e)=>{for(var r in e||(e={}))aQ.call(e,r)&&hO(t,r,e[r]);if(fO)for(var r of fO(e))uQ.call(e,r)&&hO(t,r,e[r]);return t};function QO(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function lQ(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=pp.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:QO(o)}}function kO(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function fQ(t){return`${t.protocol}:${t.topic}@${t.version}?`+pp.stringify(cQ({symKey:t.symKey},kO(t.relay)))}var hQ=Object.defineProperty,dQ=Object.defineProperties,pQ=Object.getOwnPropertyDescriptors,dO=Object.getOwnPropertySymbols,gQ=Object.prototype.hasOwnProperty,yQ=Object.prototype.propertyIsEnumerable,pO=(t,e,r)=>e in t?hQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mQ=(t,e)=>{for(var r in e||(e={}))gQ.call(e,r)&&pO(t,r,e[r]);if(dO)for(var r of dO(e))yQ.call(e,r)&&pO(t,r,e[r]);return t},wQ=(t,e)=>dQ(t,pQ(e));function co(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function KO(t){let e=[];return Object.values(t).forEach(r=>{e.push(...co(r.accounts))}),e}function zO(t,e){let r=[];return Object.values(t).forEach(n=>{co(n.accounts).includes(e)&&r.push(...n.methods)}),r}function WO(t,e){let r=[];return Object.values(t).forEach(n=>{co(n.accounts).includes(e)&&r.push(...n.events)}),r}function EQ(t,e){let r=r3(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function vQ(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=uv(e),s=uv(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,y=n[l].events,w=n[l].accounts;o[l]={chains:f,methods:d,events:y,accounts:w}});let a=i3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var N,R;return(R=(N=i[l])==null?void 0:N.chains)==null?void 0:R.includes(E)}),d=n[l].methods.filter(E=>{var N,R;return(R=(N=i[l])==null?void 0:N.methods)==null?void 0:R.includes(E)}),y=n[l].events.filter(E=>{var N,R;return(R=(N=i[l])==null?void 0:N.events)==null?void 0:R.includes(E)}),w=f.map(E=>n[l].accounts.filter(N=>N.includes(E))).flat();u[l]={chains:f,methods:d,events:y,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,y,w,E,N;if(!n[l])return;let R=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(T=>n[l].chains.includes(T)),M=n[l].methods.filter(T=>{var P,B;return(B=(P=s[l])==null?void 0:P.methods)==null?void 0:B.includes(T)}),x=n[l].events.filter(T=>{var P,B;return(B=(P=s[l])==null?void 0:P.events)==null?void 0:B.includes(T)}),b=R?.map(T=>n[l].accounts.filter(P=>P.includes(T))).flat();u[l]={chains:qi((y=u[l])==null?void 0:y.chains,R),methods:qi((w=u[l])==null?void 0:w.methods,M),events:qi((E=u[l])==null?void 0:E.events,x),accounts:qi((N=u[l])==null?void 0:N.accounts,b)}}),u}function Av(t){return t.includes(":")}function $O(t){return Av(t)?t.split(":")[0]:t}function uv(t){var e,r,n;let i={};if(!Ap(t))return i;for(let[s,o]of Object.entries(t)){let a=Av(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=$O(s);i[f]=wQ(mQ({},i[f]),{chains:qi(a,(e=i[f])==null?void 0:e.chains),methods:qi(u,(r=i[f])==null?void 0:r.methods),events:qi(l,(n=i[f])==null?void 0:n.events)})}return i}var AQ={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},_Q={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Jn(t,e){let{message:r,code:n}=_Q[t];return{message:e?`${r} ${e}`:r,code:n}}function uo(t,e){let{message:r,code:n}=AQ[t];return{message:e?`${r} ${e}`:r,code:n}}function vl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Ap(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Vi(t){return typeof t>"u"}function cr(t,e){return e&&Vi(t)?!0:typeof t=="string"&&!!t.trim().length}function _p(t,e){return e&&Vi(t)?!0:typeof t=="number"&&!isNaN(t)}function bQ(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ui(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=co(a),d=r[o];(!Ui(wp(o,d),f)||!Ui(d.methods,u)||!Ui(d.events,l))&&(s=!1)}),s):!1}function bp(t){return cr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function YO(t){if(cr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&bp(r)}}return!1}function IQ(t){if(cr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function SQ(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function CQ(t){return t?.topic}function TQ(t,e){let r=null;return cr(t?.publicKey,!1)||(r=Jn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function cv(t){let e=!0;return vl(t)?t.length&&(e=t.every(r=>cr(r,!1))):e=!1,e}function JO(t,e,r){let n=null;return vl(e)?e.forEach(i=>{n||(!bp(i)||!i.includes(t))&&(n=uo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=uo("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function XO(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;let s=JO(n,wp(n,i),`${e} requiredNamespace`);s&&(r=s)}),r}function ZO(t,e){let r=null;return vl(t)?t.forEach(n=>{r||YO(n)||(r=uo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=uo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function e3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=ZO(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function t3(t,e){let r=null;return cv(t?.methods)?cv(t?.events)||(r=uo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=uo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function _v(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=t3(n,`${e}, namespace`);i&&(r=i)}),r}function xQ(t,e,r){let n=null;if(t&&Ap(t)){let i=_v(t,e);i&&(n=i);let s=XO(t,e);s&&(n=s)}else n=Jn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function r3(t,e){let r=null;if(t&&Ap(t)){let n=_v(t,e);n&&(r=n);let i=e3(t,e);i&&(r=i)}else r=Jn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function n3(t){return cr(t.protocol,!0)}function NQ(t,e){let r=!1;return e&&!t?r=!0:t&&vl(t)&&t.length&&t.forEach(n=>{r=n3(n)}),r}function DQ(t){return typeof t=="number"}function OQ(t){return typeof t<"u"&&typeof t!==null}function PQ(t){return!(!t||typeof t!="object"||!t.code||!_p(t.code,!1)||!t.message||!cr(t.message,!1))}function BQ(t){return!(Vi(t)||!cr(t.method,!1))}function RQ(t){return!(Vi(t)||Vi(t.result)&&Vi(t.error)||!_p(t.id,!1)||!cr(t.jsonrpc,!1))}function LQ(t){return!(Vi(t)||!cr(t.name,!1))}function FQ(t,e){return!(!bp(e)||!KO(t).includes(e))}function MQ(t,e,r){return cr(r,!1)?zO(t,e).includes(r):!1}function UQ(t,e,r){return cr(r,!1)?WO(t,e).includes(r):!1}function i3(t,e,r){let n=null,i=qQ(t),s=VQ(e),o=Object.keys(i),a=Object.keys(s),u=gO(Object.keys(t)),l=gO(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)},fv="base10",$t="base16",dp="base64pad",wp="utf8",hv=0,Nu=1,v9=0,sO=1,sv=12,dv=32;function A9(){let t=mO.generateKeyPair();return{privateKey:et.toString(t.secretKey,$t),publicKey:et.toString(t.publicKey,$t)}}function _9(){let t=gO.randomBytes(dv);return et.toString(t,$t)}function b9(t,e){let r=mO.sharedKey(et.fromString(t,$t),et.fromString(e,$t)),n=new a9.HKDF(uv.SHA256,r).expand(dv);return et.toString(n,$t)}function I9(t){let e=uv.hash(et.fromString(t,$t));return et.toString(e,$t)}function S9(t){let e=uv.hash(et.fromString(t,wp));return et.toString(e,$t)}function CO(t){return et.fromString(`${t}`,fv)}function El(t){return Number(et.toString(t,fv))}function C9(t){let e=CO(typeof t.type<"u"?t.type:hv);if(El(e)===Nu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?et.fromString(t.senderPublicKey,$t):void 0,n=typeof t.iv<"u"?et.fromString(t.iv,$t):gO.randomBytes(sv),i=new pO.ChaCha20Poly1305(et.fromString(t.symKey,$t)).seal(n,et.fromString(t.message,wp));return TO({type:e,sealed:i,iv:n,senderPublicKey:r})}function T9(t){let e=new pO.ChaCha20Poly1305(et.fromString(t.symKey,$t)),{sealed:r,iv:n}=pv(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return et.toString(i,wp)}function TO(t){if(El(t.type)===Nu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return et.toString(et.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),dp)}return et.toString(et.concat([t.type,t.iv,t.sealed]),dp)}function pv(t){let e=et.fromString(t,dp),r=e.slice(v9,sO),n=sO;if(El(r)===Nu){let a=n+dv,u=a+sv,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+sv,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function x9(t,e){let r=pv(t);return xO({type:El(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?et.toString(r.senderPublicKey,$t):void 0,receiverPublicKey:e?.receiverPublicKey})}function xO(t){let e=t?.type||hv;if(e===Nu){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function N9(t){return t.type===Nu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var D9=Object.defineProperty,oO=Object.getOwnPropertySymbols,O9=Object.prototype.hasOwnProperty,P9=Object.prototype.propertyIsEnumerable,aO=(t,e,r)=>e in t?D9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uO=(t,e)=>{for(var r in e||(e={}))O9.call(e,r)&&aO(t,r,e[r]);if(oO)for(var r of oO(e))P9.call(e,r)&&aO(t,r,e[r]);return t},NO="ReactNative",Tu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pp=" ",B9=":",DO="/",gv=2,R9=1e3,OO="js";function yv(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function PO(){return!wl.getDocument()&&!!wl.getNavigator()&&navigator.product===NO}function BO(){return!yv()&&!!wl.getNavigator()}function mv(){return PO()?Tu.reactNative:yv()?Tu.node:BO()?Tu.browser:Tu.unknown}function RO(t,e){let r=hp.parse(t);return r=uO(uO({},r),e),t=hp.stringify(r),t}function L9(){return l9.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function F9(t,e){var r;let n=mv(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=wl.getLocation())==null?void 0:r.host)||"unknown"),i}function LO(){let t=c9.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function FO(){var t;let e=mv();return e===Tu.browser?[e,((t=wl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function MO(t,e,r){let n=LO(),i=FO();return[[t,e].join("-"),[OO,r].join("-"),n,i].join("/")}function M9({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=MO(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=RO(a[1]||"",l);return a[0]+"?"+f}function U9(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function q9(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function UO(t,e=gv){return qO(t.split(DO),e)}function V9(t){return UO(t).join(pp)}function Ui(t,e){return t.filter(r=>e.includes(r)).length===t.length}function qO(t,e=gv){return t.slice(Math.max(t.length-e,0))}function H9(t){return Object.fromEntries(t.entries())}function j9(t){return new Map(Object.entries(t))}function G9(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Q9=t=>t;function VO(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function k9(t){return t.split(pp).map(e=>VO(e)).join(pp)}function K9(t=xu.FIVE_MINUTES,e){let r=xu.toMiliseconds(t||xu.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function z9(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function wv(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function W9(t){return wv("topic",t)}function $9(t){return wv("id",t)}function Y9(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function J9(t,e){return xu.fromMiliseconds((e||Date.now())+xu.toMiliseconds(t))}function X9(t){return Date.now()>=xu.toMiliseconds(t)}function Z9(t,e){return`${t}${e?`:${e}`:""}`}function qi(t=[],e=[]){return[...new Set([...t,...e])]}var HO="irn";function eQ(t){return t?.relay||{protocol:HO}}function tQ(t){let e=h9.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var rQ=Object.defineProperty,cO=Object.getOwnPropertySymbols,nQ=Object.prototype.hasOwnProperty,iQ=Object.prototype.propertyIsEnumerable,lO=(t,e,r)=>e in t?rQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sQ=(t,e)=>{for(var r in e||(e={}))nQ.call(e,r)&&lO(t,r,e[r]);if(cO)for(var r of cO(e))iQ.call(e,r)&&lO(t,r,e[r]);return t};function jO(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function oQ(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=hp.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:jO(o)}}function GO(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function aQ(t){return`${t.protocol}:${t.topic}@${t.version}?`+hp.stringify(sQ({symKey:t.symKey},GO(t.relay)))}var uQ=Object.defineProperty,cQ=Object.defineProperties,lQ=Object.getOwnPropertyDescriptors,fO=Object.getOwnPropertySymbols,fQ=Object.prototype.hasOwnProperty,hQ=Object.prototype.propertyIsEnumerable,hO=(t,e,r)=>e in t?uQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dQ=(t,e)=>{for(var r in e||(e={}))fQ.call(e,r)&&hO(t,r,e[r]);if(fO)for(var r of fO(e))hQ.call(e,r)&&hO(t,r,e[r]);return t},pQ=(t,e)=>cQ(t,lQ(e));function lo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function QO(t){let e=[];return Object.values(t).forEach(r=>{e.push(...lo(r.accounts))}),e}function kO(t,e){let r=[];return Object.values(t).forEach(n=>{lo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function KO(t,e){let r=[];return Object.values(t).forEach(n=>{lo(n.accounts).includes(e)&&r.push(...n.events)}),r}function gQ(t,e){let r=e3(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function yQ(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=ov(e),s=ov(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,y=n[l].events,w=n[l].accounts;o[l]={chains:f,methods:d,events:y,accounts:w}});let a=r3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var T,R;return(R=(T=i[l])==null?void 0:T.chains)==null?void 0:R.includes(E)}),d=n[l].methods.filter(E=>{var T,R;return(R=(T=i[l])==null?void 0:T.methods)==null?void 0:R.includes(E)}),y=n[l].events.filter(E=>{var T,R;return(R=(T=i[l])==null?void 0:T.events)==null?void 0:R.includes(E)}),w=f.map(E=>n[l].accounts.filter(T=>T.includes(E))).flat();u[l]={chains:f,methods:d,events:y,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,y,w,E,T;if(!n[l])return;let R=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(O=>n[l].chains.includes(O)),_=n[l].methods.filter(O=>{var P,L;return(L=(P=s[l])==null?void 0:P.methods)==null?void 0:L.includes(O)}),B=n[l].events.filter(O=>{var P,L;return(L=(P=s[l])==null?void 0:P.events)==null?void 0:L.includes(O)}),x=R?.map(O=>n[l].accounts.filter(P=>P.includes(O))).flat();u[l]={chains:qi((y=u[l])==null?void 0:y.chains,R),methods:qi((w=u[l])==null?void 0:w.methods,_),events:qi((E=u[l])==null?void 0:E.events,B),accounts:qi((T=u[l])==null?void 0:T.accounts,x)}}),u}function Ev(t){return t.includes(":")}function zO(t){return Ev(t)?t.split(":")[0]:t}function ov(t){var e,r,n;let i={};if(!Ep(t))return i;for(let[s,o]of Object.entries(t)){let a=Ev(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=zO(s);i[f]=pQ(dQ({},i[f]),{chains:qi(a,(e=i[f])==null?void 0:e.chains),methods:qi(u,(r=i[f])==null?void 0:r.methods),events:qi(l,(n=i[f])==null?void 0:n.events)})}return i}var mQ={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},wQ={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Jn(t,e){let{message:r,code:n}=wQ[t];return{message:e?`${r} ${e}`:r,code:n}}function co(t,e){let{message:r,code:n}=mQ[t];return{message:e?`${r} ${e}`:r,code:n}}function vl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Ep(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Vi(t){return typeof t>"u"}function cr(t,e){return e&&Vi(t)?!0:typeof t=="string"&&!!t.trim().length}function vp(t,e){return e&&Vi(t)?!0:typeof t=="number"&&!isNaN(t)}function EQ(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ui(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=lo(a),d=r[o];(!Ui(yp(o,d),f)||!Ui(d.methods,u)||!Ui(d.events,l))&&(s=!1)}),s):!1}function Ap(t){return cr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function WO(t){if(cr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Ap(r)}}return!1}function vQ(t){if(cr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function AQ(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function _Q(t){return t?.topic}function bQ(t,e){let r=null;return cr(t?.publicKey,!1)||(r=Jn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function av(t){let e=!0;return vl(t)?t.length&&(e=t.every(r=>cr(r,!1))):e=!1,e}function $O(t,e,r){let n=null;return vl(e)?e.forEach(i=>{n||(!Ap(i)||!i.includes(t))&&(n=co("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=co("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function YO(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;let s=$O(n,yp(n,i),`${e} requiredNamespace`);s&&(r=s)}),r}function JO(t,e){let r=null;return vl(t)?t.forEach(n=>{r||WO(n)||(r=co("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=co("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function XO(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=JO(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function ZO(t,e){let r=null;return av(t?.methods)?av(t?.events)||(r=co("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=co("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function vv(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=ZO(n,`${e}, namespace`);i&&(r=i)}),r}function IQ(t,e,r){let n=null;if(t&&Ep(t)){let i=vv(t,e);i&&(n=i);let s=YO(t,e);s&&(n=s)}else n=Jn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function e3(t,e){let r=null;if(t&&Ep(t)){let n=vv(t,e);n&&(r=n);let i=XO(t,e);i&&(r=i)}else r=Jn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function t3(t){return cr(t.protocol,!0)}function SQ(t,e){let r=!1;return e&&!t?r=!0:t&&vl(t)&&t.length&&t.forEach(n=>{r=t3(n)}),r}function CQ(t){return typeof t=="number"}function TQ(t){return typeof t<"u"&&typeof t!==null}function xQ(t){return!(!t||typeof t!="object"||!t.code||!vp(t.code,!1)||!t.message||!cr(t.message,!1))}function NQ(t){return!(Vi(t)||!cr(t.method,!1))}function DQ(t){return!(Vi(t)||Vi(t.result)&&Vi(t.error)||!vp(t.id,!1)||!cr(t.jsonrpc,!1))}function OQ(t){return!(Vi(t)||!cr(t.name,!1))}function PQ(t,e){return!(!Ap(e)||!QO(t).includes(e))}function BQ(t,e,r){return cr(r,!1)?kO(t,e).includes(r):!1}function RQ(t,e,r){return cr(r,!1)?KO(t,e).includes(r):!1}function r3(t,e,r){let n=null,i=LQ(t),s=FQ(e),o=Object.keys(i),a=Object.keys(s),u=dO(Object.keys(t)),l=dO(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} Received: ${Object.keys(e).toString()}`)),Ui(o,a)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let y=co(e[d].accounts);y.includes(d)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} + Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let y=lo(e[d].accounts);y.includes(d)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${y.toString()}`))}),o.forEach(d=>{n||(Ui(i[d].methods,s[d].methods)?Ui(i[d].events,s[d].events)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function qQ(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function gO(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function VQ(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:co(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function jQ(t,e){return _p(t,!1)&&t<=e.max&&t>=e.min}Q.BASE10=dv,Q.BASE16=$t,Q.BASE64=gp,Q.COLON=M9,Q.DEFAULT_DEPTH=mv,Q.EMPTY_SPACE=yp,Q.ENV_MAP=Tu,Q.ONE_THOUSAND=U9,Q.REACT_NATIVE_PRODUCT=OO,Q.RELAYER_DEFAULT_PROTOCOL=GO,Q.SDK_TYPE=BO,Q.SLASH=PO,Q.TYPE_0=pv,Q.TYPE_1=Nu,Q.UTF8=vp,Q.appendToQueryString=FO,Q.assertType=G9,Q.buildApprovedNamespaces=vQ,Q.calcExpiry=tQ,Q.capitalize=$9,Q.capitalizeWord=HO,Q.createDelayedPromise=Y9,Q.createExpiringPromise=J9,Q.decodeTypeByte=El,Q.decrypt=O9,Q.deriveSymKey=T9,Q.deserialize=yv,Q.encodeTypeByte=xO,Q.encrypt=D9,Q.engineEvent=nQ,Q.enumify=W9,Q.formatAccountId=_O,Q.formatAccountWithChain=m9,Q.formatChainId=AO,Q.formatExpirerTarget=vv,Q.formatIdTarget=Z9,Q.formatMessage=b9,Q.formatMessageContext=Q9,Q.formatRelayParams=kO,Q.formatRelayRpcUrl=j9,Q.formatTopicTarget=X9,Q.formatUA=qO,Q.formatUri=fQ,Q.generateKeyPair=S9,Q.generateRandomBytes32=C9,Q.getAccountsChains=co,Q.getAccountsFromNamespaces=E9,Q.getAddressFromAccount=bO,Q.getAddressesFromAccounts=w9,Q.getAppMetadata=q9,Q.getChainFromAccount=IO,Q.getChainsFromAccounts=SO,Q.getChainsFromNamespace=wp,Q.getChainsFromNamespaces=v9,Q.getChainsFromRequiredNamespaces=A9,Q.getDidAddress=TO,Q.getDidAddressSegments=Ep,Q.getDidChainId=CO,Q.getEnvironment=Ev,Q.getHttpUrl=H9,Q.getInternalError=Jn,Q.getJavascriptID=UO,Q.getJavascriptOS=MO,Q.getLastItems=jO,Q.getNamespacedDidChainId=_9,Q.getNamespacesChains=KO,Q.getNamespacesEventsForChainId=WO,Q.getNamespacesMethodsForChainId=zO,Q.getRelayClientMetadata=V9,Q.getRelayProtocolApi=sQ,Q.getRelayProtocolName=iQ,Q.getRequiredNamespacesFromNamespaces=EQ,Q.getSdkError=uo,Q.getUniqueValues=hv,Q.hasOverlap=Ui,Q.hashKey=x9,Q.hashMessage=N9,Q.isBrowser=LO,Q.isCaipNamespace=Av,Q.isConformingNamespaces=i3,Q.isExpired=rQ,Q.isNode=wv,Q.isProposalStruct=SQ,Q.isReactNative=RO,Q.isSessionCompatible=bQ,Q.isSessionStruct=CQ,Q.isTypeOneEnvelope=B9,Q.isUndefined=Vi,Q.isValidAccountId=YO,Q.isValidAccounts=ZO,Q.isValidActions=t3,Q.isValidArray=vl,Q.isValidChainId=bp,Q.isValidChains=JO,Q.isValidController=TQ,Q.isValidErrorReason=PQ,Q.isValidEvent=LQ,Q.isValidId=DQ,Q.isValidNamespaceAccounts=e3,Q.isValidNamespaceActions=_v,Q.isValidNamespaceChains=XO,Q.isValidNamespaceMethodsOrEvents=cv,Q.isValidNamespaces=r3,Q.isValidNamespacesChainId=FQ,Q.isValidNamespacesEvent=UQ,Q.isValidNamespacesRequest=MQ,Q.isValidNumber=_p,Q.isValidObject=Ap,Q.isValidParams=OQ,Q.isValidRelay=n3,Q.isValidRelays=NQ,Q.isValidRequest=BQ,Q.isValidRequestExpiry=jQ,Q.isValidRequiredNamespaces=xQ,Q.isValidResponse=RQ,Q.isValidString=cr,Q.isValidUrl=IQ,Q.mapEntries=z9,Q.mapToObj=k9,Q.mergeArrays=qi,Q.normalizeNamespaces=uv,Q.objToMap=K9,Q.parseAccountId=fv,Q.parseChainId=vO,Q.parseContextNames=VO,Q.parseExpirerTarget=eQ,Q.parseNamespaceKey=$O,Q.parseRelayParams=QO,Q.parseUri=lQ,Q.serialize=NO,Q.validateDecoding=P9,Q.validateEncoding=DO});var s3,o3,a3,u3,Sp,Al,bv,Cp,ji,_l,Tp=ge(()=>{c();s3="PARSE_ERROR",o3="INVALID_REQUEST",a3="METHOD_NOT_FOUND",u3="INVALID_PARAMS",Sp="INTERNAL_ERROR",Al="SERVER_ERROR",bv=[-32700,-32600,-32601,-32602,-32603],Cp=[-32e3,-32099],ji={[s3]:{code:-32700,message:"Parse error"},[o3]:{code:-32600,message:"Invalid Request"},[a3]:{code:-32601,message:"Method not found"},[u3]:{code:-32602,message:"Invalid params"},[Sp]:{code:-32603,message:"Internal error"},[Al]:{code:-32e3,message:"Server error"}},_l=Al});function HQ(t){return t<=Cp[0]&&t>=Cp[1]}function xp(t){return bv.includes(t)}function c3(t){return typeof t=="number"}function Np(t){return Object.keys(ji).includes(t)?ji[t]:ji[_l]}function Dp(t){let e=Object.values(ji).find(r=>r.code===t);return e||ji[_l]}function GQ(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!c3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(xp(t.error.code)){let e=Dp(t.error.code);if(e.message!==ji[_l].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function Iv(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Sv=ge(()=>{c();Tp()});var f3=v(Hi=>{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.isBrowserCryptoAvailable=Hi.getSubtleCrypto=Hi.getBrowerCrypto=void 0;function Cv(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Hi.getBrowerCrypto=Cv;function l3(){let t=Cv();return t.subtle||t.webkitSubtle}Hi.getSubtleCrypto=l3;function QQ(){return!!Cv()&&!!l3()}Hi.isBrowserCryptoAvailable=QQ});var p3=v(Gi=>{"use strict";c();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.isBrowser=Gi.isNode=Gi.isReactNative=void 0;function h3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Gi.isReactNative=h3;function d3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}Gi.isNode=d3;function kQ(){return!h3()&&!d3()}Gi.isBrowser=kQ});var Tv=v(Op=>{"use strict";c();Object.defineProperty(Op,"__esModule",{value:!0});var g3=(ar(),rt(or));g3.__exportStar(f3(),Op);g3.__exportStar(p3(),Op)});var Ot={};ot(Ot,{isNodeJs:()=>m3});var y3,m3,w3=ge(()=>{c();y3=_e(Tv());Lt(Ot,_e(Tv()));m3=y3.isNode});function xv(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Nv(t=6){return BigInt(xv(t))}function Dv(t,e,r){return{id:r||xv(),jsonrpc:"2.0",method:t,params:e}}function KQ(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Ov(t,e,r){return{id:t,jsonrpc:"2.0",error:E3(e,r)}}function E3(t,e){return typeof t>"u"?Np(Sp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Np(Al)),{message:t})),typeof e<"u"&&(t.data=e),xp(t.code)&&(t=Dp(t.code)),t)}var v3=ge(()=>{c();Sv();Tp()});function zQ(t){return t.includes("*")?Bp(t):!/\W/g.test(t)}function Pp(t){return t==="*"}function Bp(t){return Pp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function WQ(t){return!Pp(t)&&Bp(t)&&!t.split("*")[0].trim()}function $Q(t){return!Pp(t)&&Bp(t)&&!t.split("*")[1].trim()}var A3=ge(()=>{c()});var _3=ge(()=>{c()});var Du,Pv=ge(()=>{c();Du=class{}});var Bv,Rp,bl,b3=ge(()=>{c();Pv();Bv=class extends Du{constructor(e){super()}},Rp=class extends Du{constructor(){super()}},bl=class extends Rp{constructor(e){super()}}});var I3=ge(()=>{c()});var S3=ge(()=>{c();_3();Pv();b3();I3()});var C3=ge(()=>{c();S3()});function XQ(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function T3(t,e){let r=XQ(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function ZQ(t){return T3(t,YQ)}function Lp(t){return T3(t,JQ)}function Rv(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var YQ,JQ,x3=ge(()=>{c();YQ="^https?:",JQ="^wss?:"});function Lv(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function ek(t){return Lv(t)&&"method"in t}function Fv(t){return Lv(t)&&(N3(t)||Fp(t))}function N3(t){return"result"in t}function Fp(t){return"error"in t}function tk(t){return"error"in t&&t.valid===!1}var D3=ge(()=>{c()});var Kt={};ot(Kt,{DEFAULT_ERROR:()=>_l,IBaseJsonRpcProvider:()=>Rp,IEvents:()=>Du,IJsonRpcConnection:()=>Bv,IJsonRpcProvider:()=>bl,INTERNAL_ERROR:()=>Sp,INVALID_PARAMS:()=>u3,INVALID_REQUEST:()=>o3,METHOD_NOT_FOUND:()=>a3,PARSE_ERROR:()=>s3,RESERVED_ERROR_CODES:()=>bv,SERVER_ERROR:()=>Al,SERVER_ERROR_CODE_RANGE:()=>Cp,STANDARD_ERROR_MAP:()=>ji,formatErrorMessage:()=>E3,formatJsonRpcError:()=>Ov,formatJsonRpcRequest:()=>Dv,formatJsonRpcResult:()=>KQ,getBigIntRpcId:()=>Nv,getError:()=>Np,getErrorByCode:()=>Dp,isHttpUrl:()=>ZQ,isJsonRpcError:()=>Fp,isJsonRpcPayload:()=>Lv,isJsonRpcRequest:()=>ek,isJsonRpcResponse:()=>Fv,isJsonRpcResult:()=>N3,isJsonRpcValidationInvalid:()=>tk,isLocalhostUrl:()=>Rv,isNodeJs:()=>m3,isReservedErrorCode:()=>xp,isServerErrorCode:()=>HQ,isValidDefaultRoute:()=>Pp,isValidErrorCode:()=>c3,isValidLeadingWildcardRoute:()=>WQ,isValidRoute:()=>zQ,isValidTrailingWildcardRoute:()=>$Q,isValidWildcardRoute:()=>Bp,isWsUrl:()=>Lp,parseConnectionError:()=>Iv,payloadId:()=>xv,validateJsonRpcError:()=>GQ});var Il=ge(()=>{c();Tp();Sv();w3();Lt(Kt,Ot);v3();A3();C3();x3();D3()});var O3,Mp,P3,Mv=ge(()=>{c();O3=_e(Hn());Il();Mp=class extends bl{constructor(e){super(e),this.events=new O3.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Dv(e.method,e.params||[],Nv().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Fp(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Fv(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},P3=Mp});var B3={};ot(B3,{JsonRpcProvider:()=>Mp,default:()=>rk});var rk,R3=ge(()=>{c();Mv();Mv();rk=P3});var F3=v((Ace,L3)=>{"use strict";c();L3.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var U3,M3,nk,ik,sk,Up,q3,Uv=ge(()=>{c();U3=_e(Hn());Nd();Il();M3=10,nk=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:F3(),ik=()=>typeof window<"u",sk=nk(),Up=class{constructor(e){if(this.url=e,this.events=new U3.EventEmitter,this.registering=!1,!Lp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Zc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Lp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Kt.isReactNative)()?void 0:{rejectUnauthorized:!Rv(e)},s=new sk(e,[],i);ik()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Xc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=Ov(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Iv(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>M3&&this.events.setMaxListeners(M3)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}},q3=Up});var V3={};ot(V3,{WsConnection:()=>Up,default:()=>ok});var ok,j3=ge(()=>{c();Uv();Uv();ok=q3});var _6=v((Sl,Pu)=>{c();var ak=200,$v="__lodash_hash_undefined__",Kp=1,Z3=2,e6=9007199254740991,qp="[object Arguments]",Hv="[object Array]",uk="[object AsyncFunction]",t6="[object Boolean]",r6="[object Date]",n6="[object Error]",i6="[object Function]",ck="[object GeneratorFunction]",Vp="[object Map]",s6="[object Number]",lk="[object Null]",Ou="[object Object]",H3="[object Promise]",fk="[object Proxy]",o6="[object RegExp]",jp="[object Set]",a6="[object String]",hk="[object Symbol]",dk="[object Undefined]",Gv="[object WeakMap]",u6="[object ArrayBuffer]",Hp="[object DataView]",pk="[object Float32Array]",gk="[object Float64Array]",yk="[object Int8Array]",mk="[object Int16Array]",wk="[object Int32Array]",Ek="[object Uint8Array]",vk="[object Uint8ClampedArray]",Ak="[object Uint16Array]",_k="[object Uint32Array]",bk=/[\\^$.*+?()[\]{}|]/g,Ik=/^\[object .+?Constructor\]$/,Sk=/^(?:0|[1-9]\d*)$/,Ye={};Ye[pk]=Ye[gk]=Ye[yk]=Ye[mk]=Ye[wk]=Ye[Ek]=Ye[vk]=Ye[Ak]=Ye[_k]=!0;Ye[qp]=Ye[Hv]=Ye[u6]=Ye[t6]=Ye[Hp]=Ye[r6]=Ye[n6]=Ye[i6]=Ye[Vp]=Ye[s6]=Ye[Ou]=Ye[o6]=Ye[jp]=Ye[a6]=Ye[Gv]=!1;var c6=typeof global=="object"&&global&&global.Object===Object&&global,Ck=typeof self=="object"&&self&&self.Object===Object&&self,Xn=c6||Ck||Function("return this")(),l6=typeof Sl=="object"&&Sl&&!Sl.nodeType&&Sl,G3=l6&&typeof Pu=="object"&&Pu&&!Pu.nodeType&&Pu,f6=G3&&G3.exports===l6,qv=f6&&c6.process,Q3=function(){try{return qv&&qv.binding&&qv.binding("util")}catch{}}(),k3=Q3&&Q3.isTypedArray;function Tk(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function nK(t,e){var r=this.__data__,n=Wp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Zn.prototype.clear=Zk;Zn.prototype.delete=eK;Zn.prototype.get=tK;Zn.prototype.has=rK;Zn.prototype.set=nK;function ho(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,y=r&Z3?new Qp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=e6}function v6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function xl(t){return t!=null&&typeof t=="object"}var A6=k3?Ok(k3):vK;function RK(t){return PK(t)?yK(t):AK(t)}function LK(){return[]}function FK(){return!1}Pu.exports=BK});var IP=v(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});var go=Hn(),MK=pd(),UK=n2(),og=E2(),tt=PE(),Ki=$E(),b6=(Nd(),rt(C2)),qK=(YN(),rt($N)),ee=Ip(),VK=(ev(),rt(Z1)),St=to(),jK=(R3(),rt(B3)),jr=(Il(),rt(Kt)),HK=(j3(),rt(V3)),GK=_6();function Pl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function QK(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var kK=Pl(go),V6=Pl(MK),KK=Pl(UK),Yp=QK(qK),zK=Pl(HK),WK=Pl(GK);function $K(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,T=new Uint8Array(b);M!==x;){for(var P=E[M],B=0,_=b-1;(P!==0||B>>0,T[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=B,M++}for(var S=b-R;S!==b&&T[S]===0;)S++;for(var F=u.repeat(N);S>>0,b=new Uint8Array(x);E[N];){var T=r[E.charCodeAt(N)];if(T===255)return;for(var P=0,B=x-1;(T!==0||P>>0,b[B]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");M=P,N++}if(E[N]!==" "){for(var _=x-M;_!==x&&b[_]===0;)_++;for(var S=new Uint8Array(R+(x-_)),F=R;_!==x;)S[F++]=b[_++];return S}}}function w(E){var N=y(E);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var YK=$K,JK=YK,j6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},XK=t=>new TextEncoder().encode(t),ZK=t=>new TextDecoder().decode(t),Xv=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Zv=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return H6(this,e)}},eA=class{constructor(e){this.decoders=e}or(e){return H6(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},H6=(t,e)=>new eA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),tA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Xv(e,r,n),this.decoder=new Zv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ag=({name:t,prefix:e,encode:r,decode:n})=>new tA(t,e,r,n),Bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=JK(r,e);return ag({prefix:t,name:e,encode:n,decode:s=>j6(i(s))})},ez=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},tz=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<ag({prefix:e,name:t,encode(i){return tz(i,n,r)},decode(i){return ez(i,n,r,t)}}),rz=ag({prefix:"\0",name:"identity",encode:t=>ZK(t),decode:t=>XK(t)}),nz=Object.freeze({__proto__:null,identity:rz}),iz=Mt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),sz=Object.freeze({__proto__:null,base2:iz}),oz=Mt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),az=Object.freeze({__proto__:null,base8:oz}),uz=Bl({prefix:"9",name:"base10",alphabet:"0123456789"}),cz=Object.freeze({__proto__:null,base10:uz}),lz=Mt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),fz=Mt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),hz=Object.freeze({__proto__:null,base16:lz,base16upper:fz}),dz=Mt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pz=Mt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gz=Mt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),yz=Mt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mz=Mt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wz=Mt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ez=Mt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vz=Mt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Az=Mt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_z=Object.freeze({__proto__:null,base32:dz,base32upper:pz,base32pad:gz,base32padupper:yz,base32hex:mz,base32hexupper:wz,base32hexpad:Ez,base32hexpadupper:vz,base32z:Az}),bz=Bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Iz=Bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Sz=Object.freeze({__proto__:null,base36:bz,base36upper:Iz}),Cz=Bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Tz=Bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),xz=Object.freeze({__proto__:null,base58btc:Cz,base58flickr:Tz}),Nz=Mt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Dz=Mt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Oz=Mt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Pz=Mt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Bz=Object.freeze({__proto__:null,base64:Nz,base64pad:Dz,base64url:Oz,base64urlpad:Pz}),G6=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Rz=G6.reduce((t,e,r)=>(t[r]=e,t),[]),Lz=G6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Fz(t){return t.reduce((e,r)=>(e+=Rz[r],e),"")}function Mz(t){let e=[];for(let r of t){let n=Lz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Uz=ag({prefix:"\u{1F680}",name:"base256emoji",encode:Fz,decode:Mz}),qz=Object.freeze({__proto__:null,base256emoji:Uz}),Vz=Q6,I6=128,jz=127,Hz=~jz,Gz=Math.pow(2,31);function Q6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Gz;)e[r++]=t&255|I6,t/=128;for(;t&Hz;)e[r++]=t&255|I6,t>>>=7;return e[r]=t|0,Q6.bytes=r-n+1,e}var Qz=rA,kz=128,S6=127;function rA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw rA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&S6)<=kz);return rA.bytes=s-n,r}var Kz=Math.pow(2,7),zz=Math.pow(2,14),Wz=Math.pow(2,21),$z=Math.pow(2,28),Yz=Math.pow(2,35),Jz=Math.pow(2,42),Xz=Math.pow(2,49),Zz=Math.pow(2,56),eW=Math.pow(2,63),tW=function(t){return t(k6.encode(t,e,r),e),T6=t=>k6.encodingLength(t),nA=(t,e)=>{let r=e.byteLength,n=T6(t),i=n+T6(r),s=new Uint8Array(i+r);return C6(t,s,0),C6(r,s,n),s.set(e,i),new iA(t,r,e,s)},iA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},K6=({name:t,code:e,encode:r})=>new sA(t,e,r),sA=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?nA(this.code,r):r.then(n=>nA(this.code,n))}else throw Error("Unknown type, must be binary type")}},z6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),nW=K6({name:"sha2-256",code:18,encode:z6("SHA-256")}),iW=K6({name:"sha2-512",code:19,encode:z6("SHA-512")}),sW=Object.freeze({__proto__:null,sha256:nW,sha512:iW}),W6=0,oW="identity",$6=j6,aW=t=>nA(W6,$6(t)),uW={code:W6,name:oW,encode:$6,digest:aW},cW=Object.freeze({__proto__:null,identity:uW});new TextEncoder,new TextDecoder;var x6={...nz,...sz,...az,...cz,...hz,..._z,...Sz,...xz,...Bz,...qz};({...sW,...cW});function lW(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Y6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var N6=Y6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Yv=Y6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=lW(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Xp=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=eP,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=Yp.generateKeyPair(i);return Yp.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Yp.generateKeyPair(s),a=ee.generateRandomBytes32(),u=tP;return await Yp.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=b6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let y=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(y,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return b6.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?VK.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.keychain=n||new Jp(this.core,this.logger)}get context(){return tt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(oA)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(oA,e)}return hW(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Zp=class extends Ki.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=iP,this.version=sP,this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=tt.generateChildLogger(e,this.name),this.core=r}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},aA=class extends Ki.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new go.EventEmitter,this.name=aP,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||oP,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l}},d=ee.hashMessage(i);this.queue.set(d,f);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l),this.publishTimeout),this.relayer.events.emit(Ft.publish,f)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(Ft.connection_stalled);return}this.onPublish(d,f),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return tt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,u,l,f;let d={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return ee.isUndefined((a=d.params)==null?void 0:a.prompt)&&((u=d.params)==null||delete u.prompt),ee.isUndefined((l=d.params)==null?void 0:l.tag)&&((f=d.params)==null||delete f.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(og.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},uA=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},mW=Object.defineProperty,wW=Object.defineProperties,EW=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,vW=Object.prototype.hasOwnProperty,AW=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?mW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))vW.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))AW.call(e,r)&&O6(t,r,e[r]);return t},Jv=(t,e)=>wW(t,EW(e)),eg=class extends Ki.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new uA,this.events=new go.EventEmitter,this.name=gP,this.version=yP,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ei,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new St.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=mP&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.clientId=""}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,Jv(Dl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Dl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,Dl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Vr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Vr.deleted,Jv(Dl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vr.sync)}async reset(){if(!this.cached.length)return;let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>Jv(Dl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(og.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Ft.connect,async()=>{await this.onConnect()}),this.relayer.on(Ft.disconnect,()=>{this.onDisconnect()}),this.events.on(Vr.created,async e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Vr.deleted,async e=>{let r=Vr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},_W=Object.defineProperty,P6=Object.getOwnPropertySymbols,bW=Object.prototype.hasOwnProperty,IW=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?_W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,SW=(t,e)=>{for(var r in e||(e={}))bW.call(e,r)&&B6(t,r,e[r]);if(P6)for(var r of P6(e))IW.call(e,r)&&B6(t,r,e[r]);return t},tg=class extends Ki.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new go.EventEmitter,this.name=lP,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?tt.generateChildLogger(e.logger,this.name):V6.default(tt.getDefaultLoggerOptions({level:e.logger||cP})),this.messages=new Zp(this.logger,e.core),this.subscriber=new eg(this,this.logger),this.publisher=new aA(this,this.logger),this.relayUrl=e?.relayUrl||lA,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return tt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Vr.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(Ft.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Vr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,"socket stalled").catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Ft.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Ft.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Ft.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(this.relayUrl=e||this.relayUrl,await this.transportClose(),await new Promise(r=>setTimeout(r,500)),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new jK.JsonRpcProvider(new zK.default(ee.formatRelayRpcUrl({sdkVersion:dP,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),jr.isJsonRpcRequest(e)){if(!e.method.endsWith(fP))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(SW({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ft.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=jr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(Ol.payload,e=>this.onProviderPayload(e)),this.provider.on(Ol.connect,()=>{this.events.emit(Ft.connect)}),this.provider.on(Ol.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(Ol.error,e=>{this.logger.error(e),this.events.emit(Ft.error,e)})}registerEventListeners(){this.events.on(Ft.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Ft.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},St.toMiliseconds(hP))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},CW=Object.defineProperty,R6=Object.getOwnPropertySymbols,TW=Object.prototype.hasOwnProperty,xW=Object.prototype.propertyIsEnumerable,L6=(t,e,r)=>e in t?CW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F6=(t,e)=>{for(var r in e||(e={}))TW.call(e,r)&&L6(t,r,e[r]);if(R6)for(var r of R6(e))xW.call(e,r)&&L6(t,r,e[r]);return t},rg=class extends Ki.IStore{constructor(e,r,n,i=ei,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=pP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>WK.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=F6(F6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=tt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ng=class{constructor(e,r){this.core=e,this.logger=r,this.name=wP,this.version=EP,this.events=new kK.default,this.initialized=!1,this.storagePrefix=ei,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(St.FIVE_MINUTES),o={protocol:uP},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(St.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(St.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=jr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ru[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=jr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=jr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method]?Ru[u.request.method].res:Ru.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{jr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):jr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.pairings=new rg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return tt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ft.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);jr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):jr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Tr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},ig=class extends Ki.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new go.EventEmitter,this.name=vP,this.version=AP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(qr.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=jr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(qr.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(qr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:jr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(qr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(qr.created,e=>{let r=qr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.updated,e=>{let r=qr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.deleted,e=>{let r=qr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sg=class extends Ki.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new go.EventEmitter,this.name=_P,this.version=bP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Tr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Tr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Tr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;St.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Tr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(og.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Tr.created,e=>{let r=Tr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.expired,e=>{let r=Tr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.deleted,e=>{let r=Tr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},NW=Object.defineProperty,M6=Object.getOwnPropertySymbols,DW=Object.prototype.hasOwnProperty,OW=Object.prototype.propertyIsEnumerable,U6=(t,e,r)=>e in t?NW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,q6=(t,e)=>{for(var r in e||(e={}))DW.call(e,r)&&U6(t,r,e[r]);if(M6)for(var r of M6(e))OW.call(e,r)&&U6(t,r,e[r]);return t},Lu=class extends Ki.ICore{constructor(e){super(e),this.protocol=cA,this.version=J6,this.name=ug,this.events=new go.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||lA;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:V6.default(tt.getDefaultLoggerOptions({level:e?.logger||X6.logger}));this.logger=tt.generateChildLogger(r,this.name),this.heartbeat=new og.HeartBeat,this.crypto=new Xp(this,this.logger,e?.keychain),this.history=new ig(this,this.logger),this.expirer=new sg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new KK.default(q6(q6({},Z6),e?.storageOptions)),this.relayer=new tg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ng(this,this.logger)}static async init(e){let r=new Lu(e);return await r.initialize(),r}get context(){return tt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},PW=Lu;ve.CORE_CONTEXT=ug,ve.CORE_DEFAULT=X6,ve.CORE_PROTOCOL=cA,ve.CORE_STORAGE_OPTIONS=Z6,ve.CORE_STORAGE_PREFIX=ei,ve.CORE_VERSION=J6,ve.CRYPTO_CLIENT_SEED=oA,ve.CRYPTO_CONTEXT=eP,ve.CRYPTO_JWT_TTL=tP,ve.Core=PW,ve.Crypto=Xp,ve.EXPIRER_CONTEXT=_P,ve.EXPIRER_DEFAULT_TTL=yW,ve.EXPIRER_EVENTS=Tr,ve.EXPIRER_STORAGE_VERSION=bP,ve.Expirer=sg,ve.HISTORY_CONTEXT=vP,ve.HISTORY_EVENTS=qr,ve.HISTORY_STORAGE_VERSION=AP,ve.JsonRpcHistory=ig,ve.KEYCHAIN_CONTEXT=rP,ve.KEYCHAIN_STORAGE_VERSION=nP,ve.KeyChain=Jp,ve.MESSAGES_CONTEXT=iP,ve.MESSAGES_STORAGE_VERSION=sP,ve.MessageTracker=Zp,ve.PAIRING_CONTEXT=wP,ve.PAIRING_DEFAULT_TTL=gW,ve.PAIRING_RPC_OPTS=Ru,ve.PAIRING_STORAGE_VERSION=EP,ve.PENDING_SUB_RESOLUTION_TIMEOUT=mP,ve.PUBLISHER_CONTEXT=aP,ve.PUBLISHER_DEFAULT_TTL=oP,ve.Pairing=ng,ve.RELAYER_CONTEXT=lP,ve.RELAYER_DEFAULT_LOGGER=cP,ve.RELAYER_DEFAULT_PROTOCOL=uP,ve.RELAYER_DEFAULT_RELAY_URL=lA,ve.RELAYER_EVENTS=Ft,ve.RELAYER_PROVIDER_EVENTS=Ol,ve.RELAYER_RECONNECT_TIMEOUT=hP,ve.RELAYER_SDK_VERSION=dP,ve.RELAYER_STORAGE_OPTIONS=dW,ve.RELAYER_SUBSCRIBER_SUFFIX=fP,ve.Relayer=tg,ve.STORE_STORAGE_VERSION=pP,ve.SUBSCRIBER_CONTEXT=gP,ve.SUBSCRIBER_DEFAULT_TTL=pW,ve.SUBSCRIBER_EVENTS=Vr,ve.SUBSCRIBER_STORAGE_VERSION=yP,ve.Store=rg,ve.Subscriber=eg,ve.default=Lu});var LP=v(nt=>{"use strict";c();Object.defineProperty(nt,"__esModule",{value:!0});var BW=pd(),zi=IP(),fA=PE(),TP=$E(),k=Ip(),xP=Hn(),it=to(),Ct=(Il(),rt(Kt));function NP(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var RW=NP(BW),LW=NP(xP),mA="wc",wA=2,EA="client",fg=`${mA}@${wA}:${EA}:`,cg={name:EA,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},FW={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},MW={database:":memory:"},UW={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},qW="history",VW="0.3",DP="proposal",jW=it.THIRTY_DAYS,OP="Proposal expired",PP="session",Rl=it.SEVEN_DAYS,BP="engine",Fu={wc_sessionPropose:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1104},res:{ttl:it.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1106},res:{ttl:it.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1112},res:{ttl:it.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1115}}},lg={min:it.FIVE_MINUTES,max:it.SEVEN_DAYS},RP="request",HW=Object.defineProperty,GW=Object.defineProperties,QW=Object.getOwnPropertyDescriptors,SP=Object.getOwnPropertySymbols,kW=Object.prototype.hasOwnProperty,KW=Object.prototype.propertyIsEnumerable,CP=(t,e,r)=>e in t?HW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xr=(t,e)=>{for(var r in e||(e={}))kW.call(e,r)&&CP(t,r,e[r]);if(SP)for(var r of SP(e))KW.call(e,r)&&CP(t,r,e[r]);return t},hA=(t,e)=>GW(t,QW(e)),dA=class extends TP.IEngine{constructor(e){super(e),this.name=BP,this.events=new LW.default,this.initialized=!1,this.ignoredPayloadTypes=[k.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Fu)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=hA(xr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:b,uri:T}=await this.client.core.pairing.create();l=b,f=T}let y=await this.client.core.crypto.generateKeyPair(),w=xr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:zi.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:y,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:N,done:R}=k.createDelayedPromise(it.FIVE_MINUTES,OP);if(this.events.once(k.engineEvent("session_connect"),async({error:b,session:T})=>{if(b)E(b);else if(T){T.self.publicKey=y;let P=hA(xr({},T),{requiredNamespaces:T.requiredNamespaces,optionalNamespaces:T.optionalNamespaces});await this.client.session.set(T.topic,P),await this.setExpiry(T.topic,T.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:T.peer.metadata}),N(P)}}),!l){let{message:b}=k.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(b)}let M=await this.sendRequest(l,"wc_sessionPropose",w),x=k.calcExpiry(it.FIVE_MINUTES);return await this.setProposal(M,xr({id:M,expiry:x},w)),{uri:f,approval:R}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",k.isValidObject(f)||(f=k.getRequiredNamespacesFromNamespaces(s,"approve()"));let y=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(y,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:y}),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let N=xr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:y,metadata:this.client.metadata},expiry:k.calcExpiry(Rl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest(E,"wc_sessionSettle",N);let R=hA(xr({},N),{topic:E,pairingTopic:u,acknowledged:!1,self:N.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:y});return await this.client.session.set(E,R),await this.setExpiry(E,k.calcExpiry(Rl)),{topic:E,acknowledged:()=>new Promise(M=>M(this.client.session.get(E)))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,k.calcExpiry(Rl)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=k.createDelayedPromise(o);return this.events.once(k.engineEvent("session_request",a),({error:d,result:y})=>{d?f(d):l(y)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;Ct.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):Ct.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();this.events.once(k.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",k.getSdkError("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>k.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,k.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Fu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,k.calcExpiry(n))},this.sendRequest=async(r,n,i,s)=>{let o=Ct.formatJsonRpcRequest(n,i),a=await this.client.core.crypto.encode(r,o),u=Fu[n].req;return s&&(u.ttl=s),this.client.core.history.set(r,o),this.client.core.relayer.publish(r,a,u),o.id},this.sendResult=async(r,n,i)=>{let s=Ct.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=Ct.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{k.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{k.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(xr({},n.params));let o=k.calcExpiry(it.FIVE_MINUTES),a=xr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(Ct.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else Ct.isJsonRpcError(n)&&(await this.client.proposal.delete(i,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:y,pairingTopic:w}=n.params,E=xr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},y&&{sessionProperties:y});await this.sendResult(n.id,r,!0),this.events.emit(k.engineEvent("session_connect"),{session:E})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(k.engineEvent("session_approve",i),{})):Ct.isJsonRpcError(n)&&(await this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(xr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_update",i),{}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,k.calcExpiry(Rl)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_extend",i),{}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_ping",i),{}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),this.client.core.relayer.once(zi.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(r)}),await this.sendResult(i,r,!0),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(xr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_request",i),{result:n.result}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(xr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(k.isUndefined(n)||await this.isValidPairingTopic(n),!k.isValidRelays(a,!0)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!k.isUndefined(i)&&k.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!k.isUndefined(s)&&k.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=k.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!k.isValidParams(r))throw new Error(k.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=k.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=k.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!k.isValidString(s,!0)){let{message:f}=k.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!k.isValidErrorReason(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!k.isValidParams(r)){let{message:l}=k.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!k.isValidRelay(n)){let{message:l}=k.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=k.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=k.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(k.isExpired(o)){let{message:l}=k.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=k.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=k.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!k.isValidNamespacesChainId(a,s)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!k.isValidRequest(i)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!k.isValidNamespacesRequest(a,s,i.method)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!k.isValidRequestExpiry(o,lg)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${lg.min} and ${lg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!k.isValidResponse(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!k.isValidParams(r)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!k.isValidNamespacesChainId(o,s)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!k.isValidEvent(i)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!k.isValidNamespacesEvent(o,s,i.name)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!k.isValidString(i,!1)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=k.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(zi.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);Ct.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Ct.isJsonRpcResponse(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(zi.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=k.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,k.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=k.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=k.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(k.isValidString(e,!1)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!k.isValidId(e)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=k.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},pA=class extends zi.Store{constructor(e,r){super(e,r,DP,fg),this.core=e,this.logger=r}},gA=class extends zi.Store{constructor(e,r){super(e,r,PP,fg),this.core=e,this.logger=r}},yA=class extends zi.Store{constructor(e,r){super(e,r,RP,fg,n=>n.id),this.core=e,this.logger=r}},Mu=class extends TP.ISignClient{constructor(e){super(e),this.protocol=mA,this.version=wA,this.name=cg.name,this.events=new xP.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||cg.name,this.metadata=e?.metadata||k.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:RW.default(fA.getDefaultLoggerOptions({level:e?.logger||cg.logger}));this.core=e?.core||new zi.Core(e),this.logger=fA.generateChildLogger(r,this.name),this.session=new gA(this.core,this.logger),this.proposal=new pA(this.core,this.logger),this.pendingRequest=new yA(this.core,this.logger),this.engine=new dA(this)}static async init(e){let r=new Mu(e);return await r.initialize(),r}get context(){return fA.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},zW=Mu;nt.ENGINE_CONTEXT=BP,nt.ENGINE_RPC_OPTS=Fu,nt.HISTORY_CONTEXT=qW,nt.HISTORY_EVENTS=UW,nt.HISTORY_STORAGE_VERSION=VW,nt.PROPOSAL_CONTEXT=DP,nt.PROPOSAL_EXPIRY=jW,nt.PROPOSAL_EXPIRY_MESSAGE=OP,nt.REQUEST_CONTEXT=RP,nt.SESSION_CONTEXT=PP,nt.SESSION_EXPIRY=Rl,nt.SESSION_REQUEST_EXPIRY_BOUNDARIES=lg,nt.SIGN_CLIENT_CONTEXT=EA,nt.SIGN_CLIENT_DEFAULT=cg,nt.SIGN_CLIENT_EVENTS=FW,nt.SIGN_CLIENT_PROTOCOL=mA,nt.SIGN_CLIENT_STORAGE_OPTIONS=MW,nt.SIGN_CLIENT_STORAGE_PREFIX=fg,nt.SIGN_CLIENT_VERSION=wA,nt.SignClient=zW,nt.default=Mu});var vA=v(Ll=>{"use strict";c();Object.defineProperty(Ll,"__esModule",{value:!0});Ll.Operation=void 0;var WW;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage",t.SIGN_LOGIN_TOKEN="mvx_signLoginToken"})(WW=Ll.Operation||(Ll.Operation={}))});var FP=v(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.WALLETCONNECT_MULTIVERSX_METHODS=Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;var $W=vA();Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Wi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values($W.Operation)});var MP=v(hg=>{"use strict";c();Object.defineProperty(hg,"__esModule",{value:!0});hg.Logger=void 0;var AA=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};hg.Logger=AA});var UP=v(Uu=>{"use strict";c();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.Signature=Uu.Address=void 0;var _A=class{constructor(e){this.value=e}bech32(){return this.value}};Uu.Address=_A;var Fl=class{constructor(e){this.buffer=e}static fromHex(e){return new Fl(h.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Uu.Signature=Fl});var SA=v(Hr=>{"use strict";c();Object.defineProperty(Hr,"__esModule",{value:!0});Hr.WalletConnectV2ProviderErrorMessagesEnum=Hr.ErrBadAddress=Hr.ErrNotImplemented=Hr.Err=void 0;var Ml=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Hr.Err=Ml;var bA=class extends Ml{constructor(){super("Method not yet implemented")}};Hr.ErrNotImplemented=bA;var IA=class extends Ml{constructor(e,r){super(`Bad address: ${e}`,r)}};Hr.ErrBadAddress=IA;var YW;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection"})(YW=Hr.WalletConnectV2ProviderErrorMessagesEnum||(Hr.WalletConnectV2ProviderErrorMessagesEnum={}))});var VP=v(bn=>{"use strict";c();var JW=bn&&bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XW=bn&&bn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZW=bn&&bn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JW(e,t,r);return XW(e,t),e};Object.defineProperty(bn,"__esModule",{value:!0});bn.UserAddress=void 0;var e$=ZW(Tf()),qP=SA(),t$="erd",Ul=class{constructor(e){this.value=e}static fromBech32(e){let r;try{r=e$.decode(e)}catch(n){throw new qP.ErrBadAddress(e,n)}if(r.prefix!=t$)throw new qP.ErrBadAddress(e);return new Ul(e)}bech32(){return this.value}};bn.UserAddress=Ul});var Vl=v(In=>{"use strict";c();var gt=In&&In.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},r$=In&&In.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(In,"__esModule",{value:!0});In.WalletConnectV2Provider=In.WalletConnectV2ProviderErrorMessagesEnum=void 0;var n$=r$(LP()),CA=Ip(),yo=FP(),dg=vA(),Re=MP(),ql=UP(),de=SA();Object.defineProperty(In,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return de.WalletConnectV2ProviderErrorMessagesEnum}});var pg=VP(),TA=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.namespace=yo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.namespace=yo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.session=void 0}init(){return gt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let e=yield n$.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,this.isInitializing=!1,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let o=this.getConnectionParams(e);try{let a=yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},o));return this.events=(n=(r=o?.requiredNamespaces)===null||r===void 0?void 0:r[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||n===void 0?void 0:n.events,this.methods=(s=(i=o?.requiredNamespaces)===null||i===void 0?void 0:i[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||s===void 0?void 0:s.methods,a}catch{throw this.reset(),Re.Logger.error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return gt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=this.getAddressFromSession(n),{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:dg.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!s)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:s})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||this.getCurrentTopic(this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:CA.getSdkError("USER_DISCONNECTED")});else{let r=this.getCurrentTopic(this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:CA.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:dg.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new ql.Signature(n),pg.UserAddress.fromBech32(r))}catch{throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.toPlainObject(n);if(this.chainId!==e.getChainID().valueOf())throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:dg.Operation.SIGN_TRANSACTION,params:{transaction:i}}});if(!s)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(ql.Signature.fromHex(s),pg.UserAddress.fromBech32(r)),e}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(n)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:dg.Operation.SIGN_TRANSACTIONS,params:{transactions:i}}});(!s||!Array.isArray(s))&&Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(ql.Signature.fromHex(s[o].signature),pg.UserAddress.fromBech32(r));return e}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});if(!s)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=this.getCurrentTopic(this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return gt(this,void 0,void 0,function*(){return e?this.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Re.Logger.error(`${de.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return gt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=this.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=this.getCurrentSession(e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return gt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!CA.isValidArray(f))return;for(let d of f)e.deletePairings?(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0):yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}getCurrentSession(e){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(this.getConnectionParams()).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}else if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}else throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=this.getCurrentSession(e);if(r?.topic)return r.topic;throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getConnectionParams(e){var r,n;let i=[...yo.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]],s=[`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=(n=e?.events)!==null&&n!==void 0?n:[];return{requiredNamespaces:{[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:o}}}}addressIsValid(e){try{return!!pg.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let r=e.namespaces[this.namespace];if(r&&r.accounts){let n=r.accounts[0],[i,s,o]=n.split(":");return o}return""}};In.WalletConnectV2Provider=TA});var HP=v(($ce,jP)=>{"use strict";c();jP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var kP=v((Jce,QP)=>{"use strict";c();var GP=typeof Symbol<"u"&&Symbol,i$=HP();QP.exports=function(){return typeof GP!="function"||typeof Symbol!="function"||typeof GP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:i$()}});var zP=v((Zce,KP)=>{"use strict";c();var s$="Function.prototype.bind called on incompatible ",xA=Array.prototype.slice,o$=Object.prototype.toString,a$="[object Function]";KP.exports=function(e){var r=this;if(typeof r!="function"||o$.call(r)!==a$)throw new TypeError(s$+r);for(var n=xA.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(xA.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(xA.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var u$=zP();WP.exports=Function.prototype.bind||u$});var YP=v((nle,$P)=>{"use strict";c();var c$=gg();$P.exports=c$.call(Function.call,Object.prototype.hasOwnProperty)});var wg=v((sle,t8)=>{"use strict";c();var Oe,Hu=SyntaxError,e8=Function,ju=TypeError,NA=function(t){try{return e8('"use strict"; return ('+t+").constructor;")()}catch{}},mo=Object.getOwnPropertyDescriptor;if(mo)try{mo({},"")}catch{mo=null}var DA=function(){throw new ju},l$=mo?function(){try{return arguments.callee,DA}catch{try{return mo(arguments,"callee").get}catch{return DA}}}():DA,qu=kP()(),Sn=Object.getPrototypeOf||function(t){return t.__proto__},Vu={},f$=typeof Uint8Array>"u"?Oe:Sn(Uint8Array),wo={"%AggregateError%":typeof AggregateError>"u"?Oe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Oe:ArrayBuffer,"%ArrayIteratorPrototype%":qu?Sn([][Symbol.iterator]()):Oe,"%AsyncFromSyncIteratorPrototype%":Oe,"%AsyncFunction%":Vu,"%AsyncGenerator%":Vu,"%AsyncGeneratorFunction%":Vu,"%AsyncIteratorPrototype%":Vu,"%Atomics%":typeof Atomics>"u"?Oe:Atomics,"%BigInt%":typeof BigInt>"u"?Oe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Oe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Oe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Oe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Oe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Oe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Oe:FinalizationRegistry,"%Function%":e8,"%GeneratorFunction%":Vu,"%Int8Array%":typeof Int8Array>"u"?Oe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Oe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Oe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qu?Sn(Sn([][Symbol.iterator]())):Oe,"%JSON%":typeof JSON=="object"?JSON:Oe,"%Map%":typeof Map>"u"?Oe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!qu?Oe:Sn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Oe:Promise,"%Proxy%":typeof Proxy>"u"?Oe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Oe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Oe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!qu?Oe:Sn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Oe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qu?Sn(""[Symbol.iterator]()):Oe,"%Symbol%":qu?Symbol:Oe,"%SyntaxError%":Hu,"%ThrowTypeError%":l$,"%TypedArray%":f$,"%TypeError%":ju,"%Uint8Array%":typeof Uint8Array>"u"?Oe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Oe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Oe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Oe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Oe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Oe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Oe:WeakSet};try{null.error}catch(t){JP=Sn(Sn(t)),wo["%Error.prototype%"]=JP}var JP,h$=function t(e){var r;if(e==="%AsyncFunction%")r=NA("async function () {}");else if(e==="%GeneratorFunction%")r=NA("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=NA("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&(r=Sn(i.prototype))}return wo[e]=r,r},XP={"%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"]},jl=gg(),yg=YP(),d$=jl.call(Function.call,Array.prototype.concat),p$=jl.call(Function.apply,Array.prototype.splice),ZP=jl.call(Function.call,String.prototype.replace),mg=jl.call(Function.call,String.prototype.slice),g$=jl.call(Function.call,RegExp.prototype.exec),y$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,m$=/\\(\\)?/g,w$=function(e){var r=mg(e,0,1),n=mg(e,-1);if(r==="%"&&n!=="%")throw new Hu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Hu("invalid intrinsic syntax, expected opening `%`");var i=[];return ZP(e,y$,function(s,o,a,u){i[i.length]=a?ZP(u,m$,"$1"):o||s}),i},E$=function(e,r){var n=e,i;if(yg(XP,n)&&(i=XP[n],n="%"+i[0]+"%"),yg(wo,n)){var s=wo[n];if(s===Vu&&(s=h$(n)),typeof s>"u"&&!r)throw new ju("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Hu("intrinsic "+e+" does not exist!")};t8.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new ju("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ju('"allowMissing" argument must be a boolean');if(g$(/^%?[^%]*%?$/,e)===null)throw new Hu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=w$(e),i=n.length>0?n[0]:"",s=E$("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],p$(n,d$([0,1],l)));for(var f=1,d=!0;f=n.length){var N=mo(a,y);d=!!N,d&&"get"in N&&!("originalValue"in N.get)?a=N.get:a=a[y]}else d=yg(a,y),a=a[y];d&&!u&&(wo[o]=a)}}return a}});var a8=v((ale,Eg)=>{"use strict";c();var OA=gg(),Gu=wg(),i8=Gu("%Function.prototype.apply%"),s8=Gu("%Function.prototype.call%"),o8=Gu("%Reflect.apply%",!0)||OA.call(s8,i8),r8=Gu("%Object.getOwnPropertyDescriptor%",!0),Eo=Gu("%Object.defineProperty%",!0),v$=Gu("%Math.max%");if(Eo)try{Eo({},"a",{value:1})}catch{Eo=null}Eg.exports=function(e){var r=o8(OA,s8,arguments);if(r8&&Eo){var n=r8(r,"length");n.configurable&&Eo(r,"length",{value:1+v$(0,e.length-(arguments.length-1))})}return r};var n8=function(){return o8(OA,i8,arguments)};Eo?Eo(Eg.exports,"apply",{value:n8}):Eg.exports.apply=n8});var f8=v((cle,l8)=>{"use strict";c();var u8=wg(),c8=a8(),A$=c8(u8("String.prototype.indexOf"));l8.exports=function(e,r){var n=u8(e,!!r);return typeof n=="function"&&A$(e,".prototype.")>-1?c8(n):n}});var h8=v(()=>{c()});var P8=v((ple,O8)=>{c();var jA=typeof Map=="function"&&Map.prototype,PA=Object.getOwnPropertyDescriptor&&jA?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ag=jA&&PA&&typeof PA.get=="function"?PA.get:null,d8=jA&&Map.prototype.forEach,HA=typeof Set=="function"&&Set.prototype,BA=Object.getOwnPropertyDescriptor&&HA?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_g=HA&&BA&&typeof BA.get=="function"?BA.get:null,p8=HA&&Set.prototype.forEach,_$=typeof WeakMap=="function"&&WeakMap.prototype,Gl=_$?WeakMap.prototype.has:null,b$=typeof WeakSet=="function"&&WeakSet.prototype,Ql=b$?WeakSet.prototype.has:null,I$=typeof WeakRef=="function"&&WeakRef.prototype,g8=I$?WeakRef.prototype.deref:null,S$=Boolean.prototype.valueOf,C$=Object.prototype.toString,T$=Function.prototype.toString,x$=String.prototype.match,GA=String.prototype.slice,Yi=String.prototype.replace,N$=String.prototype.toUpperCase,y8=String.prototype.toLowerCase,S8=RegExp.prototype.test,m8=Array.prototype.concat,Cn=Array.prototype.join,D$=Array.prototype.slice,w8=Math.floor,FA=typeof BigInt=="function"?BigInt.prototype.valueOf:null,RA=Object.getOwnPropertySymbols,MA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",zt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qu||"symbol")?Symbol.toStringTag:null,C8=Object.prototype.propertyIsEnumerable,E8=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function v8(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||S8.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-w8(-t):w8(t);if(n!==t){var i=String(n),s=GA.call(e,i.length+1);return Yi.call(i,r,"$&_")+"."+Yi.call(Yi.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yi.call(e,r,"$&_")}var UA=h8(),A8=UA.custom,_8=x8(A8)?A8:null;O8.exports=function t(e,r,n,i){var s=r||{};if($i(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if($i(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=$i(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if($i(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if($i(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return D8(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?v8(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?v8(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return qA(e)?"[Array]":"[Object]";var d=W$(s,n);if(typeof i>"u")i=[];else if(N8(i,e)>=0)return"[Circular]";function y(G,$,pe){if($&&(i=D$.call(i),i.push($)),pe){var ae={depth:s.depth};return $i(s,"quoteStyle")&&(ae.quoteStyle=s.quoteStyle),t(G,ae,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!b8(e)){var w=q$(e),E=vg(e,y);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Cn.call(E,", ")+" }":"")}if(x8(e)){var N=Qu?Yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):MA.call(e);return typeof e=="object"&&!Qu?Hl(N):N}if(k$(e)){for(var R="<"+y8.call(String(e.nodeName)),M=e.attributes||[],x=0;x",R}if(qA(e)){if(e.length===0)return"[]";var b=vg(e,y);return d&&!z$(b)?"["+VA(b,d)+"]":"[ "+Cn.call(b,", ")+" ]"}if(B$(e)){var T=vg(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!C8.call(e,"cause")?"{ ["+String(e)+"] "+Cn.call(m8.call("[cause]: "+y(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Cn.call(T,", ")+" }"}if(typeof e=="object"&&o){if(_8&&typeof e[_8]=="function"&&UA)return UA(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(V$(e)){var P=[];return d8&&d8.call(e,function(G,$){P.push(y($,e,!0)+" => "+y(G,e))}),I8("Map",Ag.call(e),P,d)}if(G$(e)){var B=[];return p8&&p8.call(e,function(G){B.push(y(G,e))}),I8("Set",_g.call(e),B,d)}if(j$(e))return LA("WeakMap");if(Q$(e))return LA("WeakSet");if(H$(e))return LA("WeakRef");if(L$(e))return Hl(y(Number(e)));if(M$(e))return Hl(y(FA.call(e)));if(F$(e))return Hl(S$.call(e));if(R$(e))return Hl(y(String(e)));if(!P$(e)&&!b8(e)){var _=vg(e,y),S=E8?E8(e)===Object.prototype:e instanceof Object||e.constructor===Object,F=e instanceof Object?"":"null prototype",Z=!S&&zt&&Object(e)===e&&zt in e?GA.call(Ji(e),8,-1):F?"Object":"",K=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=K+(Z||F?"["+Cn.call(m8.call([],Z||[],F||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+VA(_,d)+"}":H+"{ "+Cn.call(_,", ")+" }"}return String(e)};function T8(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function O$(t){return Yi.call(String(t),/"/g,""")}function qA(t){return Ji(t)==="[object Array]"&&(!zt||!(typeof t=="object"&&zt in t))}function P$(t){return Ji(t)==="[object Date]"&&(!zt||!(typeof t=="object"&&zt in t))}function b8(t){return Ji(t)==="[object RegExp]"&&(!zt||!(typeof t=="object"&&zt in t))}function B$(t){return Ji(t)==="[object Error]"&&(!zt||!(typeof t=="object"&&zt in t))}function R$(t){return Ji(t)==="[object String]"&&(!zt||!(typeof t=="object"&&zt in t))}function L$(t){return Ji(t)==="[object Number]"&&(!zt||!(typeof t=="object"&&zt in t))}function F$(t){return Ji(t)==="[object Boolean]"&&(!zt||!(typeof t=="object"&&zt in t))}function x8(t){if(Qu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!MA)return!1;try{return MA.call(t),!0}catch{}return!1}function M$(t){if(!t||typeof t!="object"||!FA)return!1;try{return FA.call(t),!0}catch{}return!1}var U$=Object.prototype.hasOwnProperty||function(t){return t in this};function $i(t,e){return U$.call(t,e)}function Ji(t){return C$.call(t)}function q$(t){if(t.name)return t.name;var e=x$.call(T$.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function N8(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return D8(GA.call(t,0,e.maxStringLength),e)+n}var i=Yi.call(Yi.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,K$);return T8(i,"single",e)}function K$(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+N$.call(e.toString(16))}function Hl(t){return"Object("+t+")"}function LA(t){return t+" { ? }"}function I8(t,e,r,n){var i=n?VA(r,n):Cn.call(r,", ");return t+" ("+e+") {"+i+"}"}function z$(t){for(var e=0;e=0)return!1;return!0}function W$(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Cn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Cn.call(Array(e+1),r)}}function VA(t,e){if(t.length===0)return"";var r=` + Approved: ${y.toString()}`))}),o.forEach(d=>{n||(Ui(i[d].methods,s[d].methods)?Ui(i[d].events,s[d].events)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function LQ(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function dO(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function FQ(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:lo(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function MQ(t,e){return vp(t,!1)&&t<=e.max&&t>=e.min}Q.BASE10=fv,Q.BASE16=$t,Q.BASE64=dp,Q.COLON=B9,Q.DEFAULT_DEPTH=gv,Q.EMPTY_SPACE=pp,Q.ENV_MAP=Tu,Q.ONE_THOUSAND=R9,Q.REACT_NATIVE_PRODUCT=NO,Q.RELAYER_DEFAULT_PROTOCOL=HO,Q.SDK_TYPE=OO,Q.SLASH=DO,Q.TYPE_0=hv,Q.TYPE_1=Nu,Q.UTF8=wp,Q.appendToQueryString=RO,Q.assertType=q9,Q.buildApprovedNamespaces=yQ,Q.calcExpiry=J9,Q.capitalize=k9,Q.capitalizeWord=VO,Q.createDelayedPromise=K9,Q.createExpiringPromise=z9,Q.decodeTypeByte=El,Q.decrypt=T9,Q.deriveSymKey=b9,Q.deserialize=pv,Q.encodeTypeByte=CO,Q.encrypt=C9,Q.engineEvent=Z9,Q.enumify=Q9,Q.formatAccountId=vO,Q.formatAccountWithChain=d9,Q.formatChainId=EO,Q.formatExpirerTarget=wv,Q.formatIdTarget=$9,Q.formatMessage=E9,Q.formatMessageContext=V9,Q.formatRelayParams=GO,Q.formatRelayRpcUrl=M9,Q.formatTopicTarget=W9,Q.formatUA=MO,Q.formatUri=aQ,Q.generateKeyPair=A9,Q.generateRandomBytes32=_9,Q.getAccountsChains=lo,Q.getAccountsFromNamespaces=g9,Q.getAddressFromAccount=AO,Q.getAddressesFromAccounts=p9,Q.getAppMetadata=L9,Q.getChainFromAccount=_O,Q.getChainsFromAccounts=bO,Q.getChainsFromNamespace=yp,Q.getChainsFromNamespaces=y9,Q.getChainsFromRequiredNamespaces=m9,Q.getDidAddress=SO,Q.getDidAddressSegments=mp,Q.getDidChainId=IO,Q.getEnvironment=mv,Q.getHttpUrl=U9,Q.getInternalError=Jn,Q.getJavascriptID=FO,Q.getJavascriptOS=LO,Q.getLastItems=qO,Q.getNamespacedDidChainId=w9,Q.getNamespacesChains=QO,Q.getNamespacesEventsForChainId=KO,Q.getNamespacesMethodsForChainId=kO,Q.getRelayClientMetadata=F9,Q.getRelayProtocolApi=tQ,Q.getRelayProtocolName=eQ,Q.getRequiredNamespacesFromNamespaces=gQ,Q.getSdkError=co,Q.getUniqueValues=lv,Q.hasOverlap=Ui,Q.hashKey=I9,Q.hashMessage=S9,Q.isBrowser=BO,Q.isCaipNamespace=Ev,Q.isConformingNamespaces=r3,Q.isExpired=X9,Q.isNode=yv,Q.isProposalStruct=AQ,Q.isReactNative=PO,Q.isSessionCompatible=EQ,Q.isSessionStruct=_Q,Q.isTypeOneEnvelope=N9,Q.isUndefined=Vi,Q.isValidAccountId=WO,Q.isValidAccounts=JO,Q.isValidActions=ZO,Q.isValidArray=vl,Q.isValidChainId=Ap,Q.isValidChains=$O,Q.isValidController=bQ,Q.isValidErrorReason=xQ,Q.isValidEvent=OQ,Q.isValidId=CQ,Q.isValidNamespaceAccounts=XO,Q.isValidNamespaceActions=vv,Q.isValidNamespaceChains=YO,Q.isValidNamespaceMethodsOrEvents=av,Q.isValidNamespaces=e3,Q.isValidNamespacesChainId=PQ,Q.isValidNamespacesEvent=RQ,Q.isValidNamespacesRequest=BQ,Q.isValidNumber=vp,Q.isValidObject=Ep,Q.isValidParams=TQ,Q.isValidRelay=t3,Q.isValidRelays=SQ,Q.isValidRequest=NQ,Q.isValidRequestExpiry=MQ,Q.isValidRequiredNamespaces=IQ,Q.isValidResponse=DQ,Q.isValidString=cr,Q.isValidUrl=vQ,Q.mapEntries=G9,Q.mapToObj=H9,Q.mergeArrays=qi,Q.normalizeNamespaces=ov,Q.objToMap=j9,Q.parseAccountId=cv,Q.parseChainId=wO,Q.parseContextNames=UO,Q.parseExpirerTarget=Y9,Q.parseNamespaceKey=zO,Q.parseRelayParams=jO,Q.parseUri=oQ,Q.serialize=TO,Q.validateDecoding=x9,Q.validateEncoding=xO});var n3,i3,s3,o3,bp,Al,Av,Ip,Hi,_l,Sp=ge(()=>{c();n3="PARSE_ERROR",i3="INVALID_REQUEST",s3="METHOD_NOT_FOUND",o3="INVALID_PARAMS",bp="INTERNAL_ERROR",Al="SERVER_ERROR",Av=[-32700,-32600,-32601,-32602,-32603],Ip=[-32e3,-32099],Hi={[n3]:{code:-32700,message:"Parse error"},[i3]:{code:-32600,message:"Invalid Request"},[s3]:{code:-32601,message:"Method not found"},[o3]:{code:-32602,message:"Invalid params"},[bp]:{code:-32603,message:"Internal error"},[Al]:{code:-32e3,message:"Server error"}},_l=Al});function UQ(t){return t<=Ip[0]&&t>=Ip[1]}function Cp(t){return Av.includes(t)}function a3(t){return typeof t=="number"}function Tp(t){return Object.keys(Hi).includes(t)?Hi[t]:Hi[_l]}function xp(t){let e=Object.values(Hi).find(r=>r.code===t);return e||Hi[_l]}function qQ(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!a3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Cp(t.error.code)){let e=xp(t.error.code);if(e.message!==Hi[_l].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function _v(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var bv=ge(()=>{c();Sp()});var c3=v(ji=>{"use strict";c();Object.defineProperty(ji,"__esModule",{value:!0});ji.isBrowserCryptoAvailable=ji.getSubtleCrypto=ji.getBrowerCrypto=void 0;function Iv(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}ji.getBrowerCrypto=Iv;function u3(){let t=Iv();return t.subtle||t.webkitSubtle}ji.getSubtleCrypto=u3;function VQ(){return!!Iv()&&!!u3()}ji.isBrowserCryptoAvailable=VQ});var h3=v(Gi=>{"use strict";c();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.isBrowser=Gi.isNode=Gi.isReactNative=void 0;function l3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Gi.isReactNative=l3;function f3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}Gi.isNode=f3;function HQ(){return!l3()&&!f3()}Gi.isBrowser=HQ});var Sv=v(Np=>{"use strict";c();Object.defineProperty(Np,"__esModule",{value:!0});var d3=(ar(),nt(or));d3.__exportStar(c3(),Np);d3.__exportStar(h3(),Np)});var Ot={};at(Ot,{isNodeJs:()=>g3});var p3,g3,y3=ge(()=>{c();p3=be(Sv());Lt(Ot,be(Sv()));g3=p3.isNode});function Cv(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Tv(t=6){return BigInt(Cv(t))}function xv(t,e,r){return{id:r||Cv(),jsonrpc:"2.0",method:t,params:e}}function jQ(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Nv(t,e,r){return{id:t,jsonrpc:"2.0",error:m3(e,r)}}function m3(t,e){return typeof t>"u"?Tp(bp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Tp(Al)),{message:t})),typeof e<"u"&&(t.data=e),Cp(t.code)&&(t=xp(t.code)),t)}var w3=ge(()=>{c();bv();Sp()});function GQ(t){return t.includes("*")?Op(t):!/\W/g.test(t)}function Dp(t){return t==="*"}function Op(t){return Dp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function QQ(t){return!Dp(t)&&Op(t)&&!t.split("*")[0].trim()}function kQ(t){return!Dp(t)&&Op(t)&&!t.split("*")[1].trim()}var E3=ge(()=>{c()});var v3=ge(()=>{c()});var Du,Dv=ge(()=>{c();Du=class{}});var Ov,Pp,bl,A3=ge(()=>{c();Dv();Ov=class extends Du{constructor(e){super()}},Pp=class extends Du{constructor(){super()}},bl=class extends Pp{constructor(e){super()}}});var _3=ge(()=>{c()});var b3=ge(()=>{c();v3();Dv();A3();_3()});var I3=ge(()=>{c();b3()});function WQ(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function S3(t,e){let r=WQ(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $Q(t){return S3(t,KQ)}function Bp(t){return S3(t,zQ)}function Pv(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var KQ,zQ,C3=ge(()=>{c();KQ="^https?:",zQ="^wss?:"});function Bv(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function YQ(t){return Bv(t)&&"method"in t}function Rv(t){return Bv(t)&&(T3(t)||Rp(t))}function T3(t){return"result"in t}function Rp(t){return"error"in t}function JQ(t){return"error"in t&&t.valid===!1}var x3=ge(()=>{c()});var Kt={};at(Kt,{DEFAULT_ERROR:()=>_l,IBaseJsonRpcProvider:()=>Pp,IEvents:()=>Du,IJsonRpcConnection:()=>Ov,IJsonRpcProvider:()=>bl,INTERNAL_ERROR:()=>bp,INVALID_PARAMS:()=>o3,INVALID_REQUEST:()=>i3,METHOD_NOT_FOUND:()=>s3,PARSE_ERROR:()=>n3,RESERVED_ERROR_CODES:()=>Av,SERVER_ERROR:()=>Al,SERVER_ERROR_CODE_RANGE:()=>Ip,STANDARD_ERROR_MAP:()=>Hi,formatErrorMessage:()=>m3,formatJsonRpcError:()=>Nv,formatJsonRpcRequest:()=>xv,formatJsonRpcResult:()=>jQ,getBigIntRpcId:()=>Tv,getError:()=>Tp,getErrorByCode:()=>xp,isHttpUrl:()=>$Q,isJsonRpcError:()=>Rp,isJsonRpcPayload:()=>Bv,isJsonRpcRequest:()=>YQ,isJsonRpcResponse:()=>Rv,isJsonRpcResult:()=>T3,isJsonRpcValidationInvalid:()=>JQ,isLocalhostUrl:()=>Pv,isNodeJs:()=>g3,isReservedErrorCode:()=>Cp,isServerErrorCode:()=>UQ,isValidDefaultRoute:()=>Dp,isValidErrorCode:()=>a3,isValidLeadingWildcardRoute:()=>QQ,isValidRoute:()=>GQ,isValidTrailingWildcardRoute:()=>kQ,isValidWildcardRoute:()=>Op,isWsUrl:()=>Bp,parseConnectionError:()=>_v,payloadId:()=>Cv,validateJsonRpcError:()=>qQ});var Il=ge(()=>{c();Sp();bv();y3();Lt(Kt,Ot);w3();E3();I3();C3();x3()});var N3,Lp,D3,Lv=ge(()=>{c();N3=be(jn());Il();Lp=class extends bl{constructor(e){super(e),this.events=new N3.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(xv(e.method,e.params||[],Tv().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Rp(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Rv(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},D3=Lp});var O3={};at(O3,{JsonRpcProvider:()=>Lp,default:()=>XQ});var XQ,P3=ge(()=>{c();Lv();Lv();XQ=D3});var R3=v((mce,B3)=>{"use strict";c();B3.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var F3,L3,ZQ,ek,tk,Fp,M3,Fv=ge(()=>{c();F3=be(jn());Td();Il();L3=10,ZQ=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:R3(),ek=()=>typeof window<"u",tk=ZQ(),Fp=class{constructor(e){if(this.url=e,this.events=new F3.EventEmitter,this.registering=!1,!Bp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Zc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Bp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Kt.isReactNative)()?void 0:{rejectUnauthorized:!Pv(e)},s=new tk(e,[],i);ek()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Xc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=Nv(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return _v(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>L3&&this.events.setMaxListeners(L3)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}},M3=Fp});var U3={};at(U3,{WsConnection:()=>Fp,default:()=>rk});var rk,q3=ge(()=>{c();Fv();Fv();rk=M3});var v6=v((Sl,Pu)=>{c();var nk=200,zv="__lodash_hash_undefined__",Qp=1,J3=2,X3=9007199254740991,Mp="[object Arguments]",Vv="[object Array]",ik="[object AsyncFunction]",Z3="[object Boolean]",e6="[object Date]",t6="[object Error]",r6="[object Function]",sk="[object GeneratorFunction]",Up="[object Map]",n6="[object Number]",ok="[object Null]",Ou="[object Object]",V3="[object Promise]",ak="[object Proxy]",i6="[object RegExp]",qp="[object Set]",s6="[object String]",uk="[object Symbol]",ck="[object Undefined]",Hv="[object WeakMap]",o6="[object ArrayBuffer]",Vp="[object DataView]",lk="[object Float32Array]",fk="[object Float64Array]",hk="[object Int8Array]",dk="[object Int16Array]",pk="[object Int32Array]",gk="[object Uint8Array]",yk="[object Uint8ClampedArray]",mk="[object Uint16Array]",wk="[object Uint32Array]",Ek=/[\\^$.*+?()[\]{}|]/g,vk=/^\[object .+?Constructor\]$/,Ak=/^(?:0|[1-9]\d*)$/,Ye={};Ye[lk]=Ye[fk]=Ye[hk]=Ye[dk]=Ye[pk]=Ye[gk]=Ye[yk]=Ye[mk]=Ye[wk]=!0;Ye[Mp]=Ye[Vv]=Ye[o6]=Ye[Z3]=Ye[Vp]=Ye[e6]=Ye[t6]=Ye[r6]=Ye[Up]=Ye[n6]=Ye[Ou]=Ye[i6]=Ye[qp]=Ye[s6]=Ye[Hv]=!1;var a6=typeof global=="object"&&global&&global.Object===Object&&global,_k=typeof self=="object"&&self&&self.Object===Object&&self,Xn=a6||_k||Function("return this")(),u6=typeof Sl=="object"&&Sl&&!Sl.nodeType&&Sl,H3=u6&&typeof Pu=="object"&&Pu&&!Pu.nodeType&&Pu,c6=H3&&H3.exports===u6,Mv=c6&&a6.process,j3=function(){try{return Mv&&Mv.binding&&Mv.binding("util")}catch{}}(),G3=j3&&j3.isTypedArray;function bk(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function Zk(t,e){var r=this.__data__,n=Kp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Zn.prototype.clear=$k;Zn.prototype.delete=Yk;Zn.prototype.get=Jk;Zn.prototype.has=Xk;Zn.prototype.set=Zk;function po(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,y=r&J3?new jp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=X3}function w6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function xl(t){return t!=null&&typeof t=="object"}var E6=G3?Tk(G3):yK;function DK(t){return xK(t)?hK(t):mK(t)}function OK(){return[]}function PK(){return!1}Pu.exports=NK});var _P=v(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});var yo=jn(),BK=hd(),RK=t2(),ig=m2(),tt=DE(),Ki=zE(),A6=(Td(),nt(I2)),LK=(WN(),nt(zN)),ee=_p(),FK=(X1(),nt(J1)),It=ro(),MK=(P3(),nt(O3)),Hr=(Il(),nt(Kt)),UK=(q3(),nt(U3)),qK=v6();function Pl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function VK(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var HK=Pl(yo),U6=Pl(BK),jK=Pl(RK),Wp=VK(LK),GK=Pl(UK),QK=Pl(qK);function kK(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,O=new Uint8Array(x);_!==B;){for(var P=E[_],L=0,b=x-1;(P!==0||L>>0,O[b]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=L,_++}for(var C=x-R;C!==x&&O[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(B);E[T];){var O=r[E.charCodeAt(T)];if(O===255)return;for(var P=0,L=B-1;(O!==0||P<_)&&L!==-1;L--,P++)O+=a*x[L]>>>0,x[L]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");_=P,T++}if(E[T]!==" "){for(var b=B-_;b!==B&&x[b]===0;)b++;for(var C=new Uint8Array(R+(B-b)),M=R;b!==B;)C[M++]=x[b++];return C}}}function w(E){var T=y(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var KK=kK,zK=KK,q6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},WK=t=>new TextEncoder().encode(t),$K=t=>new TextDecoder().decode(t),Yv=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Jv=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return V6(this,e)}},Xv=class{constructor(e){this.decoders=e}or(e){return V6(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},V6=(t,e)=>new Xv({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Zv=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Yv(e,r,n),this.decoder=new Jv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},sg=({name:t,prefix:e,encode:r,decode:n})=>new Zv(t,e,r,n),Bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=zK(r,e);return sg({prefix:t,name:e,encode:n,decode:s=>q6(i(s))})},YK=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},JK=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<sg({prefix:e,name:t,encode(i){return JK(i,n,r)},decode(i){return YK(i,n,r,t)}}),XK=sg({prefix:"\0",name:"identity",encode:t=>$K(t),decode:t=>WK(t)}),ZK=Object.freeze({__proto__:null,identity:XK}),ez=Mt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),tz=Object.freeze({__proto__:null,base2:ez}),rz=Mt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),nz=Object.freeze({__proto__:null,base8:rz}),iz=Bl({prefix:"9",name:"base10",alphabet:"0123456789"}),sz=Object.freeze({__proto__:null,base10:iz}),oz=Mt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),az=Mt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),uz=Object.freeze({__proto__:null,base16:oz,base16upper:az}),cz=Mt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lz=Mt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fz=Mt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hz=Mt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),dz=Mt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),pz=Mt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gz=Mt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),yz=Mt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mz=Mt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),wz=Object.freeze({__proto__:null,base32:cz,base32upper:lz,base32pad:fz,base32padupper:hz,base32hex:dz,base32hexupper:pz,base32hexpad:gz,base32hexpadupper:yz,base32z:mz}),Ez=Bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vz=Bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Az=Object.freeze({__proto__:null,base36:Ez,base36upper:vz}),_z=Bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bz=Bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Iz=Object.freeze({__proto__:null,base58btc:_z,base58flickr:bz}),Sz=Mt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Cz=Mt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tz=Mt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xz=Mt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Nz=Object.freeze({__proto__:null,base64:Sz,base64pad:Cz,base64url:Tz,base64urlpad:xz}),H6=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Dz=H6.reduce((t,e,r)=>(t[r]=e,t),[]),Oz=H6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Pz(t){return t.reduce((e,r)=>(e+=Dz[r],e),"")}function Bz(t){let e=[];for(let r of t){let n=Oz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Rz=sg({prefix:"\u{1F680}",name:"base256emoji",encode:Pz,decode:Bz}),Lz=Object.freeze({__proto__:null,base256emoji:Rz}),Fz=j6,_6=128,Mz=127,Uz=~Mz,qz=Math.pow(2,31);function j6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=qz;)e[r++]=t&255|_6,t/=128;for(;t&Uz;)e[r++]=t&255|_6,t>>>=7;return e[r]=t|0,j6.bytes=r-n+1,e}var Vz=eA,Hz=128,b6=127;function eA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw eA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&b6)<=Hz);return eA.bytes=s-n,r}var jz=Math.pow(2,7),Gz=Math.pow(2,14),Qz=Math.pow(2,21),kz=Math.pow(2,28),Kz=Math.pow(2,35),zz=Math.pow(2,42),Wz=Math.pow(2,49),$z=Math.pow(2,56),Yz=Math.pow(2,63),Jz=function(t){return t(G6.encode(t,e,r),e),S6=t=>G6.encodingLength(t),tA=(t,e)=>{let r=e.byteLength,n=S6(t),i=n+S6(r),s=new Uint8Array(i+r);return I6(t,s,0),I6(r,s,n),s.set(e,i),new rA(t,r,e,s)},rA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},Q6=({name:t,code:e,encode:r})=>new nA(t,e,r),nA=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?tA(this.code,r):r.then(n=>tA(this.code,n))}else throw Error("Unknown type, must be binary type")}},k6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Zz=Q6({name:"sha2-256",code:18,encode:k6("SHA-256")}),eW=Q6({name:"sha2-512",code:19,encode:k6("SHA-512")}),tW=Object.freeze({__proto__:null,sha256:Zz,sha512:eW}),K6=0,rW="identity",z6=q6,nW=t=>tA(K6,z6(t)),iW={code:K6,name:rW,encode:z6,digest:nW},sW=Object.freeze({__proto__:null,identity:iW});new TextEncoder,new TextDecoder;var C6={...ZK,...tz,...nz,...sz,...uz,...wz,...Az,...Iz,...Nz,...Lz};({...tW,...sW});function oW(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function W6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var T6=W6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Wv=W6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=oW(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Yp=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=X6,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=Wp.generateKeyPair(i);return Wp.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Wp.generateKeyPair(s),a=ee.generateRandomBytes32(),u=Z6;return await Wp.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=A6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let y=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(y,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return A6.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?FK.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.keychain=n||new $p(this.core,this.logger)}get context(){return tt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(iA)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(iA,e)}return uW(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Jp=class extends Ki.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=rP,this.version=nP,this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=tt.generateChildLogger(e,this.name),this.core=r}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sA=class extends Ki.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new yo.EventEmitter,this.name=sP,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||iP,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l}},d=ee.hashMessage(i);this.queue.set(d,f);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l),this.publishTimeout),this.relayer.events.emit(Ft.publish,f)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(Ft.connection_stalled);return}this.onPublish(d,f),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return tt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,u,l,f;let d={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return ee.isUndefined((a=d.params)==null?void 0:a.prompt)&&((u=d.params)==null||delete u.prompt),ee.isUndefined((l=d.params)==null?void 0:l.tag)&&((f=d.params)==null||delete f.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(ig.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},oA=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},dW=Object.defineProperty,pW=Object.defineProperties,gW=Object.getOwnPropertyDescriptors,x6=Object.getOwnPropertySymbols,yW=Object.prototype.hasOwnProperty,mW=Object.prototype.propertyIsEnumerable,N6=(t,e,r)=>e in t?dW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))yW.call(e,r)&&N6(t,r,e[r]);if(x6)for(var r of x6(e))mW.call(e,r)&&N6(t,r,e[r]);return t},$v=(t,e)=>pW(t,gW(e)),Xp=class extends Ki.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new oA,this.events=new yo.EventEmitter,this.name=dP,this.version=pP,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ei,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new It.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=gP&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.clientId=""}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,$v(Dl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Dl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,Dl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Vr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Vr.deleted,$v(Dl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vr.sync)}async reset(){if(!this.cached.length)return;let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>$v(Dl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(ig.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Ft.connect,async()=>{await this.onConnect()}),this.relayer.on(Ft.disconnect,()=>{this.onDisconnect()}),this.events.on(Vr.created,async e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Vr.deleted,async e=>{let r=Vr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},wW=Object.defineProperty,D6=Object.getOwnPropertySymbols,EW=Object.prototype.hasOwnProperty,vW=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?wW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AW=(t,e)=>{for(var r in e||(e={}))EW.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))vW.call(e,r)&&O6(t,r,e[r]);return t},Zp=class extends Ki.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new yo.EventEmitter,this.name=uP,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?tt.generateChildLogger(e.logger,this.name):U6.default(tt.getDefaultLoggerOptions({level:e.logger||aP})),this.messages=new Jp(this.logger,e.core),this.subscriber=new Xp(this,this.logger),this.publisher=new sA(this,this.logger),this.relayUrl=e?.relayUrl||uA,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return tt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Vr.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(Ft.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Vr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,"socket stalled").catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Ft.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Ft.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Ft.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(this.relayUrl=e||this.relayUrl,await this.transportClose(),await new Promise(r=>setTimeout(r,500)),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new MK.JsonRpcProvider(new GK.default(ee.formatRelayRpcUrl({sdkVersion:fP,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Hr.isJsonRpcRequest(e)){if(!e.method.endsWith(cP))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(AW({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ft.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Hr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(Ol.payload,e=>this.onProviderPayload(e)),this.provider.on(Ol.connect,()=>{this.events.emit(Ft.connect)}),this.provider.on(Ol.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(Ol.error,e=>{this.logger.error(e),this.events.emit(Ft.error,e)})}registerEventListeners(){this.events.on(Ft.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Ft.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},It.toMiliseconds(lP))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},_W=Object.defineProperty,P6=Object.getOwnPropertySymbols,bW=Object.prototype.hasOwnProperty,IW=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?_W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R6=(t,e)=>{for(var r in e||(e={}))bW.call(e,r)&&B6(t,r,e[r]);if(P6)for(var r of P6(e))IW.call(e,r)&&B6(t,r,e[r]);return t},eg=class extends Ki.IStore{constructor(e,r,n,i=ei,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=hP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>QK.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=R6(R6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=tt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},tg=class{constructor(e,r){this.core=e,this.logger=r,this.name=yP,this.version=mP,this.events=new HK.default,this.initialized=!1,this.storagePrefix=ei,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(It.FIVE_MINUTES),o={protocol:oP},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(It.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(It.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Hr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ru[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Hr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Hr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method]?Ru[u.request.method].res:Ru.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{Hr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):Hr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.pairings=new eg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return tt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ft.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);Hr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Hr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Tr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},rg=class extends Ki.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new yo.EventEmitter,this.name=wP,this.version=EP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(qr.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Hr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(qr.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(qr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:Hr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(qr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(qr.created,e=>{let r=qr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.updated,e=>{let r=qr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.deleted,e=>{let r=qr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ng=class extends Ki.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new yo.EventEmitter,this.name=vP,this.version=AP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Tr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Tr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Tr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;It.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Tr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ig.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Tr.created,e=>{let r=Tr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.expired,e=>{let r=Tr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.deleted,e=>{let r=Tr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},SW=Object.defineProperty,L6=Object.getOwnPropertySymbols,CW=Object.prototype.hasOwnProperty,TW=Object.prototype.propertyIsEnumerable,F6=(t,e,r)=>e in t?SW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M6=(t,e)=>{for(var r in e||(e={}))CW.call(e,r)&&F6(t,r,e[r]);if(L6)for(var r of L6(e))TW.call(e,r)&&F6(t,r,e[r]);return t},Lu=class extends Ki.ICore{constructor(e){super(e),this.protocol=aA,this.version=$6,this.name=og,this.events=new yo.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||uA;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:U6.default(tt.getDefaultLoggerOptions({level:e?.logger||Y6.logger}));this.logger=tt.generateChildLogger(r,this.name),this.heartbeat=new ig.HeartBeat,this.crypto=new Yp(this,this.logger,e?.keychain),this.history=new rg(this,this.logger),this.expirer=new ng(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new jK.default(M6(M6({},J6),e?.storageOptions)),this.relayer=new Zp({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new tg(this,this.logger)}static async init(e){let r=new Lu(e);return await r.initialize(),r}get context(){return tt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},xW=Lu;ve.CORE_CONTEXT=og,ve.CORE_DEFAULT=Y6,ve.CORE_PROTOCOL=aA,ve.CORE_STORAGE_OPTIONS=J6,ve.CORE_STORAGE_PREFIX=ei,ve.CORE_VERSION=$6,ve.CRYPTO_CLIENT_SEED=iA,ve.CRYPTO_CONTEXT=X6,ve.CRYPTO_JWT_TTL=Z6,ve.Core=xW,ve.Crypto=Yp,ve.EXPIRER_CONTEXT=vP,ve.EXPIRER_DEFAULT_TTL=hW,ve.EXPIRER_EVENTS=Tr,ve.EXPIRER_STORAGE_VERSION=AP,ve.Expirer=ng,ve.HISTORY_CONTEXT=wP,ve.HISTORY_EVENTS=qr,ve.HISTORY_STORAGE_VERSION=EP,ve.JsonRpcHistory=rg,ve.KEYCHAIN_CONTEXT=eP,ve.KEYCHAIN_STORAGE_VERSION=tP,ve.KeyChain=$p,ve.MESSAGES_CONTEXT=rP,ve.MESSAGES_STORAGE_VERSION=nP,ve.MessageTracker=Jp,ve.PAIRING_CONTEXT=yP,ve.PAIRING_DEFAULT_TTL=fW,ve.PAIRING_RPC_OPTS=Ru,ve.PAIRING_STORAGE_VERSION=mP,ve.PENDING_SUB_RESOLUTION_TIMEOUT=gP,ve.PUBLISHER_CONTEXT=sP,ve.PUBLISHER_DEFAULT_TTL=iP,ve.Pairing=tg,ve.RELAYER_CONTEXT=uP,ve.RELAYER_DEFAULT_LOGGER=aP,ve.RELAYER_DEFAULT_PROTOCOL=oP,ve.RELAYER_DEFAULT_RELAY_URL=uA,ve.RELAYER_EVENTS=Ft,ve.RELAYER_PROVIDER_EVENTS=Ol,ve.RELAYER_RECONNECT_TIMEOUT=lP,ve.RELAYER_SDK_VERSION=fP,ve.RELAYER_STORAGE_OPTIONS=cW,ve.RELAYER_SUBSCRIBER_SUFFIX=cP,ve.Relayer=Zp,ve.STORE_STORAGE_VERSION=hP,ve.SUBSCRIBER_CONTEXT=dP,ve.SUBSCRIBER_DEFAULT_TTL=lW,ve.SUBSCRIBER_EVENTS=Vr,ve.SUBSCRIBER_STORAGE_VERSION=pP,ve.Store=eg,ve.Subscriber=Xp,ve.default=Lu});var BP=v(it=>{"use strict";c();Object.defineProperty(it,"__esModule",{value:!0});var NW=hd(),zi=_P(),cA=DE(),SP=zE(),k=_p(),CP=jn(),st=ro(),St=(Il(),nt(Kt));function TP(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var DW=TP(NW),OW=TP(CP),gA="wc",yA=2,mA="client",cg=`${gA}@${yA}:${mA}:`,ag={name:mA,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},PW={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},BW={database:":memory:"},RW={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},LW="history",FW="0.3",xP="proposal",MW=st.THIRTY_DAYS,NP="Proposal expired",DP="session",Rl=st.SEVEN_DAYS,OP="engine",Fu={wc_sessionPropose:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1104},res:{ttl:st.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1106},res:{ttl:st.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1112},res:{ttl:st.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1115}}},ug={min:st.FIVE_MINUTES,max:st.SEVEN_DAYS},PP="request",UW=Object.defineProperty,qW=Object.defineProperties,VW=Object.getOwnPropertyDescriptors,bP=Object.getOwnPropertySymbols,HW=Object.prototype.hasOwnProperty,jW=Object.prototype.propertyIsEnumerable,IP=(t,e,r)=>e in t?UW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xr=(t,e)=>{for(var r in e||(e={}))HW.call(e,r)&&IP(t,r,e[r]);if(bP)for(var r of bP(e))jW.call(e,r)&&IP(t,r,e[r]);return t},lA=(t,e)=>qW(t,VW(e)),fA=class extends SP.IEngine{constructor(e){super(e),this.name=OP,this.events=new OW.default,this.initialized=!1,this.ignoredPayloadTypes=[k.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Fu)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=lA(xr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:x,uri:O}=await this.client.core.pairing.create();l=x,f=O}let y=await this.client.core.crypto.generateKeyPair(),w=xr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:zi.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:y,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:T,done:R}=k.createDelayedPromise(st.FIVE_MINUTES,NP);if(this.events.once(k.engineEvent("session_connect"),async({error:x,session:O})=>{if(x)E(x);else if(O){O.self.publicKey=y;let P=lA(xr({},O),{requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces});await this.client.session.set(O.topic,P),await this.setExpiry(O.topic,O.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:O.peer.metadata}),T(P)}}),!l){let{message:x}=k.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(x)}let _=await this.sendRequest(l,"wc_sessionPropose",w),B=k.calcExpiry(st.FIVE_MINUTES);return await this.setProposal(_,xr({id:_,expiry:B},w)),{uri:f,approval:R}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",k.isValidObject(f)||(f=k.getRequiredNamespacesFromNamespaces(s,"approve()"));let y=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(y,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:y}),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=xr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:y,metadata:this.client.metadata},expiry:k.calcExpiry(Rl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest(E,"wc_sessionSettle",T);let R=lA(xr({},T),{topic:E,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:y});return await this.client.session.set(E,R),await this.setExpiry(E,k.calcExpiry(Rl)),{topic:E,acknowledged:()=>new Promise(_=>_(this.client.session.get(E)))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,k.calcExpiry(Rl)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=k.createDelayedPromise(o);return this.events.once(k.engineEvent("session_request",a),({error:d,result:y})=>{d?f(d):l(y)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;St.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):St.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();this.events.once(k.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",k.getSdkError("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>k.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,k.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Fu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,k.calcExpiry(n))},this.sendRequest=async(r,n,i,s)=>{let o=St.formatJsonRpcRequest(n,i),a=await this.client.core.crypto.encode(r,o),u=Fu[n].req;return s&&(u.ttl=s),this.client.core.history.set(r,o),this.client.core.relayer.publish(r,a,u),o.id},this.sendResult=async(r,n,i)=>{let s=St.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=St.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{k.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{k.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(xr({},n.params));let o=k.calcExpiry(st.FIVE_MINUTES),a=xr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(St.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else St.isJsonRpcError(n)&&(await this.client.proposal.delete(i,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:y,pairingTopic:w}=n.params,E=xr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},y&&{sessionProperties:y});await this.sendResult(n.id,r,!0),this.events.emit(k.engineEvent("session_connect"),{session:E})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(k.engineEvent("session_approve",i),{})):St.isJsonRpcError(n)&&(await this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(xr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_update",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,k.calcExpiry(Rl)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_extend",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_ping",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),this.client.core.relayer.once(zi.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(r)}),await this.sendResult(i,r,!0),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(xr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_request",i),{result:n.result}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(xr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(k.isUndefined(n)||await this.isValidPairingTopic(n),!k.isValidRelays(a,!0)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!k.isUndefined(i)&&k.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!k.isUndefined(s)&&k.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=k.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!k.isValidParams(r))throw new Error(k.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=k.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=k.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!k.isValidString(s,!0)){let{message:f}=k.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!k.isValidErrorReason(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!k.isValidParams(r)){let{message:l}=k.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!k.isValidRelay(n)){let{message:l}=k.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=k.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=k.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(k.isExpired(o)){let{message:l}=k.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=k.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=k.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!k.isValidNamespacesChainId(a,s)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!k.isValidRequest(i)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!k.isValidNamespacesRequest(a,s,i.method)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!k.isValidRequestExpiry(o,ug)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ug.min} and ${ug.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!k.isValidResponse(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!k.isValidParams(r)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!k.isValidNamespacesChainId(o,s)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!k.isValidEvent(i)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!k.isValidNamespacesEvent(o,s,i.name)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!k.isValidString(i,!1)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=k.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(zi.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);St.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):St.isJsonRpcResponse(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(zi.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=k.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,k.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=k.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=k.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(k.isValidString(e,!1)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!k.isValidId(e)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=k.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},hA=class extends zi.Store{constructor(e,r){super(e,r,xP,cg),this.core=e,this.logger=r}},dA=class extends zi.Store{constructor(e,r){super(e,r,DP,cg),this.core=e,this.logger=r}},pA=class extends zi.Store{constructor(e,r){super(e,r,PP,cg,n=>n.id),this.core=e,this.logger=r}},Mu=class extends SP.ISignClient{constructor(e){super(e),this.protocol=gA,this.version=yA,this.name=ag.name,this.events=new CP.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||ag.name,this.metadata=e?.metadata||k.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:DW.default(cA.getDefaultLoggerOptions({level:e?.logger||ag.logger}));this.core=e?.core||new zi.Core(e),this.logger=cA.generateChildLogger(r,this.name),this.session=new dA(this.core,this.logger),this.proposal=new hA(this.core,this.logger),this.pendingRequest=new pA(this.core,this.logger),this.engine=new fA(this)}static async init(e){let r=new Mu(e);return await r.initialize(),r}get context(){return cA.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},GW=Mu;it.ENGINE_CONTEXT=OP,it.ENGINE_RPC_OPTS=Fu,it.HISTORY_CONTEXT=LW,it.HISTORY_EVENTS=RW,it.HISTORY_STORAGE_VERSION=FW,it.PROPOSAL_CONTEXT=xP,it.PROPOSAL_EXPIRY=MW,it.PROPOSAL_EXPIRY_MESSAGE=NP,it.REQUEST_CONTEXT=PP,it.SESSION_CONTEXT=DP,it.SESSION_EXPIRY=Rl,it.SESSION_REQUEST_EXPIRY_BOUNDARIES=ug,it.SIGN_CLIENT_CONTEXT=mA,it.SIGN_CLIENT_DEFAULT=ag,it.SIGN_CLIENT_EVENTS=PW,it.SIGN_CLIENT_PROTOCOL=gA,it.SIGN_CLIENT_STORAGE_OPTIONS=BW,it.SIGN_CLIENT_STORAGE_PREFIX=cg,it.SIGN_CLIENT_VERSION=yA,it.SignClient=GW,it.default=Mu});var wA=v(Ll=>{"use strict";c();Object.defineProperty(Ll,"__esModule",{value:!0});Ll.Operation=void 0;var QW;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage",t.SIGN_LOGIN_TOKEN="mvx_signLoginToken"})(QW=Ll.Operation||(Ll.Operation={}))});var RP=v(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.WALLETCONNECT_MULTIVERSX_METHODS=Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;var kW=wA();Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Wi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(kW.Operation)});var LP=v(lg=>{"use strict";c();Object.defineProperty(lg,"__esModule",{value:!0});lg.Logger=void 0;var EA=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};lg.Logger=EA});var FP=v(Uu=>{"use strict";c();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.Signature=Uu.Address=void 0;var vA=class{constructor(e){this.value=e}bech32(){return this.value}};Uu.Address=vA;var Fl=class{constructor(e){this.buffer=e}static fromHex(e){return new Fl(h.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Uu.Signature=Fl});var bA=v(jr=>{"use strict";c();Object.defineProperty(jr,"__esModule",{value:!0});jr.WalletConnectV2ProviderErrorMessagesEnum=jr.ErrBadAddress=jr.ErrNotImplemented=jr.Err=void 0;var Ml=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};jr.Err=Ml;var AA=class extends Ml{constructor(){super("Method not yet implemented")}};jr.ErrNotImplemented=AA;var _A=class extends Ml{constructor(e,r){super(`Bad address: ${e}`,r)}};jr.ErrBadAddress=_A;var KW;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection"})(KW=jr.WalletConnectV2ProviderErrorMessagesEnum||(jr.WalletConnectV2ProviderErrorMessagesEnum={}))});var UP=v(bn=>{"use strict";c();var zW=bn&&bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WW=bn&&bn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$W=bn&&bn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zW(e,t,r);return WW(e,t),e};Object.defineProperty(bn,"__esModule",{value:!0});bn.UserAddress=void 0;var YW=$W(Cf()),MP=bA(),JW="erd",Ul=class{constructor(e){this.value=e}static fromBech32(e){let r;try{r=YW.decode(e)}catch(n){throw new MP.ErrBadAddress(e,n)}if(r.prefix!=JW)throw new MP.ErrBadAddress(e);return new Ul(e)}bech32(){return this.value}};bn.UserAddress=Ul});var Vl=v(In=>{"use strict";c();var gt=In&&In.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},XW=In&&In.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(In,"__esModule",{value:!0});In.WalletConnectV2Provider=In.WalletConnectV2ProviderErrorMessagesEnum=void 0;var ZW=XW(BP()),IA=_p(),mo=RP(),fg=wA(),Re=LP(),ql=FP(),he=bA();Object.defineProperty(In,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return he.WalletConnectV2ProviderErrorMessagesEnum}});var hg=UP(),SA=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.namespace=mo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.namespace=mo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.session=void 0}init(){return gt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let e=yield ZW.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,this.isInitializing=!1,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let o=this.getConnectionParams(e);try{let a=yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},o));return this.events=(n=(r=o?.requiredNamespaces)===null||r===void 0?void 0:r[mo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||n===void 0?void 0:n.events,this.methods=(s=(i=o?.requiredNamespaces)===null||i===void 0?void 0:i[mo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||s===void 0?void 0:s.methods,a}catch{throw this.reset(),Re.Logger.error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return gt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=this.getAddressFromSession(n),{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:fg.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!s)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:s})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||this.getCurrentTopic(this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:IA.getSdkError("USER_DISCONNECTED")});else{let r=this.getCurrentTopic(this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:IA.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:fg.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new ql.Signature(n),hg.UserAddress.fromBech32(r))}catch{throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.toPlainObject(n);if(this.chainId!==e.getChainID().valueOf())throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:fg.Operation.SIGN_TRANSACTION,params:{transaction:i}}});if(!s)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(ql.Signature.fromHex(s),hg.UserAddress.fromBech32(r)),e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(n)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:fg.Operation.SIGN_TRANSACTIONS,params:{transactions:i}}});(!s||!Array.isArray(s))&&Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(ql.Signature.fromHex(s[o].signature),hg.UserAddress.fromBech32(r));return e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});if(!s)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=this.getCurrentTopic(this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return gt(this,void 0,void 0,function*(){return e?this.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Re.Logger.error(`${he.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return gt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=this.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=this.getCurrentSession(e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return gt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!IA.isValidArray(f))return;for(let d of f)e.deletePairings?(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0):yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}getCurrentSession(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(this.getConnectionParams()).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}else if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}else throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=this.getCurrentSession(e);if(r?.topic)return r.topic;throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getConnectionParams(e){var r,n;let i=[...mo.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]],s=[`${mo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=(n=e?.events)!==null&&n!==void 0?n:[];return{requiredNamespaces:{[mo.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:o}}}}addressIsValid(e){try{return!!hg.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let r=e.namespaces[this.namespace];if(r&&r.accounts){let n=r.accounts[0],[i,s,o]=n.split(":");return o}return""}};In.WalletConnectV2Provider=SA});var VP=v((kce,qP)=>{"use strict";c();qP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var GP=v((zce,jP)=>{"use strict";c();var HP=typeof Symbol<"u"&&Symbol,e$=VP();jP.exports=function(){return typeof HP!="function"||typeof Symbol!="function"||typeof HP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e$()}});var kP=v(($ce,QP)=>{"use strict";c();var t$="Function.prototype.bind called on incompatible ",CA=Array.prototype.slice,r$=Object.prototype.toString,n$="[object Function]";QP.exports=function(e){var r=this;if(typeof r!="function"||r$.call(r)!==n$)throw new TypeError(t$+r);for(var n=CA.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(CA.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(CA.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var i$=kP();KP.exports=Function.prototype.bind||i$});var WP=v((Zce,zP)=>{"use strict";c();var s$=dg();zP.exports=s$.call(Function.call,Object.prototype.hasOwnProperty)});var yg=v((tle,ZP)=>{"use strict";c();var Oe,ju=SyntaxError,XP=Function,Hu=TypeError,TA=function(t){try{return XP('"use strict"; return ('+t+").constructor;")()}catch{}},wo=Object.getOwnPropertyDescriptor;if(wo)try{wo({},"")}catch{wo=null}var xA=function(){throw new Hu},o$=wo?function(){try{return arguments.callee,xA}catch{try{return wo(arguments,"callee").get}catch{return xA}}}():xA,qu=GP()(),Sn=Object.getPrototypeOf||function(t){return t.__proto__},Vu={},a$=typeof Uint8Array>"u"?Oe:Sn(Uint8Array),Eo={"%AggregateError%":typeof AggregateError>"u"?Oe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Oe:ArrayBuffer,"%ArrayIteratorPrototype%":qu?Sn([][Symbol.iterator]()):Oe,"%AsyncFromSyncIteratorPrototype%":Oe,"%AsyncFunction%":Vu,"%AsyncGenerator%":Vu,"%AsyncGeneratorFunction%":Vu,"%AsyncIteratorPrototype%":Vu,"%Atomics%":typeof Atomics>"u"?Oe:Atomics,"%BigInt%":typeof BigInt>"u"?Oe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Oe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Oe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Oe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Oe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Oe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Oe:FinalizationRegistry,"%Function%":XP,"%GeneratorFunction%":Vu,"%Int8Array%":typeof Int8Array>"u"?Oe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Oe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Oe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qu?Sn(Sn([][Symbol.iterator]())):Oe,"%JSON%":typeof JSON=="object"?JSON:Oe,"%Map%":typeof Map>"u"?Oe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!qu?Oe:Sn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Oe:Promise,"%Proxy%":typeof Proxy>"u"?Oe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Oe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Oe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!qu?Oe:Sn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Oe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qu?Sn(""[Symbol.iterator]()):Oe,"%Symbol%":qu?Symbol:Oe,"%SyntaxError%":ju,"%ThrowTypeError%":o$,"%TypedArray%":a$,"%TypeError%":Hu,"%Uint8Array%":typeof Uint8Array>"u"?Oe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Oe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Oe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Oe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Oe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Oe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Oe:WeakSet};try{null.error}catch(t){$P=Sn(Sn(t)),Eo["%Error.prototype%"]=$P}var $P,u$=function t(e){var r;if(e==="%AsyncFunction%")r=TA("async function () {}");else if(e==="%GeneratorFunction%")r=TA("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=TA("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&(r=Sn(i.prototype))}return Eo[e]=r,r},YP={"%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"]},Hl=dg(),pg=WP(),c$=Hl.call(Function.call,Array.prototype.concat),l$=Hl.call(Function.apply,Array.prototype.splice),JP=Hl.call(Function.call,String.prototype.replace),gg=Hl.call(Function.call,String.prototype.slice),f$=Hl.call(Function.call,RegExp.prototype.exec),h$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,d$=/\\(\\)?/g,p$=function(e){var r=gg(e,0,1),n=gg(e,-1);if(r==="%"&&n!=="%")throw new ju("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new ju("invalid intrinsic syntax, expected opening `%`");var i=[];return JP(e,h$,function(s,o,a,u){i[i.length]=a?JP(u,d$,"$1"):o||s}),i},g$=function(e,r){var n=e,i;if(pg(YP,n)&&(i=YP[n],n="%"+i[0]+"%"),pg(Eo,n)){var s=Eo[n];if(s===Vu&&(s=u$(n)),typeof s>"u"&&!r)throw new Hu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new ju("intrinsic "+e+" does not exist!")};ZP.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Hu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Hu('"allowMissing" argument must be a boolean');if(f$(/^%?[^%]*%?$/,e)===null)throw new ju("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=p$(e),i=n.length>0?n[0]:"",s=g$("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],l$(n,c$([0,1],l)));for(var f=1,d=!0;f=n.length){var T=wo(a,y);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[y]}else d=pg(a,y),a=a[y];d&&!u&&(Eo[o]=a)}}return a}});var s8=v((nle,mg)=>{"use strict";c();var NA=dg(),Gu=yg(),r8=Gu("%Function.prototype.apply%"),n8=Gu("%Function.prototype.call%"),i8=Gu("%Reflect.apply%",!0)||NA.call(n8,r8),e8=Gu("%Object.getOwnPropertyDescriptor%",!0),vo=Gu("%Object.defineProperty%",!0),y$=Gu("%Math.max%");if(vo)try{vo({},"a",{value:1})}catch{vo=null}mg.exports=function(e){var r=i8(NA,n8,arguments);if(e8&&vo){var n=e8(r,"length");n.configurable&&vo(r,"length",{value:1+y$(0,e.length-(arguments.length-1))})}return r};var t8=function(){return i8(NA,r8,arguments)};vo?vo(mg.exports,"apply",{value:t8}):mg.exports.apply=t8});var c8=v((sle,u8)=>{"use strict";c();var o8=yg(),a8=s8(),m$=a8(o8("String.prototype.indexOf"));u8.exports=function(e,r){var n=o8(e,!!r);return typeof n=="function"&&m$(e,".prototype.")>-1?a8(n):n}});var l8=v(()=>{c()});var D8=v((lle,N8)=>{c();var qA=typeof Map=="function"&&Map.prototype,DA=Object.getOwnPropertyDescriptor&&qA?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Eg=qA&&DA&&typeof DA.get=="function"?DA.get:null,f8=qA&&Map.prototype.forEach,VA=typeof Set=="function"&&Set.prototype,OA=Object.getOwnPropertyDescriptor&&VA?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,vg=VA&&OA&&typeof OA.get=="function"?OA.get:null,h8=VA&&Set.prototype.forEach,w$=typeof WeakMap=="function"&&WeakMap.prototype,Gl=w$?WeakMap.prototype.has:null,E$=typeof WeakSet=="function"&&WeakSet.prototype,Ql=E$?WeakSet.prototype.has:null,v$=typeof WeakRef=="function"&&WeakRef.prototype,d8=v$?WeakRef.prototype.deref:null,A$=Boolean.prototype.valueOf,_$=Object.prototype.toString,b$=Function.prototype.toString,I$=String.prototype.match,HA=String.prototype.slice,Yi=String.prototype.replace,S$=String.prototype.toUpperCase,p8=String.prototype.toLowerCase,b8=RegExp.prototype.test,g8=Array.prototype.concat,Cn=Array.prototype.join,C$=Array.prototype.slice,y8=Math.floor,RA=typeof BigInt=="function"?BigInt.prototype.valueOf:null,PA=Object.getOwnPropertySymbols,LA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",zt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qu||"symbol")?Symbol.toStringTag:null,I8=Object.prototype.propertyIsEnumerable,m8=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function w8(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||b8.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-y8(-t):y8(t);if(n!==t){var i=String(n),s=HA.call(e,i.length+1);return Yi.call(i,r,"$&_")+"."+Yi.call(Yi.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yi.call(e,r,"$&_")}var FA=l8(),E8=FA.custom,v8=C8(E8)?E8:null;N8.exports=function t(e,r,n,i){var s=r||{};if($i(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if($i(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=$i(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if($i(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if($i(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return x8(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?w8(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?w8(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return MA(e)?"[Array]":"[Object]";var d=Q$(s,n);if(typeof i>"u")i=[];else if(T8(i,e)>=0)return"[Circular]";function y(G,$,de){if($&&(i=C$.call(i),i.push($)),de){var ae={depth:s.depth};return $i(s,"quoteStyle")&&(ae.quoteStyle=s.quoteStyle),t(G,ae,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!A8(e)){var w=L$(e),E=wg(e,y);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Cn.call(E,", ")+" }":"")}if(C8(e)){var T=Qu?Yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):LA.call(e);return typeof e=="object"&&!Qu?jl(T):T}if(H$(e)){for(var R="<"+p8.call(String(e.nodeName)),_=e.attributes||[],B=0;B<_.length;B++)R+=" "+_[B].name+"="+S8(T$(_[B].value),"double",s);return R+=">",e.childNodes&&e.childNodes.length&&(R+="..."),R+="",R}if(MA(e)){if(e.length===0)return"[]";var x=wg(e,y);return d&&!G$(x)?"["+UA(x,d)+"]":"[ "+Cn.call(x,", ")+" ]"}if(N$(e)){var O=wg(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!I8.call(e,"cause")?"{ ["+String(e)+"] "+Cn.call(g8.call("[cause]: "+y(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Cn.call(O,", ")+" }"}if(typeof e=="object"&&o){if(v8&&typeof e[v8]=="function"&&FA)return FA(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(F$(e)){var P=[];return f8&&f8.call(e,function(G,$){P.push(y($,e,!0)+" => "+y(G,e))}),_8("Map",Eg.call(e),P,d)}if(q$(e)){var L=[];return h8&&h8.call(e,function(G){L.push(y(G,e))}),_8("Set",vg.call(e),L,d)}if(M$(e))return BA("WeakMap");if(V$(e))return BA("WeakSet");if(U$(e))return BA("WeakRef");if(O$(e))return jl(y(Number(e)));if(B$(e))return jl(y(RA.call(e)));if(P$(e))return jl(A$.call(e));if(D$(e))return jl(y(String(e)));if(!x$(e)&&!A8(e)){var b=wg(e,y),C=m8?m8(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",Z=!C&&zt&&Object(e)===e&&zt in e?HA.call(Ji(e),8,-1):M?"Object":"",K=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=K+(Z||M?"["+Cn.call(g8.call([],Z||[],M||[]),": ")+"] ":"");return b.length===0?j+"{}":d?j+"{"+UA(b,d)+"}":j+"{ "+Cn.call(b,", ")+" }"}return String(e)};function S8(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function T$(t){return Yi.call(String(t),/"/g,""")}function MA(t){return Ji(t)==="[object Array]"&&(!zt||!(typeof t=="object"&&zt in t))}function x$(t){return Ji(t)==="[object Date]"&&(!zt||!(typeof t=="object"&&zt in t))}function A8(t){return Ji(t)==="[object RegExp]"&&(!zt||!(typeof t=="object"&&zt in t))}function N$(t){return Ji(t)==="[object Error]"&&(!zt||!(typeof t=="object"&&zt in t))}function D$(t){return Ji(t)==="[object String]"&&(!zt||!(typeof t=="object"&&zt in t))}function O$(t){return Ji(t)==="[object Number]"&&(!zt||!(typeof t=="object"&&zt in t))}function P$(t){return Ji(t)==="[object Boolean]"&&(!zt||!(typeof t=="object"&&zt in t))}function C8(t){if(Qu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!LA)return!1;try{return LA.call(t),!0}catch{}return!1}function B$(t){if(!t||typeof t!="object"||!RA)return!1;try{return RA.call(t),!0}catch{}return!1}var R$=Object.prototype.hasOwnProperty||function(t){return t in this};function $i(t,e){return R$.call(t,e)}function Ji(t){return _$.call(t)}function L$(t){if(t.name)return t.name;var e=I$.call(b$.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function T8(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return x8(HA.call(t,0,e.maxStringLength),e)+n}var i=Yi.call(Yi.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,j$);return S8(i,"single",e)}function j$(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+S$.call(e.toString(16))}function jl(t){return"Object("+t+")"}function BA(t){return t+" { ? }"}function _8(t,e,r,n){var i=n?UA(r,n):Cn.call(r,", ");return t+" ("+e+") {"+i+"}"}function G$(t){for(var e=0;e=0)return!1;return!0}function Q$(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Cn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Cn.call(Array(e+1),r)}}function UA(t,e){if(t.length===0)return"";var r=` `+e.prev+e.base;return r+Cn.call(t,","+r)+` -`+e.prev}function vg(t,e){var r=qA(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var QA=wg(),ku=f8(),$$=P8(),Y$=QA("%TypeError%"),bg=QA("%WeakMap%",!0),Ig=QA("%Map%",!0),J$=ku("WeakMap.prototype.get",!0),X$=ku("WeakMap.prototype.set",!0),Z$=ku("WeakMap.prototype.has",!0),eY=ku("Map.prototype.get",!0),tY=ku("Map.prototype.set",!0),rY=ku("Map.prototype.has",!0),kA=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},nY=function(t,e){var r=kA(t,e);return r&&r.value},iY=function(t,e,r){var n=kA(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},sY=function(t,e){return!!kA(t,e)};B8.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Y$("Side channel does not contain "+$$(s))},get:function(s){if(bg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return J$(e,s)}else if(Ig){if(r)return eY(r,s)}else if(n)return nY(n,s)},has:function(s){if(bg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Z$(e,s)}else if(Ig){if(r)return rY(r,s)}else if(n)return sY(n,s);return!1},set:function(s,o){bg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new bg),X$(e,s,o)):Ig?(r||(r=new Ig),tY(r,s,o)):(n||(n={key:{},next:null}),iY(n,s,o))}};return i}});var Sg=v((wle,L8)=>{"use strict";c();var oY=String.prototype.replace,aY=/%20/g,KA={RFC1738:"RFC1738",RFC3986:"RFC3986"};L8.exports={default:KA.RFC3986,formatters:{RFC1738:function(t){return oY.call(t,aY,"+")},RFC3986:function(t){return String(t)}},RFC1738:KA.RFC1738,RFC3986:KA.RFC3986}});var WA=v((vle,M8)=>{"use strict";c();var uY=Sg(),zA=Object.prototype.hasOwnProperty,vo=Array.isArray,Tn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),cY=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(vo(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===uY.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Tn[l];continue}if(l<2048){a=a+(Tn[192|l>>6]+Tn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Tn[224|l>>12]+Tn[128|l>>6&63]+Tn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Tn[240|l>>18]+Tn[128|l>>12&63]+Tn[128|l>>6&63]+Tn[128|l&63]}return a},pY=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var V8=R8(),YA=WA(),kl=Sg(),EY=Object.prototype.hasOwnProperty,U8={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ao=Array.isArray,vY=String.prototype.split,AY=Array.prototype.push,j8=function(t,e){AY.apply(t,Ao(e)?e:[e])},_Y=Date.prototype.toISOString,q8=kl.default,Ut={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:YA.encode,encodeValuesOnly:!1,format:q8,formatter:kl.formatters[q8],indices:!1,serializeDate:function(e){return _Y.call(e)},skipNulls:!1,strictNullHandling:!1},bY=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},$A={},IY=function t(e,r,n,i,s,o,a,u,l,f,d,y,w,E,N){for(var R=e,M=N,x=0,b=!1;(M=M.get($A))!==void 0&&!b;){var T=M.get(e);if(x+=1,typeof T<"u"){if(T===x)throw new RangeError("Cyclic object value");b=!0}typeof M.get($A)>"u"&&(x=0)}if(typeof a=="function"?R=a(r,R):R instanceof Date?R=f(R):n==="comma"&&Ao(R)&&(R=YA.maybeMap(R,function(re){return re instanceof Date?f(re):re})),R===null){if(i)return o&&!w?o(r,Ut.encoder,E,"key",d):r;R=""}if(bY(R)||YA.isBuffer(R)){if(o){var P=w?r:o(r,Ut.encoder,E,"key",d);if(n==="comma"&&w){for(var B=vY.call(String(R),","),_="",S=0;S"u")return F;var Z;if(n==="comma"&&Ao(R))Z=[{value:R.length>0?R.join(",")||null:void 0}];else if(Ao(a))Z=a;else{var K=Object.keys(R);Z=u?K.sort(u):K}for(var H=0;H"u"?Ut.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,delimiter:typeof e.delimiter>"u"?Ut.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Ut.encode,encoder:typeof e.encoder=="function"?e.encoder:Ut.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Ut.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Ut.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Ut.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};H8.exports=function(t,e){var r=t,n=SY(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Ao(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in U8?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=U8[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=V8(),f=0;f0?w+y:""}});var K8=v((Ile,k8)=>{"use strict";c();var Ku=WA(),JA=Object.prototype.hasOwnProperty,CY=Array.isArray,Pt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ku.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},TY=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Q8=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},xY="utf8=%26%2310003%3B",NY="utf8=%E2%9C%93",DY=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=CY(E)?[E]:E),JA.call(n,w)?n[w]=Ku.combine(n[w],E):n[w]=E}return n},OY=function(t,e,r,n){for(var i=n?e:Q8(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},PY=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&JA.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Pt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Pt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Pt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Pt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Pt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Pt.comma,decoder:typeof e.decoder=="function"?e.decoder:Pt.decoder,delimiter:typeof e.delimiter=="string"||Ku.isRegExp(e.delimiter)?e.delimiter:Pt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Pt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Pt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Pt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Pt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}};k8.exports=function(t,e){var r=BY(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?DY(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var RY=G8(),LY=K8(),FY=Sg();z8.exports={formats:FY,parse:LY,stringify:RY}});var XA=v(lt=>{"use strict";c();Object.defineProperty(lt,"__esModule",{value:!0});lt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=lt.WALLET_PROVIDER_CALLBACK_PARAM=lt.WALLET_PROVIDER_SIGN_MESSAGE_URL=lt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=lt.WALLET_PROVIDER_SEND_TRANSACTION_URL=lt.WALLET_PROVIDER_DISCONNECT_URL=lt.WALLET_PROVIDER_CONNECT_URL=lt.WALLET_PROVIDER_TESTNET=lt.WALLET_PROVIDER_DEVNET=lt.WALLET_PROVIDER_MAINNET=void 0;lt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";lt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";lt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";lt.WALLET_PROVIDER_CONNECT_URL="hook/login";lt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";lt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";lt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";lt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";lt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";lt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var $8=v(zu=>{"use strict";c();Object.defineProperty(zu,"__esModule",{value:!0});zu.ErrCannotSignedMessage=zu.ErrCannotGetSignedTransactions=void 0;var ZA=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};zu.ErrCannotGetSignedTransactions=ZA;var e_=class extends Error{constructor(){super("Cannot get signed message")}};zu.ErrCannotSignedMessage=e_});var Y8=v(Cg=>{"use strict";c();Object.defineProperty(Cg,"__esModule",{value:!0});Cg.PlainSignedTransaction=void 0;var t_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Cg.PlainSignedTransaction=t_});var Kl=v(Xi=>{"use strict";c();var _o=Xi&&Xi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},MY=Xi&&Xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xi,"__esModule",{value:!0});Xi.WalletProvider=void 0;var r_=MY(W8()),bo=XA(),n_=$8(),UY=Y8(),Wu=class{constructor(e){this.walletUrl=e}login(e){return _o(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return _o(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return _o(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return _o(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return _o(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=r_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new n_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}signTransactions(e,r){return _o(this,void 0,void 0,function*(){let n={};e.map(s=>{let o=Wu.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!n.hasOwnProperty(a)&&(n[a]=[]),n[a].push(o[a])});let i=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:r?.callbackUrl,params:n});window.location.href=i})}signTransaction(e,r){return _o(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=r_.default.parse(window.location.search.slice(1));return Wu.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(bo.WALLET_PROVIDER_CALLBACK_PARAM)&&e[bo.WALLET_PROVIDER_CALLBACK_PARAM]===bo.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new n_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new n_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{"use strict";c();Object.defineProperty(Ng,"__esModule",{value:!0});Ng.TransactionStatus=void 0;var zl=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new zl("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};Ng.TransactionStatus=zl});var Ju=v(Rt=>{"use strict";c();var qY=Rt&&Rt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VY=Rt&&Rt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jY=Rt&&Rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qY(e,t,r);return VY(e,t),e};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.zeroPadStringIfOddLength=Rt.isPaddedHex=Rt.numberToPaddedHex=Rt.Nonce=Rt.Address=void 0;var rB=jY(Tf()),HY="erd",Wl=class{constructor(e){this.value=e}static fromPubkey(e){let r=rB.toWords(e),n=rB.encode(HY,r);return new Wl(n)}bech32(){return this.value}toString(){return this.bech32()}};Rt.Address=Wl;var i_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return nB(this.value)}};Rt.Nonce=i_;function nB(t){let e=t.toString(16);return iB(e)}Rt.numberToPaddedHex=nB;function GY(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Rt.isPaddedHex=GY;function iB(t){return t=t||"",t.length%2==1?"0"+t:t}Rt.zeroPadStringIfOddLength=iB});var oB=v(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.TransactionReceipt=void 0;var sB=Ju(),$l=class{constructor(){this.value="",this.sender=new sB.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new $l;return r.value=(e.value||0).toString(),r.sender=new sB.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Dg.TransactionReceipt=$l});var aB=v(xn=>{"use strict";c();Object.defineProperty(xn,"__esModule",{value:!0});xn.ErrContractQuery=xn.ErrNetworkProvider=xn.ErrUnexpectedCondition=xn.Err=void 0;var Xu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};xn.Err=Xu;var s_=class extends Xu{constructor(e){super(`Unexpected condition: [${e}]`)}};xn.ErrUnexpectedCondition=s_;var o_=class extends Xu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};xn.ErrNetworkProvider=o_;var a_=class extends Xu{constructor(e){super(e.message.replace("executeQuery:",""))}};xn.ErrContractQuery=a_});var cB=v(Zu=>{"use strict";c();Object.defineProperty(Zu,"__esModule",{value:!0});Zu.TransactionEventTopic=Zu.TransactionEvent=void 0;var uB=Ju(),Yl=class{constructor(e){this.address=new uB.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new Yl;return r.address=new uB.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Og(n)),r.data=h.Buffer.from(e.data||"","base64").toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Zu.TransactionEvent=Yl;var Og=class{constructor(e){this.raw=h.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Zu.TransactionEventTopic=Og});var u_=v(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.TransactionLogs=void 0;var QY=aB(),lB=Ju(),kY=cB(),Jl=class{constructor(e){this.address=new lB.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new Jl;return r.address=new lB.Address(e.address),r.events=(e.events||[]).map(n=>kY.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new QY.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};Pg.TransactionLogs=Jl});var hB=v(tc=>{"use strict";c();Object.defineProperty(tc,"__esModule",{value:!0});tc.ContractResultItem=tc.ContractResults=void 0;var fB=u_(),Bg=Ju(),ec=class{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>ti.fromProxyHttpResponse(n));return new ec(r)}static fromApiHttpResponse(e){let r=e.map(n=>ti.fromApiHttpResponse(n));return new ec(r)}};tc.ContractResults=ec;var ti=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Bg.Address(""),this.sender=new Bg.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new fB.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ti.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=ti.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new ti;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Bg.Address(e.receiver),r.sender=new Bg.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=fB.TransactionLogs.fromHttpResponse(e.logs||{}),r}};tc.ContractResultItem=ti});var dB=v(es=>{"use strict";c();var KY=es&&es.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(es,"__esModule",{value:!0});es.EsdtContractAddress=es.MaxUint64AsBigNumber=void 0;var zY=KY(Wt()),WY=Ju();es.MaxUint64AsBigNumber=new zY.default("18446744073709551615");es.EsdtContractAddress=new WY.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var pB=v(rc=>{"use strict";c();var $Y=rc&&rc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rc,"__esModule",{value:!0});rc.ContractQueryResponse=void 0;var YY=$Y(Wt()),JY=dB(),Xl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new YY.default(e.gasRemaining||e.GasRemaining||0),o=JY.MaxUint64AsBigNumber.minus(s).toNumber();return new Xl({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>h.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};rc.ContractQueryResponse=Xl});var gB=v(Rg=>{"use strict";c();Object.defineProperty(Rg,"__esModule",{value:!0});Rg.ContractQueryRequest=void 0;var c_=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Rg.ContractQueryRequest=c_});var CB=v(($fe,SB)=>{c();SB.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ts=v(Co=>{c();var l_,XY=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Co.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Co.getSymbolTotalCodewords=function(e){return XY[e]};Co.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Co.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');l_=e};Co.isKanjiModeEnabled=function(){return typeof l_<"u"};Co.toSJIS=function(e){return l_(e)}});var Mg=v(Nr=>{c();Nr.L={bit:1};Nr.M={bit:0};Nr.Q={bit:3};Nr.H={bit:2};function ZY(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Nr.L;case"m":case"medium":return Nr.M;case"q":case"quartile":return Nr.Q;case"h":case"high":return Nr.H;default:throw new Error("Unknown EC Level: "+t)}}Nr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Nr.from=function(e,r){if(Nr.isValid(e))return e;try{return ZY(e)}catch{return r}}});var NB=v((the,xB)=>{c();function TB(){this.buffer=[],this.length=0}TB.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};xB.exports=TB});var OB=v((nhe,DB)=>{c();function Zl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Zl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Zl.prototype.get=function(t,e){return this.data[t*this.size+e]};Zl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Zl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};DB.exports=Zl});var PB=v(Ug=>{c();var eJ=ts().getSymbolSize;Ug.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=eJ(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var tJ=ts().getSymbolSize,BB=7;RB.getPositions=function(e){let r=tJ(e);return[[0,0],[r-BB,0],[0,r-BB]]}});var FB=v(We=>{c();We.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var To={N1:3,N2:3,N3:40,N4:10};We.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};We.from=function(e){return We.isValid(e)?parseInt(e,10):void 0};We.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=To.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=To.N1+(s-5)),a=f,s=1)}i>=5&&(n+=To.N1+(i-5)),s>=5&&(n+=To.N1+(s-5))}return n};We.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*To.N3};We.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var rs=Mg(),qg=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Vg=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];f_.getBlocksCount=function(e,r){switch(r){case rs.L:return qg[(e-1)*4+0];case rs.M:return qg[(e-1)*4+1];case rs.Q:return qg[(e-1)*4+2];case rs.H:return qg[(e-1)*4+3];default:return}};f_.getTotalCodewordsCount=function(e,r){switch(r){case rs.L:return Vg[(e-1)*4+0];case rs.M:return Vg[(e-1)*4+1];case rs.Q:return Vg[(e-1)*4+2];case rs.H:return Vg[(e-1)*4+3];default:return}}});var MB=v(Hg=>{c();var ef=new Uint8Array(512),jg=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ef[r]=e,jg[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ef[r]=ef[r-255]})();Hg.log=function(e){if(e<1)throw new Error("log("+e+")");return jg[e]};Hg.exp=function(e){return ef[e]};Hg.mul=function(e,r){return e===0||r===0?0:ef[jg[e]+jg[r]]}});var UB=v(tf=>{c();var d_=MB();tf.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var qB=UB();function p_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}p_.prototype.initialize=function(e){this.degree=e,this.genPoly=qB.generateECPolynomial(this.degree)};p_.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=qB.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};VB.exports=p_});var g_=v(HB=>{c();HB.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var y_=v(ri=>{c();var GB="[0-9]+",nJ="[A-Z $%*+\\-./:]+",rf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";rf=rf.replace(/u/g,"\\u");var iJ="(?:(?![A-Z0-9 $%*+\\-./:]|"+rf+`)(?:.|[\r -]))+`;ri.KANJI=new RegExp(rf,"g");ri.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ri.BYTE=new RegExp(iJ,"g");ri.NUMERIC=new RegExp(GB,"g");ri.ALPHANUMERIC=new RegExp(nJ,"g");var sJ=new RegExp("^"+rf+"$"),oJ=new RegExp("^"+GB+"$"),aJ=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ri.testKanji=function(e){return sJ.test(e)};ri.testNumeric=function(e){return oJ.test(e)};ri.testAlphanumeric=function(e){return aJ.test(e)}});var ns=v(Et=>{c();var uJ=g_(),m_=y_();Et.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};Et.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};Et.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};Et.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};Et.MIXED={bit:-1};Et.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!uJ.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Et.getBestModeForData=function(e){return m_.testNumeric(e)?Et.NUMERIC:m_.testAlphanumeric(e)?Et.ALPHANUMERIC:m_.testKanji(e)?Et.KANJI:Et.BYTE};Et.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Et.isValid=function(e){return e&&e.bit&&e.ccBits};function cJ(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Et.NUMERIC;case"alphanumeric":return Et.ALPHANUMERIC;case"kanji":return Et.KANJI;case"byte":return Et.BYTE;default:throw new Error("Unknown mode: "+t)}}Et.from=function(e,r){if(Et.isValid(e))return e;try{return cJ(e)}catch{return r}}});var WB=v(xo=>{c();var Gg=ts(),lJ=h_(),QB=Mg(),is=ns(),w_=g_(),KB=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,kB=Gg.getBCHDigit(KB);function fJ(t,e,r){for(let n=1;n<=40;n++)if(e<=xo.getCapacity(n,r,t))return n}function zB(t,e){return is.getCharCountIndicator(t,e)+4}function hJ(t,e){let r=0;return t.forEach(function(n){let i=zB(n.mode,e);r+=i+n.getBitsLength()}),r}function dJ(t,e){for(let r=1;r<=40;r++)if(hJ(t,r)<=xo.getCapacity(r,e,is.MIXED))return r}xo.from=function(e,r){return w_.isValid(e)?parseInt(e,10):r};xo.getCapacity=function(e,r,n){if(!w_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=is.BYTE);let i=Gg.getSymbolTotalCodewords(e),s=lJ.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===is.MIXED)return o;let a=o-zB(n,e);switch(n){case is.NUMERIC:return Math.floor(a/10*3);case is.ALPHANUMERIC:return Math.floor(a/11*2);case is.KANJI:return Math.floor(a/13);case is.BYTE:default:return Math.floor(a/8)}};xo.getBestVersionForData=function(e,r){let n,i=QB.from(r,QB.M);if(Array.isArray(e)){if(e.length>1)return dJ(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return fJ(n.mode,n.getLength(),i)};xo.getEncodedBits=function(e){if(!w_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Gg.getBCHDigit(r)-kB>=0;)r^=KB<{c();var E_=ts(),YB=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,pJ=1<<14|1<<12|1<<10|1<<4|1<<1,$B=E_.getBCHDigit(YB);JB.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;E_.getBCHDigit(i)-$B>=0;)i^=YB<{c();var gJ=ns();function nc(t){this.mode=gJ.NUMERIC,this.data=t.toString()}nc.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};nc.prototype.getLength=function(){return this.data.length};nc.prototype.getBitsLength=function(){return nc.getBitsLength(this.data.length)};nc.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};ZB.exports=nc});var rR=v((Ohe,tR)=>{c();var yJ=ns(),v_=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ic(t){this.mode=yJ.ALPHANUMERIC,this.data=t}ic.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};ic.prototype.getLength=function(){return this.data.length};ic.prototype.getBitsLength=function(){return ic.getBitsLength(this.data.length)};ic.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=v_.indexOf(this.data[r])*45;n+=v_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(v_.indexOf(this.data[r]),6)};tR.exports=ic});var iR=v((Bhe,nR)=>{"use strict";c();nR.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var oR=v((Lhe,sR)=>{c();var mJ=iR(),wJ=ns();function sc(t){this.mode=wJ.BYTE,typeof t=="string"&&(t=mJ(t)),this.data=new Uint8Array(t)}sc.getBitsLength=function(e){return e*8};sc.prototype.getLength=function(){return this.data.length};sc.prototype.getBitsLength=function(){return sc.getBitsLength(this.data.length)};sc.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var EJ=ns(),vJ=ts();function oc(t){this.mode=EJ.KANJI,this.data=t}oc.getBitsLength=function(e){return e*13};oc.prototype.getLength=function(){return this.data.length};oc.prototype.getBitsLength=function(){return oc.getBitsLength(this.data.length)};oc.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};aR.exports=oc});var cR=v((qhe,A_)=>{"use strict";c();var nf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=nf.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,y,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],y=l+d,w=i[u],E=typeof i[u]>"u",(E||w>y)&&(i[u]=y,s.push(u,y),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var N=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(N)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=nf.single_source_shortest_paths(t,e,r);return nf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=nf.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof A_<"u"&&(A_.exports=nf)});var mR=v(ac=>{c();var Ve=ns(),hR=eR(),dR=rR(),pR=oR(),gR=uR(),sf=y_(),Qg=ts(),AJ=cR();function lR(t){return unescape(encodeURIComponent(t)).length}function of(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function yR(t){let e=of(sf.NUMERIC,Ve.NUMERIC,t),r=of(sf.ALPHANUMERIC,Ve.ALPHANUMERIC,t),n,i;return Qg.isKanjiModeEnabled()?(n=of(sf.BYTE,Ve.BYTE,t),i=of(sf.KANJI,Ve.KANJI,t)):(n=of(sf.BYTE_KANJI,Ve.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function __(t,e){switch(e){case Ve.NUMERIC:return hR.getBitsLength(t);case Ve.ALPHANUMERIC:return dR.getBitsLength(t);case Ve.KANJI:return gR.getBitsLength(t);case Ve.BYTE:return pR.getBitsLength(t)}}function _J(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function bJ(t){let e=[];for(let r=0;r{c();var Kg=ts(),b_=Mg(),SJ=NB(),CJ=OB(),TJ=PB(),xJ=LB(),C_=FB(),T_=h_(),NJ=jB(),kg=WB(),DJ=XB(),OJ=ns(),I_=mR();function PJ(t,e){let r=t.size,n=xJ.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function BJ(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function S_(t,e,r){let n=t.size,i=DJ.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function FJ(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function MJ(t,e,r){let n=new SJ;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),OJ.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Kg.getSymbolTotalCodewords(t),s=T_.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{"use strict";c();var jA=yg(),ku=c8(),k$=D8(),K$=jA("%TypeError%"),Ag=jA("%WeakMap%",!0),_g=jA("%Map%",!0),z$=ku("WeakMap.prototype.get",!0),W$=ku("WeakMap.prototype.set",!0),$$=ku("WeakMap.prototype.has",!0),Y$=ku("Map.prototype.get",!0),J$=ku("Map.prototype.set",!0),X$=ku("Map.prototype.has",!0),GA=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Z$=function(t,e){var r=GA(t,e);return r&&r.value},eY=function(t,e,r){var n=GA(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},tY=function(t,e){return!!GA(t,e)};O8.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new K$("Side channel does not contain "+k$(s))},get:function(s){if(Ag&&s&&(typeof s=="object"||typeof s=="function")){if(e)return z$(e,s)}else if(_g){if(r)return Y$(r,s)}else if(n)return Z$(n,s)},has:function(s){if(Ag&&s&&(typeof s=="object"||typeof s=="function")){if(e)return $$(e,s)}else if(_g){if(r)return X$(r,s)}else if(n)return tY(n,s);return!1},set:function(s,o){Ag&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Ag),W$(e,s,o)):_g?(r||(r=new _g),J$(r,s,o)):(n||(n={key:{},next:null}),eY(n,s,o))}};return i}});var bg=v((ple,B8)=>{"use strict";c();var rY=String.prototype.replace,nY=/%20/g,QA={RFC1738:"RFC1738",RFC3986:"RFC3986"};B8.exports={default:QA.RFC3986,formatters:{RFC1738:function(t){return rY.call(t,nY,"+")},RFC3986:function(t){return String(t)}},RFC1738:QA.RFC1738,RFC3986:QA.RFC3986}});var KA=v((yle,L8)=>{"use strict";c();var iY=bg(),kA=Object.prototype.hasOwnProperty,Ao=Array.isArray,Tn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),sY=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Ao(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===iY.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Tn[l];continue}if(l<2048){a=a+(Tn[192|l>>6]+Tn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Tn[224|l>>12]+Tn[128|l>>6&63]+Tn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Tn[240|l>>18]+Tn[128|l>>12&63]+Tn[128|l>>6&63]+Tn[128|l&63]}return a},lY=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var U8=P8(),WA=KA(),kl=bg(),gY=Object.prototype.hasOwnProperty,F8={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},_o=Array.isArray,yY=String.prototype.split,mY=Array.prototype.push,q8=function(t,e){mY.apply(t,_o(e)?e:[e])},wY=Date.prototype.toISOString,M8=kl.default,Ut={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:WA.encode,encodeValuesOnly:!1,format:M8,formatter:kl.formatters[M8],indices:!1,serializeDate:function(e){return wY.call(e)},skipNulls:!1,strictNullHandling:!1},EY=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},zA={},vY=function t(e,r,n,i,s,o,a,u,l,f,d,y,w,E,T){for(var R=e,_=T,B=0,x=!1;(_=_.get(zA))!==void 0&&!x;){var O=_.get(e);if(B+=1,typeof O<"u"){if(O===B)throw new RangeError("Cyclic object value");x=!0}typeof _.get(zA)>"u"&&(B=0)}if(typeof a=="function"?R=a(r,R):R instanceof Date?R=f(R):n==="comma"&&_o(R)&&(R=WA.maybeMap(R,function(re){return re instanceof Date?f(re):re})),R===null){if(i)return o&&!w?o(r,Ut.encoder,E,"key",d):r;R=""}if(EY(R)||WA.isBuffer(R)){if(o){var P=w?r:o(r,Ut.encoder,E,"key",d);if(n==="comma"&&w){for(var L=yY.call(String(R),","),b="",C=0;C"u")return M;var Z;if(n==="comma"&&_o(R))Z=[{value:R.length>0?R.join(",")||null:void 0}];else if(_o(a))Z=a;else{var K=Object.keys(R);Z=u?K.sort(u):K}for(var j=0;j"u"?Ut.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,delimiter:typeof e.delimiter>"u"?Ut.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Ut.encode,encoder:typeof e.encoder=="function"?e.encoder:Ut.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Ut.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Ut.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Ut.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};V8.exports=function(t,e){var r=t,n=AY(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):_o(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in F8?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=F8[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=U8(),f=0;f0?w+y:""}});var Q8=v((vle,G8)=>{"use strict";c();var Ku=KA(),$A=Object.prototype.hasOwnProperty,_Y=Array.isArray,Pt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ku.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},bY=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},j8=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},IY="utf8=%26%2310003%3B",SY="utf8=%E2%9C%93",CY=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=_Y(E)?[E]:E),$A.call(n,w)?n[w]=Ku.combine(n[w],E):n[w]=E}return n},TY=function(t,e,r,n){for(var i=n?e:j8(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},xY=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&$A.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Pt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Pt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Pt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Pt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Pt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Pt.comma,decoder:typeof e.decoder=="function"?e.decoder:Pt.decoder,delimiter:typeof e.delimiter=="string"||Ku.isRegExp(e.delimiter)?e.delimiter:Pt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Pt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Pt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Pt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Pt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}};G8.exports=function(t,e){var r=NY(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?CY(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var DY=H8(),OY=Q8(),PY=bg();k8.exports={formats:PY,parse:OY,stringify:DY}});var YA=v(rt=>{"use strict";c();Object.defineProperty(rt,"__esModule",{value:!0});rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=rt.WALLET_PROVIDER_CALLBACK_PARAM=rt.WALLET_PROVIDER_SIGN_MESSAGE_URL=rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL=rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=rt.WALLET_PROVIDER_SEND_TRANSACTION_URL=rt.WALLET_PROVIDER_DISCONNECT_URL=rt.WALLET_PROVIDER_CONNECT_URL=rt.WALLET_PROVIDER_TESTNET=rt.WALLET_PROVIDER_DEVNET=rt.WALLET_PROVIDER_MAINNET=void 0;rt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_CONNECT_URL="hook/login";rt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";rt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";rt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";rt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var z8=v(zu=>{"use strict";c();Object.defineProperty(zu,"__esModule",{value:!0});zu.ErrCannotSignedMessage=zu.ErrCannotGetSignedTransactions=void 0;var JA=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};zu.ErrCannotGetSignedTransactions=JA;var XA=class extends Error{constructor(){super("Cannot get signed message")}};zu.ErrCannotSignedMessage=XA});var W8=v(Ig=>{"use strict";c();Object.defineProperty(Ig,"__esModule",{value:!0});Ig.PlainSignedTransaction=void 0;var ZA=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Ig.PlainSignedTransaction=ZA});var Kl=v(es=>{"use strict";c();var Xi=es&&es.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},BY=es&&es.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var e_=BY(K8()),Zi=YA(),t_=z8(),RY=W8(),Wu=class{constructor(e){this.walletUrl=e}login(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Xi(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return Xi(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Xi(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=e_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new t_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Xi(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=e_.default.parse(window.location.search.slice(1));return Wu.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(Zi.WALLET_PROVIDER_CALLBACK_PARAM)&&e[Zi.WALLET_PROVIDER_CALLBACK_PARAM]===Zi.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new t_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new t_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=Wu.prepareWalletTransaction(o);for(let u in a)a.hasOwnProperty(u)&&!i.hasOwnProperty(u)&&(i[u]=[]),i[u].push(a[u])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};es.WalletProvider=Wu});var Z8=v(Tg=>{"use strict";c();Object.defineProperty(Tg,"__esModule",{value:!0});Tg.TransactionStatus=void 0;var zl=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new zl("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};Tg.TransactionStatus=zl});var Ju=v(Rt=>{"use strict";c();var LY=Rt&&Rt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FY=Rt&&Rt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MY=Rt&&Rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LY(e,t,r);return FY(e,t),e};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.zeroPadStringIfOddLength=Rt.isPaddedHex=Rt.numberToPaddedHex=Rt.Nonce=Rt.Address=void 0;var eB=MY(Cf()),UY="erd",Wl=class{constructor(e){this.value=e}static fromPubkey(e){let r=eB.toWords(e),n=eB.encode(UY,r);return new Wl(n)}bech32(){return this.value}toString(){return this.bech32()}};Rt.Address=Wl;var r_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return tB(this.value)}};Rt.Nonce=r_;function tB(t){let e=t.toString(16);return rB(e)}Rt.numberToPaddedHex=tB;function qY(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Rt.isPaddedHex=qY;function rB(t){return t=t||"",t.length%2==1?"0"+t:t}Rt.zeroPadStringIfOddLength=rB});var iB=v(xg=>{"use strict";c();Object.defineProperty(xg,"__esModule",{value:!0});xg.TransactionReceipt=void 0;var nB=Ju(),$l=class{constructor(){this.value="",this.sender=new nB.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new $l;return r.value=(e.value||0).toString(),r.sender=new nB.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};xg.TransactionReceipt=$l});var sB=v(xn=>{"use strict";c();Object.defineProperty(xn,"__esModule",{value:!0});xn.ErrContractQuery=xn.ErrNetworkProvider=xn.ErrUnexpectedCondition=xn.Err=void 0;var Xu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};xn.Err=Xu;var n_=class extends Xu{constructor(e){super(`Unexpected condition: [${e}]`)}};xn.ErrUnexpectedCondition=n_;var i_=class extends Xu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};xn.ErrNetworkProvider=i_;var s_=class extends Xu{constructor(e){super(e.message.replace("executeQuery:",""))}};xn.ErrContractQuery=s_});var aB=v(Zu=>{"use strict";c();Object.defineProperty(Zu,"__esModule",{value:!0});Zu.TransactionEventTopic=Zu.TransactionEvent=void 0;var oB=Ju(),Yl=class{constructor(e){this.address=new oB.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new Yl;return r.address=new oB.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Ng(n)),r.data=h.Buffer.from(e.data||"","base64").toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Zu.TransactionEvent=Yl;var Ng=class{constructor(e){this.raw=h.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Zu.TransactionEventTopic=Ng});var o_=v(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.TransactionLogs=void 0;var VY=sB(),uB=Ju(),HY=aB(),Jl=class{constructor(e){this.address=new uB.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new Jl;return r.address=new uB.Address(e.address),r.events=(e.events||[]).map(n=>HY.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new VY.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};Dg.TransactionLogs=Jl});var lB=v(tc=>{"use strict";c();Object.defineProperty(tc,"__esModule",{value:!0});tc.ContractResultItem=tc.ContractResults=void 0;var cB=o_(),Og=Ju(),ec=class{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>ti.fromProxyHttpResponse(n));return new ec(r)}static fromApiHttpResponse(e){let r=e.map(n=>ti.fromApiHttpResponse(n));return new ec(r)}};tc.ContractResults=ec;var ti=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Og.Address(""),this.sender=new Og.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new cB.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ti.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=ti.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new ti;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Og.Address(e.receiver),r.sender=new Og.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=cB.TransactionLogs.fromHttpResponse(e.logs||{}),r}};tc.ContractResultItem=ti});var fB=v(rs=>{"use strict";c();var jY=rs&&rs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rs,"__esModule",{value:!0});rs.EsdtContractAddress=rs.MaxUint64AsBigNumber=void 0;var GY=jY(Wt()),QY=Ju();rs.MaxUint64AsBigNumber=new GY.default("18446744073709551615");rs.EsdtContractAddress=new QY.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var hB=v(rc=>{"use strict";c();var kY=rc&&rc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rc,"__esModule",{value:!0});rc.ContractQueryResponse=void 0;var KY=kY(Wt()),zY=fB(),Xl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new KY.default(e.gasRemaining||e.GasRemaining||0),o=zY.MaxUint64AsBigNumber.minus(s).toNumber();return new Xl({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>h.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};rc.ContractQueryResponse=Xl});var dB=v(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.ContractQueryRequest=void 0;var a_=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Pg.ContractQueryRequest=a_});var IB=v((kfe,bB)=>{c();bB.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ns=v(So=>{c();var u_,WY=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];So.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};So.getSymbolTotalCodewords=function(e){return WY[e]};So.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};So.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');u_=e};So.isKanjiModeEnabled=function(){return typeof u_<"u"};So.toSJIS=function(e){return u_(e)}});var Lg=v(Nr=>{c();Nr.L={bit:1};Nr.M={bit:0};Nr.Q={bit:3};Nr.H={bit:2};function $Y(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Nr.L;case"m":case"medium":return Nr.M;case"q":case"quartile":return Nr.Q;case"h":case"high":return Nr.H;default:throw new Error("Unknown EC Level: "+t)}}Nr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Nr.from=function(e,r){if(Nr.isValid(e))return e;try{return $Y(e)}catch{return r}}});var TB=v((Jfe,CB)=>{c();function SB(){this.buffer=[],this.length=0}SB.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};CB.exports=SB});var NB=v((Zfe,xB)=>{c();function Zl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Zl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Zl.prototype.get=function(t,e){return this.data[t*this.size+e]};Zl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Zl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};xB.exports=Zl});var DB=v(Fg=>{c();var YY=ns().getSymbolSize;Fg.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=YY(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var JY=ns().getSymbolSize,OB=7;PB.getPositions=function(e){let r=JY(e);return[[0,0],[r-OB,0],[0,r-OB]]}});var RB=v(We=>{c();We.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Co={N1:3,N2:3,N3:40,N4:10};We.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};We.from=function(e){return We.isValid(e)?parseInt(e,10):void 0};We.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Co.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=Co.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Co.N1+(i-5)),s>=5&&(n+=Co.N1+(s-5))}return n};We.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*Co.N3};We.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var is=Lg(),Mg=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ug=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];c_.getBlocksCount=function(e,r){switch(r){case is.L:return Mg[(e-1)*4+0];case is.M:return Mg[(e-1)*4+1];case is.Q:return Mg[(e-1)*4+2];case is.H:return Mg[(e-1)*4+3];default:return}};c_.getTotalCodewordsCount=function(e,r){switch(r){case is.L:return Ug[(e-1)*4+0];case is.M:return Ug[(e-1)*4+1];case is.Q:return Ug[(e-1)*4+2];case is.H:return Ug[(e-1)*4+3];default:return}}});var LB=v(Vg=>{c();var ef=new Uint8Array(512),qg=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ef[r]=e,qg[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ef[r]=ef[r-255]})();Vg.log=function(e){if(e<1)throw new Error("log("+e+")");return qg[e]};Vg.exp=function(e){return ef[e]};Vg.mul=function(e,r){return e===0||r===0?0:ef[qg[e]+qg[r]]}});var FB=v(tf=>{c();var f_=LB();tf.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var MB=FB();function h_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}h_.prototype.initialize=function(e){this.degree=e,this.genPoly=MB.generateECPolynomial(this.degree)};h_.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=MB.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};UB.exports=h_});var d_=v(VB=>{c();VB.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var p_=v(ri=>{c();var HB="[0-9]+",ZY="[A-Z $%*+\\-./:]+",rf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";rf=rf.replace(/u/g,"\\u");var eJ="(?:(?![A-Z0-9 $%*+\\-./:]|"+rf+`)(?:.|[\r +]))+`;ri.KANJI=new RegExp(rf,"g");ri.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ri.BYTE=new RegExp(eJ,"g");ri.NUMERIC=new RegExp(HB,"g");ri.ALPHANUMERIC=new RegExp(ZY,"g");var tJ=new RegExp("^"+rf+"$"),rJ=new RegExp("^"+HB+"$"),nJ=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ri.testKanji=function(e){return tJ.test(e)};ri.testNumeric=function(e){return rJ.test(e)};ri.testAlphanumeric=function(e){return nJ.test(e)}});var ss=v(Et=>{c();var iJ=d_(),g_=p_();Et.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Et.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Et.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Et.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Et.MIXED={bit:-1};Et.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!iJ.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Et.getBestModeForData=function(e){return g_.testNumeric(e)?Et.NUMERIC:g_.testAlphanumeric(e)?Et.ALPHANUMERIC:g_.testKanji(e)?Et.KANJI:Et.BYTE};Et.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Et.isValid=function(e){return e&&e.bit&&e.ccBits};function sJ(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Et.NUMERIC;case"alphanumeric":return Et.ALPHANUMERIC;case"kanji":return Et.KANJI;case"byte":return Et.BYTE;default:throw new Error("Unknown mode: "+t)}}Et.from=function(e,r){if(Et.isValid(e))return e;try{return sJ(e)}catch{return r}}});var KB=v(To=>{c();var Hg=ns(),oJ=l_(),jB=Lg(),os=ss(),y_=d_(),QB=7973,GB=Hg.getBCHDigit(QB);function aJ(t,e,r){for(let n=1;n<=40;n++)if(e<=To.getCapacity(n,r,t))return n}function kB(t,e){return os.getCharCountIndicator(t,e)+4}function uJ(t,e){let r=0;return t.forEach(function(n){let i=kB(n.mode,e);r+=i+n.getBitsLength()}),r}function cJ(t,e){for(let r=1;r<=40;r++)if(uJ(t,r)<=To.getCapacity(r,e,os.MIXED))return r}To.from=function(e,r){return y_.isValid(e)?parseInt(e,10):r};To.getCapacity=function(e,r,n){if(!y_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=os.BYTE);let i=Hg.getSymbolTotalCodewords(e),s=oJ.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===os.MIXED)return o;let a=o-kB(n,e);switch(n){case os.NUMERIC:return Math.floor(a/10*3);case os.ALPHANUMERIC:return Math.floor(a/11*2);case os.KANJI:return Math.floor(a/13);case os.BYTE:default:return Math.floor(a/8)}};To.getBestVersionForData=function(e,r){let n,i=jB.from(r,jB.M);if(Array.isArray(e)){if(e.length>1)return cJ(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return aJ(n.mode,n.getLength(),i)};To.getEncodedBits=function(e){if(!y_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Hg.getBCHDigit(r)-GB>=0;)r^=QB<{c();var m_=ns(),WB=1335,lJ=21522,zB=m_.getBCHDigit(WB);$B.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;m_.getBCHDigit(i)-zB>=0;)i^=WB<{c();var fJ=ss();function nc(t){this.mode=fJ.NUMERIC,this.data=t.toString()}nc.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};nc.prototype.getLength=function(){return this.data.length};nc.prototype.getBitsLength=function(){return nc.getBitsLength(this.data.length)};nc.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};JB.exports=nc});var eR=v((The,ZB)=>{c();var hJ=ss(),w_=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ic(t){this.mode=hJ.ALPHANUMERIC,this.data=t}ic.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};ic.prototype.getLength=function(){return this.data.length};ic.prototype.getBitsLength=function(){return ic.getBitsLength(this.data.length)};ic.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=w_.indexOf(this.data[r])*45;n+=w_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(w_.indexOf(this.data[r]),6)};ZB.exports=ic});var rR=v((Nhe,tR)=>{"use strict";c();tR.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var iR=v((Ohe,nR)=>{c();var dJ=rR(),pJ=ss();function sc(t){this.mode=pJ.BYTE,typeof t=="string"&&(t=dJ(t)),this.data=new Uint8Array(t)}sc.getBitsLength=function(e){return e*8};sc.prototype.getLength=function(){return this.data.length};sc.prototype.getBitsLength=function(){return sc.getBitsLength(this.data.length)};sc.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var gJ=ss(),yJ=ns();function oc(t){this.mode=gJ.KANJI,this.data=t}oc.getBitsLength=function(e){return e*13};oc.prototype.getLength=function(){return this.data.length};oc.prototype.getBitsLength=function(){return oc.getBitsLength(this.data.length)};oc.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};sR.exports=oc});var aR=v((Lhe,E_)=>{"use strict";c();var nf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=nf.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,y,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],y=l+d,w=i[u],E=typeof i[u]>"u",(E||w>y)&&(i[u]=y,s.push(u,y),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=nf.single_source_shortest_paths(t,e,r);return nf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=nf.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof E_<"u"&&(E_.exports=nf)});var gR=v(ac=>{c();var Ve=ss(),lR=XB(),fR=eR(),hR=iR(),dR=oR(),sf=p_(),jg=ns(),mJ=aR();function uR(t){return unescape(encodeURIComponent(t)).length}function of(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function pR(t){let e=of(sf.NUMERIC,Ve.NUMERIC,t),r=of(sf.ALPHANUMERIC,Ve.ALPHANUMERIC,t),n,i;return jg.isKanjiModeEnabled()?(n=of(sf.BYTE,Ve.BYTE,t),i=of(sf.KANJI,Ve.KANJI,t)):(n=of(sf.BYTE_KANJI,Ve.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function v_(t,e){switch(e){case Ve.NUMERIC:return lR.getBitsLength(t);case Ve.ALPHANUMERIC:return fR.getBitsLength(t);case Ve.KANJI:return dR.getBitsLength(t);case Ve.BYTE:return hR.getBitsLength(t)}}function wJ(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function EJ(t){let e=[];for(let r=0;r{c();var Qg=ns(),A_=Lg(),AJ=TB(),_J=NB(),bJ=DB(),IJ=BB(),I_=RB(),S_=l_(),SJ=qB(),Gg=KB(),CJ=YB(),TJ=ss(),__=gR();function xJ(t,e){let r=t.size,n=IJ.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function NJ(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function b_(t,e,r){let n=t.size,i=CJ.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function PJ(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function BJ(t,e,r){let n=new AJ;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),TJ.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Qg.getSymbolTotalCodewords(t),s=S_.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u=7&&LJ(u,e),FJ(u,o),isNaN(n)&&(n=C_.getBestMask(u,S_.bind(null,u,r))),C_.applyMask(n,u),S_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}wR.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=b_.M,i,s;return typeof r<"u"&&(n=b_.from(r.errorCorrectionLevel,b_.M),i=kg.from(r.version),s=C_.from(r.maskPattern),r.toSJISFunc&&Kg.setToSJISFunction(r.toSJISFunc)),qJ(e,i,n,s)}});var x_=v(No=>{c();function vR(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}No.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:vR(e.color.dark||"#000000ff"),light:vR(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};No.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};No.getImageWidth=function(e,r){let n=No.getScale(e,r);return Math.floor((e+r.margin*2)*n)};No.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=No.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var N_=x_();function VJ(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function jJ(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}zg.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=jJ()),i=N_.getOptions(i);let o=N_.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return N_.qrToImageData(u.data,e,i),VJ(a,s,o),a.putImageData(u,0,0),s};zg.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=zg.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var IR=v(bR=>{c();var HJ=x_();function _R(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function D_(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function GJ(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?D_("M",u+r,.5+l+r):D_("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',y=''+u+l+` -`;return typeof n=="function"&&n(null,y),y}});var CR=v(af=>{c();var QJ=CB(),O_=ER(),SR=AR(),kJ=IR();function P_(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!QJ())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=O_.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=O_.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}af.create=O_.create;af.toCanvas=P_.bind(null,SR.render);af.toDataURL=P_.bind(null,SR.renderToDataURL);af.toString=P_.bind(null,function(t,e,r){return kJ.render(t,r)})});var UR=v(ss=>{"use strict";c();var nX=ss&&ss.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MR=ss&&ss.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nX(e,t,r)};Object.defineProperty(ss,"__esModule",{value:!0});MR(Kl(),ss);MR(XA(),ss)});c();var iX=_e(ub()),sX=_e(KC()),oX=_e(WC()),aX=_e(Zt()),uX=_e(Ph()),cX=_e(Pc()),lX=_e(Cc()),fX=_e(uw()),hX=_e(Lx()),dX=_e(Fh()),QR=_e(li()),Nn=_e(wc()),kR=_e(gc()),KR=_e(Xo());c();c();var Gx=_e(uE());c();c();var ud="elvenjs_state",Vx="https://devnet-api.multiversx.com";var cd="/dapp/init",ld="devnet",jx="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",Hx=["wss://relay.walletconnect.com"],yn={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Te={get(t){let e=localStorage.getItem(ud);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(ud,JSON.stringify(r))},clear(){localStorage.removeItem(ud)}};var fd=()=>Ce(void 0,null,function*(){let t=Gx.ExtensionProvider.getInstance();try{let e=yield t.init(),r=Te.get();if(r!=null&&r.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var jR=_e(uE()),HR=_e(Vl()),GR=_e(Kl());c();var Z8=_e(Vl());c();c();var Se=class{static set(e,r){if(!e)return;let n=M_(Oo({},this.events),{[e]:r});this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){var n,i;!e||!this.events||(i=(n=this.events)[e])==null||i.call(n,...r)}static clear(){this.events=void 0}};c();var Io=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(Io||{});var $u=t=>Ce(void 0,null,function*(){if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Se.run("onLoginPending");let e=yield t.dappProvider.logout();return e&&(Te.clear(),Se.run("onLogout")),e});c();var J8=_e(Zt()),X8=_e(Ph());c();var Bt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var Yu=()=>new Date().setHours(new Date().getHours()+24),Tg=t=>Date.now()>t;var Zi=t=>Ce(void 0,null,function*(){let e=Te.get("address"),r=Te.get("expires");if(!(r&&Tg(r))&&e&&t.networkProvider){let i=new J8.Address(e),s=new X8.Account(i);try{let o=yield t.networkProvider.getAccount(i);Te.set("address",e),Te.set("nonce",o.nonce.valueOf()),Te.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});c();function xg(t){return t[Math.floor(Math.random()*t.length)]}var eB=t=>Ce(void 0,null,function*(){if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{Zi(t),Se.run("onLoggedIn")},onClientLogout:()=>$u(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=xg(t.initOptions.walletConnectV2RelayAddresses),n=new Z8.WalletConnectV2Provider(e,yn[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return yield n.init(),n}catch(i){console.warn("Can't initialize the Dapp Provider!")}});c();var yB=_e(Wt()),Lg=_e(Zt()),mB=_e(tB()),wB=_e(oB()),EB=_e(u_()),vB=_e(hB()),AB=_e(pB()),_B=_e(gB()),bB=_e(Uh());var Fg=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){var i,s;this.chainType=r||ld,this.apiUrl=e||((i=yn[this.chainType])==null?void 0:i.apiAddress),this.apiTimeout=n||((s=yn[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,r){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,r,n){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=yield a.json();if(!a.ok){let l=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}sendTransaction(e){return Ce(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Ce(this,null,function*(){let r=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Lg.Address((r==null?void 0:r.address)||""),nonce:Number((r==null?void 0:r.nonce)||0),balance:new yB.default((r==null?void 0:r.balance)||0),code:(r==null?void 0:r.code)||"",userName:(r==null?void 0:r.username)||""}})}getTransaction(e){return Ce(this,null,function*(){let r=yield this.apiGet(`transactions/${e}`),n=new mB.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new Lg.Address(r.sender),receiver:new Lg.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:wB.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:EB.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:vB.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}})}queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n,value:i,caller:s}){try{let a=new bB.Query({address:e,func:r,args:n,value:i,caller:s}),u=new _B.ContractQueryRequest(a).toHttpRequest(),l=yield this.apiPost("query",u);return AB.ContractQueryResponse.fromHttpResponse(l)}catch(a){this.handleApiError(a,"query")}})}};c();var IB=(t,e)=>Ce(void 0,null,function*(){let r=yield fd();try{r&&(yield r.login()),Se.run("onLoginPending")}catch(i){let s=Bt(i);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!r)throw new Error("Error: There were problems with auth provider initialization!");let{signature:n}=r.account;if(e&&Te.set("loginToken",e),n&&Te.set("signature",n),t.networkProvider)try{let i=yield r.getAddress();if(!i)throw new Error("Canceled!");return Te.set("address",i),Te.set("loginMethod","browser-extension"),Te.set("expires",Yu()),yield Zi(t),Se.run("onLoggedIn"),r}catch(i){console.warn(`Something went wrong trying to synchronize the user account: ${i==null?void 0:i.message}`),Se.run("onLogout")}});c();c();var TR=_e(CR()),xR=_e(Vl());var zJ=t=>{var r;let e=document.createElement("template");return e.innerHTML=t.trim(),(r=e.content.firstChild)==null?void 0:r.cloneNode(!0)},WJ=t=>{let e=`${jx}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},$J=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},YJ=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},B_={},JJ=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",B_[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:B_[t.topic].signal}),r},Wg={},XJ=(t,e,r)=>{var o,a;let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${(o=t.peerMetadata)==null?void 0:o.description} (${(a=t.peerMetadata)==null?void 0:a.url})`,n.appendChild(i);let s=JJ(t,e);return n.appendChild(s),Wg[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Wg[t.topic].signal}),n},ZJ=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},eX=t=>{if(!t)return;let e=document.getElementById(t);e==null||e.remove()},tX=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),rX=t=>Ce(void 0,null,function*(){return t?yield TR.default.toString(t,{type:"svg"}):void 0}),NR=(t,e,r,n)=>Ce(void 0,null,function*(){if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=yield rX(e),o;if(s&&(o=zJ(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),tX()&&i.appendChild(WJ(e))),i&&r instanceof xR.WalletConnectV2Provider){let a=r.pairings,u=f=>Ce(void 0,null,function*(){try{f&&(yield r.logout({topic:f}),eX(f))}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${y}`)}finally{Wg[f].abort()}}),l=f=>Ce(void 0,null,function*(){try{let{approval:d}=yield r.connect({topic:f,methods:["mvx_cancelAction"]});if(!document.getElementById("elven-wc-pairing-item-confirm-msessage")){let w=document.getElementById(f);w==null||w.after(ZJ())}yield r.login({approval:d,token:n})}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to login the user: ${y}`)}finally{for(let d of Object.values(Wg))d==null||d.abort();for(let d of Object.values(B_))d==null||d.abort()}});if(a&&a.length>0){let f=$J();i.appendChild(f);let d=YJ();f.appendChild(d);for(let y of a){let w=XJ(y,u,l);f.appendChild(w)}}}return i});var $g=_e(Vl());var DR=(t,e,r)=>Ce(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let n=xg(t.initOptions.walletConnectV2RelayAddresses);if(!n||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let i,s={onClientLogin:()=>Ce(void 0,null,function*(){if(t.dappProvider instanceof $g.WalletConnectV2Provider){Se.run("onLoginPending");let a=yield t.dappProvider.getAddress(),u=yield t.dappProvider.getSignature();Te.set("address",a),Te.set("loginMethod","mobile"),Te.set("expires",Yu()),yield Zi(t),u&&Te.set("signature",u),r&&Te.set("loginToken",r),Se.run("onLoggedIn"),i==null||i.replaceChildren()}}),onClientLogout:()=>Ce(void 0,null,function*(){t.dappProvider instanceof $g.WalletConnectV2Provider&&(yield $u(t),Se.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new $g.WalletConnectV2Provider(s,yn[t.initOptions.chainType].shortId,n,t.initOptions.walletConnectV2ProjectId);try{if(o){t.dappProvider=o,Se.run("onQrPending"),yield o.init();let{uri:a,approval:u}=yield o.connect({methods:["mvx_cancelAction"]}),l=r?`${a}&token=${r}`:a;return e&&l&&(i=yield NR(e,l,o,r),Se.run("onQrLoaded")),yield o.login({approval:u,token:r}),o}}catch(a){let u=Bt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.run("onLogout")}});c();var OR=_e(Kl());var PR=(t,e,r)=>Ce(void 0,null,function*(){let n=new OR.WalletProvider(`${t}${cd}`),i=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=Oo({callbackUrl:i},r?{token:r}:{});try{return Se.run("onLoginPending"),Te.set("loginMethod","web-wallet"),yield n.login(s),Te.set("expires",Yu()),r&&Te.set("loginToken",r),n}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Te.set("loginMethod",""),Se.run("onLogout")}});c();var Do=t=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var BR=_e(Kl());var RR=t=>Ce(void 0,null,function*(){let e=Do("signature"),r=Do("address"),n=Te.get("address");if(e&&Te.set("signature",e),r||n)return r&&(Te.set("address",r),window.history.replaceState(null,"",window.location.pathname)),new BR.WalletProvider(`${t}${cd}`)});c();var LR=_e(Ph()),FR=_e(uw());var Yg=(t,e)=>Ce(void 0,null,function*(){Se.run("onTxSent",t),yield new FR.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new LR.Account(n),s=yield e.getAccount(n);i.update(s),Te.set("address",i.address.bech32()),Te.set("nonce",i.getNonceThenIncrement().valueOf()),Te.set("balance",i.balance.toString()),Se.run("onTxFinalized",t)});c();var Jg=_e(UR()),qR=_e(Pc());var VR=(t,e,r)=>Ce(void 0,null,function*(){if(Do(Jg.WALLET_PROVIDER_CALLBACK_PARAM)===Jg.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i==null?void 0:i[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=qR.Transaction.fromPlainObject(s);o.setNonce(r);try{Se.run("onTxStarted",o),yield e.sendTransaction(o),yield Yg(o,e)}catch(a){let u=Bt(a);throw Se.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var cf=class{static init(e){return Ce(this,null,function*(){let r=Te.get();if(r.expires&&Tg(r.expires)){Te.clear(),this.dappProvider=void 0;return}this.initOptions=Oo({chainType:ld,apiUrl:Vx,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:Hx},e),this.networkProvider=new Fg(this.initOptions),this.initOptions.onLoginPending&&Se.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Se.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Se.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Se.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Se.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Se.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Se.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Se.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Se.set("onTxError",this.initOptions.onTxError),((r==null?void 0:r.address)||r.loginMethod==="web-wallet"&&Do("address"))&&(r!=null&&r.loginMethod)&&(Se.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=yield fd()),r.loginMethod==="mobile"&&(this.dappProvider=yield eB(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield RR(yn[this.initOptions.chainType].walletAddress)),yield Zi(this),Se.run("onLoggedIn"),r.loginMethod==="web-wallet"&&(yield VR(this.dappProvider,this.networkProvider,r.nonce)))})}static login(e,r){return Ce(this,null,function*(){var i;if(!Object.values(Io).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield IB(this,r==null?void 0:r.token);this.dappProvider=s}if(e==="mobile"){let s=yield DR(this,r==null?void 0:r.qrCodeContainer,r==null?void 0:r.token);this.dappProvider=s}if(e==="web-wallet"&&((i=this.initOptions)!=null&&i.chainType)){let s=yield PR(yn[this.initOptions.chainType].walletAddress,r==null?void 0:r.callbackRoute,r==null?void 0:r.token);this.dappProvider=s}}catch(s){let o=Bt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Ce(this,null,function*(){try{let e=yield $u(this);return this.dappProvider=void 0,e}catch(e){let r=Bt(e);console.warn("Something went wrong when logging out: ",r)}})}static signAndSendTransaction(e){return Ce(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Se.run("onTxStarted",e);let r=Te.get();e.setNonce(r.nonce),this.dappProvider instanceof jR.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof HR.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof GR.WalletProvider&&(yield this.dappProvider.signTransaction(e)),r.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Yg(e,this.networkProvider))}catch(r){let n=Bt(r);throw Se.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e})}static queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(a){let u=Bt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},uf=cf;uf.storage=Te,uf.destroy=()=>{cf.networkProvider=void 0,cf.dappProvider=void 0,cf.initOptions=void 0,Se.clear()};var export_Account=uX.Account;var export_Address=aX.Address;var export_AddressType=KR.AddressType;var export_AddressValue=KR.AddressValue;var export_BigUIntType=Nn.BigUIntType;var export_BigUIntValue=Nn.BigUIntValue;var export_BooleanType=kR.BooleanType;var export_BooleanValue=kR.BooleanValue;var export_BytesType=QR.BytesType;var export_BytesValue=QR.BytesValue;var export_ContractFunction=dX.ContractFunction;var export_GasEstimator=oX.GasEstimator;var export_SmartContract=hX.SmartContract;var export_TokenTransfer=iX.TokenTransfer;var export_Transaction=cX.Transaction;var export_TransactionPayload=lX.TransactionPayload;var export_TransactionWatcher=fX.TransactionWatcher;var export_TransferTransactionsFactory=sX.TransferTransactionsFactory;var export_U16Type=Nn.U16Type;var export_U16Value=Nn.U16Value;var export_U32Type=Nn.U32Type;var export_U32Value=Nn.U32Value;var export_U64Type=Nn.U64Type;var export_U64Value=Nn.U64Value;var export_U8Type=Nn.U8Type;var export_U8Value=Nn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,uf as ElvenJS,export_GasEstimator as GasEstimator,Io as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; +`);let o=BJ(e,r,i),a=Qg.getSymbolSize(e),u=new _J(a);return xJ(u,e),NJ(u),DJ(u,e),b_(u,r,0),e>=7&&OJ(u,e),PJ(u,o),isNaN(n)&&(n=I_.getBestMask(u,b_.bind(null,u,r))),I_.applyMask(n,u),b_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}yR.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=A_.M,i,s;return typeof r<"u"&&(n=A_.from(r.errorCorrectionLevel,A_.M),i=Gg.from(r.version),s=I_.from(r.maskPattern),r.toSJISFunc&&Qg.setToSJISFunction(r.toSJISFunc)),LJ(e,i,n,s)}});var C_=v(xo=>{c();function wR(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}xo.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:wR(e.color.dark||"#000000ff"),light:wR(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};xo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};xo.getImageWidth=function(e,r){let n=xo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};xo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=xo.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var T_=C_();function FJ(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function MJ(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}kg.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=MJ()),i=T_.getOptions(i);let o=T_.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return T_.qrToImageData(u.data,e,i),FJ(a,s,o),a.putImageData(u,0,0),s};kg.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=kg.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var _R=v(AR=>{c();var UJ=C_();function vR(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function x_(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function qJ(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?x_("M",u+r,.5+l+r):x_("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',y=''+u+l+` +`;return typeof n=="function"&&n(null,y),y}});var IR=v(af=>{c();var VJ=IB(),N_=mR(),bR=ER(),HJ=_R();function D_(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!VJ())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=N_.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=N_.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}af.create=N_.create;af.toCanvas=D_.bind(null,bR.render);af.toDataURL=D_.bind(null,bR.renderToDataURL);af.toString=D_.bind(null,function(t,e,r){return HJ.render(t,r)})});var FR=v(as=>{"use strict";c();var ZJ=as&&as.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LR=as&&as.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZJ(e,t,r)};Object.defineProperty(as,"__esModule",{value:!0});LR(Kl(),as);LR(YA(),as)});c();var eX=be(ob()),tX=be(QC()),rX=be(KC()),nX=be(Zt()),iX=be(Oh()),sX=be(Pc()),oX=be(Cc()),aX=be(ow()),uX=be(Bx()),cX=be(Lh()),jR=be(li()),Nn=be(wc()),GR=be(gc()),QR=be(Xo());c();c();var Hx=be(oE());c();c();var od="elvenjs_state",Ux="https://devnet-api.multiversx.com";var ad="/dapp/init",ud="devnet",qx="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",Vx=["wss://relay.walletconnect.com"],yn={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Te={get(t){let e=localStorage.getItem(od);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(od,JSON.stringify(r))},clear(){localStorage.removeItem(od)}};var cd=()=>Ce(void 0,null,function*(){let t=Hx.ExtensionProvider.getInstance();try{let e=yield t.init(),r=Te.get();if(r!=null&&r.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var qR=be(oE()),VR=be(Vl()),HR=be(Kl());c();var J8=be(Vl());c();c();var Se=class{static set(e,r){if(!e)return;let n=L_(Do({},this.events),{[e]:r});this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){var n,i;!e||!this.events||(i=(n=this.events)[e])==null||i.call(n,...r)}static clear(){this.events=void 0}};c();var bo=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(bo||{});var $u=t=>Ce(void 0,null,function*(){if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Se.run("onLoginPending");let e=yield t.dappProvider.logout();return e&&(Te.clear(),Se.run("onLogout")),e});c();var $8=be(Zt()),Y8=be(Oh());c();var Bt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var Yu=()=>new Date().setHours(new Date().getHours()+24),Sg=t=>Date.now()>t;var ts=t=>Ce(void 0,null,function*(){let e=Te.get("address"),r=Te.get("expires");if(!(r&&Sg(r))&&e&&t.networkProvider){let i=new $8.Address(e),s=new Y8.Account(i);try{let o=yield t.networkProvider.getAccount(i);Te.set("address",e),Te.set("nonce",o.nonce.valueOf()),Te.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});c();function Cg(t){return t[Math.floor(Math.random()*t.length)]}var X8=t=>Ce(void 0,null,function*(){if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{ts(t),Se.run("onLoggedIn")},onClientLogout:()=>$u(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Cg(t.initOptions.walletConnectV2RelayAddresses),n=new J8.WalletConnectV2Provider(e,yn[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return yield n.init(),n}catch(i){console.warn("Can't initialize the Dapp Provider!")}});c();var pB=be(Wt()),Bg=be(Zt()),gB=be(Z8()),yB=be(iB()),mB=be(o_()),wB=be(lB()),EB=be(hB()),vB=be(dB()),AB=be(Mh());var Rg=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){var i,s;this.chainType=r||ud,this.apiUrl=e||((i=yn[this.chainType])==null?void 0:i.apiAddress),this.apiTimeout=n||((s=yn[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,r){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,r,n){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=yield a.json();if(!a.ok){let l=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}sendTransaction(e){return Ce(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Ce(this,null,function*(){let r=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Bg.Address((r==null?void 0:r.address)||""),nonce:Number((r==null?void 0:r.nonce)||0),balance:new pB.default((r==null?void 0:r.balance)||0),code:(r==null?void 0:r.code)||"",userName:(r==null?void 0:r.username)||""}})}getTransaction(e){return Ce(this,null,function*(){let r=yield this.apiGet(`transactions/${e}`),n=new gB.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new Bg.Address(r.sender),receiver:new Bg.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:yB.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:mB.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:wB.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}})}queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n,value:i,caller:s}){try{let a=new AB.Query({address:e,func:r,args:n,value:i,caller:s}),u=new vB.ContractQueryRequest(a).toHttpRequest(),l=yield this.apiPost("query",u);return EB.ContractQueryResponse.fromHttpResponse(l)}catch(a){this.handleApiError(a,"query")}})}};c();var _B=(t,e)=>Ce(void 0,null,function*(){let r=yield cd();try{r&&(yield r.login()),Se.run("onLoginPending")}catch(i){let s=Bt(i);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!r)throw new Error("Error: There were problems with auth provider initialization!");let{signature:n}=r.account;if(e&&Te.set("loginToken",e),n&&Te.set("signature",n),t.networkProvider)try{let i=yield r.getAddress();if(!i)throw new Error("Canceled!");return Te.set("address",i),Te.set("loginMethod","browser-extension"),Te.set("expires",Yu()),yield ts(t),Se.run("onLoggedIn"),r}catch(i){console.warn(`Something went wrong trying to synchronize the user account: ${i==null?void 0:i.message}`),Se.run("onLogout")}});c();c();var SR=be(IR()),CR=be(Vl());var GJ=t=>{var r;let e=document.createElement("template");return e.innerHTML=t.trim(),(r=e.content.firstChild)==null?void 0:r.cloneNode(!0)},QJ=t=>{let e=`${qx}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},kJ=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},KJ=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},O_={},zJ=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",O_[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:O_[t.topic].signal}),r},Kg={},WJ=(t,e,r)=>{var o,a;let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${(o=t.peerMetadata)==null?void 0:o.description} (${(a=t.peerMetadata)==null?void 0:a.url})`,n.appendChild(i);let s=zJ(t,e);return n.appendChild(s),Kg[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Kg[t.topic].signal}),n},$J=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},YJ=t=>{if(!t)return;let e=document.getElementById(t);e==null||e.remove()},JJ=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),XJ=t=>Ce(void 0,null,function*(){return t?yield SR.default.toString(t,{type:"svg"}):void 0}),TR=(t,e,r,n)=>Ce(void 0,null,function*(){if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=yield XJ(e),o;if(s&&(o=GJ(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),JJ()&&i.appendChild(QJ(e))),i&&r instanceof CR.WalletConnectV2Provider){let a=r.pairings,u=f=>Ce(void 0,null,function*(){try{f&&(yield r.logout({topic:f}),YJ(f))}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${y}`)}finally{Kg[f].abort()}}),l=f=>Ce(void 0,null,function*(){try{let{approval:d}=yield r.connect({topic:f,methods:["mvx_cancelAction"]});if(!document.getElementById("elven-wc-pairing-item-confirm-msessage")){let w=document.getElementById(f);w==null||w.after($J())}yield r.login({approval:d,token:n})}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to login the user: ${y}`)}finally{for(let d of Object.values(Kg))d==null||d.abort();for(let d of Object.values(O_))d==null||d.abort()}});if(a&&a.length>0){let f=kJ();i.appendChild(f);let d=KJ();f.appendChild(d);for(let y of a){let w=WJ(y,u,l);f.appendChild(w)}}}return i});var zg=be(Vl());var xR=(t,e,r)=>Ce(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let n=Cg(t.initOptions.walletConnectV2RelayAddresses);if(!n||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let i,s={onClientLogin:()=>Ce(void 0,null,function*(){if(t.dappProvider instanceof zg.WalletConnectV2Provider){Se.run("onLoginPending");let a=yield t.dappProvider.getAddress(),u=yield t.dappProvider.getSignature();Te.set("address",a),Te.set("loginMethod","mobile"),Te.set("expires",Yu()),yield ts(t),u&&Te.set("signature",u),r&&Te.set("loginToken",r),Se.run("onLoggedIn"),i==null||i.replaceChildren()}}),onClientLogout:()=>Ce(void 0,null,function*(){t.dappProvider instanceof zg.WalletConnectV2Provider&&(yield $u(t),Se.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new zg.WalletConnectV2Provider(s,yn[t.initOptions.chainType].shortId,n,t.initOptions.walletConnectV2ProjectId);try{if(o){t.dappProvider=o,Se.run("onQrPending"),yield o.init();let{uri:a,approval:u}=yield o.connect({methods:["mvx_cancelAction"]}),l=r?`${a}&token=${r}`:a;return e&&l&&(i=yield TR(e,l,o,r),Se.run("onQrLoaded")),yield o.login({approval:u,token:r}),o}}catch(a){let u=Bt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.run("onLogout")}});c();var NR=be(Kl());var DR=(t,e,r)=>Ce(void 0,null,function*(){let n=new NR.WalletProvider(`${t}${ad}`),i=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=Do({callbackUrl:i},r?{token:r}:{});try{return Se.run("onLoginPending"),Te.set("loginMethod","web-wallet"),yield n.login(s),Te.set("expires",Yu()),r&&Te.set("loginToken",r),n}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Te.set("loginMethod",""),Se.run("onLogout")}});c();var No=t=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var OR=be(Kl());var PR=t=>Ce(void 0,null,function*(){let e=No("signature"),r=No("address"),n=Te.get("address");if(e&&Te.set("signature",e),r||n)return r&&(Te.set("address",r),window.history.replaceState(null,"",window.location.pathname)),new OR.WalletProvider(`${t}${ad}`)});c();var BR=be(Oh()),RR=be(ow());var Wg=(t,e)=>Ce(void 0,null,function*(){Se.run("onTxSent",t),yield new RR.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new BR.Account(n),s=yield e.getAccount(n);i.update(s),Te.set("address",i.address.bech32()),Te.set("nonce",i.getNonceThenIncrement().valueOf()),Te.set("balance",i.balance.toString()),Se.run("onTxFinalized",t)});c();var $g=be(FR()),MR=be(Pc());var UR=(t,e,r)=>Ce(void 0,null,function*(){if(No($g.WALLET_PROVIDER_CALLBACK_PARAM)===$g.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i==null?void 0:i[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=MR.Transaction.fromPlainObject(s);o.setNonce(r);try{Se.run("onTxStarted",o),yield e.sendTransaction(o),yield Wg(o,e)}catch(a){let u=Bt(a);throw Se.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var cf=class{static init(e){return Ce(this,null,function*(){let r=Te.get();if(r.expires&&Sg(r.expires)){Te.clear(),this.dappProvider=void 0;return}this.initOptions=Do({chainType:ud,apiUrl:Ux,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:Vx},e),this.networkProvider=new Rg(this.initOptions),this.initOptions.onLoginPending&&Se.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Se.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Se.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Se.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Se.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Se.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Se.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Se.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Se.set("onTxError",this.initOptions.onTxError),((r==null?void 0:r.address)||r.loginMethod==="web-wallet"&&No("address"))&&(r!=null&&r.loginMethod)&&(Se.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=yield cd()),r.loginMethod==="mobile"&&(this.dappProvider=yield X8(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield PR(yn[this.initOptions.chainType].walletAddress)),yield ts(this),Se.run("onLoggedIn"),r.loginMethod==="web-wallet"&&(yield UR(this.dappProvider,this.networkProvider,r.nonce)))})}static login(e,r){return Ce(this,null,function*(){var i;if(!Object.values(bo).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield _B(this,r==null?void 0:r.token);this.dappProvider=s}if(e==="mobile"){let s=yield xR(this,r==null?void 0:r.qrCodeContainer,r==null?void 0:r.token);this.dappProvider=s}if(e==="web-wallet"&&((i=this.initOptions)!=null&&i.chainType)){let s=yield DR(yn[this.initOptions.chainType].walletAddress,r==null?void 0:r.callbackRoute,r==null?void 0:r.token);this.dappProvider=s}}catch(s){let o=Bt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Ce(this,null,function*(){try{let e=yield $u(this);return this.dappProvider=void 0,e}catch(e){let r=Bt(e);console.warn("Something went wrong when logging out: ",r)}})}static signAndSendTransaction(e){return Ce(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Se.run("onTxStarted",e);let r=Te.get();e.setNonce(r.nonce),this.dappProvider instanceof qR.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof VR.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof HR.WalletProvider&&(yield this.dappProvider.signTransaction(e)),r.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Wg(e,this.networkProvider))}catch(r){let n=Bt(r);throw Se.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e})}static queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(a){let u=Bt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},uf=cf;uf.storage=Te,uf.destroy=()=>{cf.networkProvider=void 0,cf.dappProvider=void 0,cf.initOptions=void 0,Se.clear()};var export_Account=iX.Account;var export_Address=nX.Address;var export_AddressType=QR.AddressType;var export_AddressValue=QR.AddressValue;var export_BigUIntType=Nn.BigUIntType;var export_BigUIntValue=Nn.BigUIntValue;var export_BooleanType=GR.BooleanType;var export_BooleanValue=GR.BooleanValue;var export_BytesType=jR.BytesType;var export_BytesValue=jR.BytesValue;var export_ContractFunction=cX.ContractFunction;var export_GasEstimator=rX.GasEstimator;var export_SmartContract=uX.SmartContract;var export_TokenTransfer=eX.TokenTransfer;var export_Transaction=sX.Transaction;var export_TransactionPayload=oX.TransactionPayload;var export_TransactionWatcher=aX.TransactionWatcher;var export_TransferTransactionsFactory=tX.TransferTransactionsFactory;var export_U16Type=Nn.U16Type;var export_U16Value=Nn.U16Value;var export_U32Type=Nn.U32Type;var export_U32Value=Nn.U32Value;var export_U64Type=Nn.U64Type;var export_U64Value=Nn.U64Value;var export_U8Type=Nn.U8Type;var export_U8Value=Nn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,uf as ElvenJS,export_GasEstimator as GasEstimator,bo as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; /*! Bundled license information: ieee754/index.js: diff --git a/esbuild.config.cjs b/esbuild.config.cjs index 721ab19..217974e 100644 --- a/esbuild.config.cjs +++ b/esbuild.config.cjs @@ -10,7 +10,7 @@ esbuild global: 'global', process: 'process', Buffer: 'Buffer', - 'process.env.NODE_ENV': 'production', + 'process.env.NODE_ENV': '"production"', }, format: 'esm', entryPoints: ['./src/elven.ts'], diff --git a/example/elven.js b/example/elven.js index 9d213ba..d21dd97 100644 --- a/example/elven.js +++ b/example/elven.js @@ -1,13 +1,9 @@ -var zR=Object.create;var uc=Object.defineProperty,WR=Object.defineProperties,$R=Object.getOwnPropertyDescriptor,YR=Object.getOwnPropertyDescriptors,JR=Object.getOwnPropertyNames,R_=Object.getOwnPropertySymbols,XR=Object.getPrototypeOf,F_=Object.prototype.hasOwnProperty,ZR=Object.prototype.propertyIsEnumerable;var L_=(t,e,r)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oo=(t,e)=>{for(var r in e||={})F_.call(e,r)&&L_(t,r,e[r]);if(R_)for(var r of R_(e))ZR.call(e,r)&&L_(t,r,e[r]);return t},M_=(t,e)=>WR(t,YR(e));var U_=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ot=(t,e)=>{for(var r in e)uc(t,r,{get:e[r],enumerable:!0})},lf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of JR(e))!F_.call(t,i)&&i!==r&&uc(t,i,{get:()=>e[i],enumerable:!(n=$R(e,i))||n.enumerable});return t},Lt=(t,e,r)=>(lf(t,e,"default"),r&&lf(r,e,"default")),_e=(t,e,r)=>(r=t!=null?zR(XR(t)):{},lf(e||!t||!t.__esModule?uc(r,"default",{value:t,enumerable:!0}):r,t)),rt=t=>lf(uc({},"__esModule",{value:!0}),t);var Ce=(t,e,r)=>new Promise((n,i)=>{var s=u=>{try{a(r.next(u))}catch(l){i(l)}},o=u=>{try{a(r.throw(u))}catch(l){i(l)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((r=r.apply(t,e)).next())});var j0=v(ff=>{"use strict";c();ff.byteLength=tL;ff.toByteArray=nL;ff.fromByteArray=oL;var Gr=[],lr=[],eL=typeof Uint8Array<"u"?Uint8Array:Array,V0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(us=0,q_=V0.length;us0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function tL(t){var e=V_(t),r=e[0],n=e[1];return(r+n)*3/4-n}function rL(t,e,r){return(e+r)*3/4-r}function nL(t){var e,r=V_(t),n=r[0],i=r[1],s=new eL(rL(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=lr[t.charCodeAt(u)]<<2|lr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=lr[t.charCodeAt(u)]<<10|lr[t.charCodeAt(u+1)]<<4|lr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function iL(t){return Gr[t>>18&63]+Gr[t>>12&63]+Gr[t>>6&63]+Gr[t&63]}function sL(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Gr[e>>2]+Gr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Gr[e>>10]+Gr[e>>4&63]+Gr[e<<2&63]+"=")),i.join("")}});var G0=v(H0=>{c();H0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,y=r?-1:1,w=t[e+d];for(d+=y,s=w&(1<<-f)-1,w>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=y,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=y,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};H0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,E=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=y/u:e+=y*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=N*128}});var Z_=v(Bo=>{"use strict";c();var Q0=j0(),Po=G0(),j_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Bo.Buffer=W;Bo.SlowBuffer=hL;Bo.INSPECT_MAX_BYTES=50;var hf=2147483647;Bo.kMaxLength=hf;W.TYPED_ARRAY_SUPPORT=aL();!W.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function aL(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(W.prototype,"parent",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.buffer}});Object.defineProperty(W.prototype,"offset",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.byteOffset}});function On(t){if(t>hf)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,W.prototype),e}function W(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return W0(t)}return Q_(t,e,r)}W.poolSize=8192;function Q_(t,e,r){if(typeof t=="string")return cL(t,e);if(ArrayBuffer.isView(t))return lL(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Qr(t,ArrayBuffer)||t&&Qr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Qr(t,SharedArrayBuffer)||t&&Qr(t.buffer,SharedArrayBuffer)))return K0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return W.from(n,e,r);var i=fL(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return W.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}W.from=function(t,e,r){return Q_(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function k_(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function uL(t,e,r){return k_(t),t<=0?On(t):e!==void 0?typeof r=="string"?On(t).fill(e,r):On(t).fill(e):On(t)}W.alloc=function(t,e,r){return uL(t,e,r)};function W0(t){return k_(t),On(t<0?0:$0(t)|0)}W.allocUnsafe=function(t){return W0(t)};W.allocUnsafeSlow=function(t){return W0(t)};function cL(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=K_(t,e)|0,n=On(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function k0(t){for(var e=t.length<0?0:$0(t.length)|0,r=On(e),n=0;n=hf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hf.toString(16)+" bytes");return t|0}function hL(t){return+t!=t&&(t=0),W.alloc(+t)}W.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==W.prototype};W.compare=function(e,r){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),Qr(r,Uint8Array)&&(r=W.from(r,r.offset,r.byteLength)),!W.isBuffer(e)||!W.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?W.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(W.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function K_(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Qr(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return X_(t).length;default:if(i)return n?-1:z0(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=K_;function dL(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return bL(this,e,r);case"utf8":case"utf-8":return W_(this,e,r);case"ascii":return AL(this,e,r);case"latin1":case"binary":return _L(this,e,r);case"base64":return EL(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IL(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function cs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}W.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};j_&&(W.prototype[j_]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),!W.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=W.from(e,n)),W.isBuffer(e))return e.length===0?-1:H_(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):H_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function H_(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,y=0;yi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return pL(this,e,r,n);case"utf8":case"utf-8":return gL(this,e,r,n);case"ascii":case"latin1":case"binary":return yL(this,e,r,n);case"base64":return mL(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wL(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};W.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function EL(t,e,r){return e===0&&r===t.length?Q0.fromByteArray(t):Q0.fromByteArray(t.slice(e,r))}function W_(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return vL(n)}var G_=4096;function vL(t){var e=t.length;if(e<=G_)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};W.prototype.readUint8=W.prototype.readUInt8=function(e,r){return e=e>>>0,r||Tt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Tt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Tt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};W.prototype.readUint32BE=W.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Tt(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Tt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Tt(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Tt(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};W.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),Po.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Tt(e,4,this.length),Po.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Tt(e,8,this.length),Po.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Tt(e,8,this.length),Po.read(this,e,!1,52,8)};function Jt(t,e,r,n,i,s){if(!W.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}W.prototype.writeUintLE=W.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,255,0),this[r]=e&255,r+1};W.prototype.writeUint16LE=W.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeUint16BE=W.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeUint32LE=W.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};W.prototype.writeUint32BE=W.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};W.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};W.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function $_(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y_(t,e,r,n,i){return e=+e,r=r>>>0,i||$_(t,e,r,4,34028234663852886e22,-34028234663852886e22),Po.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return Y_(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return Y_(this,e,r,!1,n)};function J_(t,e,r,n,i){return e=+e,r=r>>>0,i||$_(t,e,r,8,17976931348623157e292,-17976931348623157e292),Po.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return J_(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return J_(this,e,r,!1,n)};W.prototype.copy=function(e,r,n,i){if(!W.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function TL(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function X_(t){return Q0.toByteArray(CL(t))}function df(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Qr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Y0(t){return t!==t}var NL=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var ib=v((AX,nb)=>{c();var ft=nb.exports={},kr,Kr;function J0(){throw new Error("setTimeout has not been defined")}function X0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?kr=setTimeout:kr=J0}catch{kr=J0}try{typeof clearTimeout=="function"?Kr=clearTimeout:Kr=X0}catch{Kr=X0}})();function eb(t){if(kr===setTimeout)return setTimeout(t,0);if((kr===J0||!kr)&&setTimeout)return kr=setTimeout,setTimeout(t,0);try{return kr(t,0)}catch{try{return kr.call(null,t,0)}catch{return kr.call(this,t,0)}}}function DL(t){if(Kr===clearTimeout)return clearTimeout(t);if((Kr===X0||!Kr)&&clearTimeout)return Kr=clearTimeout,clearTimeout(t);try{return Kr(t)}catch{try{return Kr.call(null,t)}catch{return Kr.call(this,t)}}}var Pn=[],Ro=!1,ls,pf=-1;function OL(){!Ro||!ls||(Ro=!1,ls.length?Pn=ls.concat(Pn):pf=-1,Pn.length&&tb())}function tb(){if(!Ro){var t=eb(OL);Ro=!0;for(var e=Pn.length;e;){for(ls=Pn,Pn=[];++pf1)for(var r=1;r{h=_e(Z_()),p=_e(ib()),PL=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=PL});var Wt=v((sb,gf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,y=1e9;function w(P){var B,_,S,F=q.prototype={constructor:q,toString:null,valueOf:null},Z=new q(1),K=20,H=4,G=-7,$=21,pe=-1e7,ae=1e7,re=!1,Y=1,ie=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ne="0123456789abcdefghijklmnopqrstuvwxyz";function q(g,m){var A,O,I,D,L,C,U,j,V=this;if(!(V instanceof q))return new q(g,m);if(m==null){if(g&&g._isBigNumber===!0){V.s=g.s,!g.c||g.e>ae?V.c=V.e=null:g.e=10;L/=10,D++);D>ae?V.c=V.e=null:(V.e=D,V.c=[g]);return}j=String(g)}else{if(!r.test(j=String(g)))return S(V,j,C);V.s=j.charCodeAt(0)==45?(j=j.slice(1),-1):1}(D=j.indexOf("."))>-1&&(j=j.replace(".","")),(L=j.search(/e/i))>0?(D<0&&(D=L),D+=+j.slice(L+1),j=j.substring(0,L)):D<0&&(D=j.length)}else{if(M(m,2,ne.length,"Base"),m==10)return V=new q(g),se(V,K+V.e+1,H);if(j=String(g),C=typeof g=="number"){if(g*0!=0)return S(V,j,C,m);if(V.s=1/g<0?(j=j.slice(1),-1):1,q.DEBUG&&j.replace(/^0\.0*|\./,"").length>15)throw Error(o+g)}else V.s=j.charCodeAt(0)===45?(j=j.slice(1),-1):1;for(A=ne.slice(0,m),D=L=0,U=j.length;LD){D=U;continue}}else if(!I&&(j==j.toUpperCase()&&(j=j.toLowerCase())||j==j.toLowerCase()&&(j=j.toUpperCase()))){I=!0,L=-1,D=0;continue}return S(V,String(g),C,m)}C=!1,j=_(j,m,10,V.s),(D=j.indexOf("."))>-1?j=j.replace(".",""):D=j.length}for(L=0;j.charCodeAt(L)===48;L++);for(U=j.length;j.charCodeAt(--U)===48;);if(j=j.slice(L,++U)){if(U-=L,C&&q.DEBUG&&U>15&&(g>l||g!==i(g)))throw Error(o+V.s*g);if((D=D-L-1)>ae)V.c=V.e=null;else if(D=-y&&I<=y&&I===i(I)){if(O[0]===0){if(I===0&&O.length===1)return!0;break e}if(m=(I+1)%u,m<1&&(m+=u),String(O[0]).length==m){for(m=0;m=a||A!==i(A))break e;if(A!==0)return!0}}}else if(O===null&&I===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},q.maximum=q.max=function(){return oe(arguments,F.lt)},q.minimum=q.min=function(){return oe(arguments,F.gt)},q.random=function(){var g=9007199254740992,m=Math.random()*g&2097151?function(){return i(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var O,I,D,L,C,U=0,j=[],V=new q(Z);if(A==null?A=K:M(A,0,y),L=n(A/u),re)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(L*=2));U>>11),C>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),O[U]=I[0],O[U+1]=I[1]):(j.push(C%1e14),U+=2);U=L/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(L*=7);U=9e15?crypto.randomBytes(7).copy(O,U):(j.push(C%1e14),U+=7);U=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;C/=10,U++);UI-1&&(C[L+1]==null&&(C[L+1]=0),C[L+1]+=C[L]/I|0,C[L]%=I)}return C.reverse()}return function(A,O,I,D,L){var C,U,j,V,X,ye,we,Pe,$e=A.indexOf("."),st=K,De=H;for($e>=0&&(V=ie,ie=0,A=A.replace(".",""),Pe=new q(O),ye=Pe.pow(A.length-$e),ie=V,Pe.c=m(T(N(ye.c),ye.e,"0"),10,I,g),Pe.e=Pe.c.length),we=m(A,O,I,L?(C=ne,g):(C=g,ne)),j=V=we.length;we[--V]==0;we.pop());if(!we[0])return C.charAt(0);if($e<0?--j:(ye.c=we,ye.e=j,ye.s=D,ye=B(ye,Pe,st,De,I),we=ye.c,X=ye.r,j=ye.e),U=j+st+1,$e=we[U],V=I/2,X=X||U<0||we[U+1]!=null,X=De<4?($e!=null||X)&&(De==0||De==(ye.s<0?3:2)):$e>V||$e==V&&(De==4||X||De==6&&we[U-1]&1||De==(ye.s<0?8:7)),U<1||!we[0])A=X?T(C.charAt(1),-st,C.charAt(0)):C.charAt(0);else{if(we.length=U,X)for(--I;++we[--U]>I;)we[U]=0,U||(++j,we=[1].concat(we));for(V=we.length;!we[--V];);for($e=0,A="";$e<=V;A+=C.charAt(we[$e++]));A=T(A,j,C.charAt(0))}return A}}(),B=function(){function g(O,I,D){var L,C,U,j,V=0,X=O.length,ye=I%d,we=I/d|0;for(O=O.slice();X--;)U=O[X]%d,j=O[X]/d|0,L=we*U+j*ye,C=ye*U+L%d*d+V,V=(C/D|0)+(L/d|0)+we*j,O[X]=C%D;return V&&(O=[V].concat(O)),O}function m(O,I,D,L){var C,U;if(D!=L)U=D>L?1:-1;else for(C=U=0;CI[C]?1:-1;break}return U}function A(O,I,D,L){for(var C=0;D--;)O[D]-=C,C=O[D]1;O.splice(0,1));}return function(O,I,D,L,C){var U,j,V,X,ye,we,Pe,$e,st,De,Me,vt,ni,os,as,Yt,Dn,qt=O.s==I.s?1:-1,At=O.c,Qe=I.c;if(!At||!At[0]||!Qe||!Qe[0])return new q(!O.s||!I.s||(At?Qe&&At[0]==Qe[0]:!Qe)?NaN:At&&At[0]==0||!Qe?qt*0:qt/0);for($e=new q(qt),st=$e.c=[],j=O.e-I.e,qt=D+j+1,C||(C=a,j=E(O.e/u)-E(I.e/u),qt=qt/u|0),V=0;Qe[V]==(At[V]||0);V++);if(Qe[V]>(At[V]||0)&&j--,qt<0)st.push(1),X=!0;else{for(os=At.length,Yt=Qe.length,V=0,qt+=2,ye=i(C/(Qe[0]+1)),ye>1&&(Qe=g(Qe,ye,C),At=g(At,ye,C),Yt=Qe.length,os=At.length),ni=Yt,De=At.slice(0,Yt),Me=De.length;Me=C/2&&as++;do{if(ye=0,U=m(Qe,De,Yt,Me),U<0){if(vt=De[0],Yt!=Me&&(vt=vt*C+(De[1]||0)),ye=i(vt/as),ye>1)for(ye>=C&&(ye=C-1),we=g(Qe,ye,C),Pe=we.length,Me=De.length;m(we,De,Pe,Me)==1;)ye--,A(we,Yt=10;qt/=10,V++);se($e,D+($e.e=V+j*u-1)+1,L,X)}else $e.e=j,$e.r=+X;return $e}}();function ce(g,m,A,O){var I,D,L,C,U;if(A==null?A=H:M(A,0,8),!g.c)return g.toString();if(I=g.c[0],L=g.e,m==null)U=N(g.c),U=O==1||O==2&&(L<=G||L>=$)?b(U,L):T(U,L,"0");else if(g=se(new q(g),m,A),D=g.e,U=N(g.c),C=U.length,O==1||O==2&&(m<=D||D<=G)){for(;CC){if(--m>0)for(U+=".";m--;U+="0");}else if(m+=D-C,m>0)for(D+1==C&&(U+=".");m--;U+="0");return g.s<0&&I?"-"+U:U}function oe(g,m){for(var A,O=1,I=new q(g[0]);O=10;I/=10,O++);return(A=O+A*u-1)>ae?g.c=g.e=null:A=10;C/=10,I++);if(D=m-I,D<0)D+=u,L=m,U=X[j=0],V=U/ye[I-L-1]%10|0;else if(j=n((D+1)/u),j>=X.length)if(O){for(;X.length<=j;X.push(0));U=V=0,I=1,D%=u,L=D-u+1}else break e;else{for(U=C=X[j],I=1;C>=10;C/=10,I++);D%=u,L=D-u+I,V=L<0?0:U/ye[I-L-1]%10|0}if(O=O||m<0||X[j+1]!=null||(L<0?U:U%ye[I-L-1]),O=A<4?(V||O)&&(A==0||A==(g.s<0?3:2)):V>5||V==5&&(A==4||O||A==6&&(D>0?L>0?U/ye[I-L]:0:X[j-1])%10&1||A==(g.s<0?8:7)),m<1||!X[0])return X.length=0,O?(m-=g.e+1,X[0]=ye[(u-m%u)%u],g.e=-m||0):X[0]=g.e=0,g;if(D==0?(X.length=j,C=1,j--):(X.length=j+1,C=ye[u-D],X[j]=L>0?i(U/ye[I-L]%ye[L])*C:0),O)for(;;)if(j==0){for(D=1,L=X[0];L>=10;L/=10,D++);for(L=X[0]+=C,C=1;L>=10;L/=10,C++);D!=C&&(g.e++,X[0]==a&&(X[0]=1));break}else{if(X[j]+=C,X[j]!=a)break;X[j--]=0,C=1}for(D=X.length;X[--D]===0;X.pop());}g.e>ae?g.c=g.e=null:g.e=$?b(m,A):T(m,A,"0"),g.s<0?"-"+m:m)}return F.absoluteValue=F.abs=function(){var g=new q(this);return g.s<0&&(g.s=1),g},F.comparedTo=function(g,m){return R(this,new q(g,m))},F.decimalPlaces=F.dp=function(g,m){var A,O,I,D=this;if(g!=null)return M(g,0,y),m==null?m=H:M(m,0,8),se(new q(D),g+D.e+1,m);if(!(A=D.c))return null;if(O=((I=A.length-1)-E(this.e/u))*u,I=A[I])for(;I%10==0;I/=10,O--);return O<0&&(O=0),O},F.dividedBy=F.div=function(g,m){return B(this,new q(g,m),K,H)},F.dividedToIntegerBy=F.idiv=function(g,m){return B(this,new q(g,m),0,1)},F.exponentiatedBy=F.pow=function(g,m){var A,O,I,D,L,C,U,j,V,X=this;if(g=new q(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+ue(g));if(m!=null&&(m=new q(m)),C=g.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!g.c||!g.c[0])return V=new q(Math.pow(+ue(X),C?2-x(g):+ue(g))),m?V.mod(m):V;if(U=g.s<0,m){if(m.c?!m.c[0]:!m.s)return new q(NaN);O=!U&&X.isInteger()&&m.isInteger(),O&&(X=X.mod(m))}else{if(g.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||C&&X.c[1]>=24e7:X.c[0]<8e13||C&&X.c[0]<=9999975e7)))return D=X.s<0&&x(g)?-0:0,X.e>-1&&(D=1/D),new q(U?1/D:D);ie&&(D=n(ie/u+2))}for(C?(A=new q(.5),U&&(g.s=1),j=x(g)):(I=Math.abs(+ue(g)),j=I%2),V=new q(Z);;){if(j){if(V=V.times(X),!V.c)break;D?V.c.length>D&&(V.c.length=D):O&&(V=V.mod(m))}if(I){if(I=i(I/2),I===0)break;j=I%2}else if(g=g.times(A),se(g,g.e+1,1),g.e>14)j=x(g);else{if(I=+ue(g),I===0)break;j=I%2}X=X.times(X),D?X.c&&X.c.length>D&&(X.c.length=D):O&&(X=X.mod(m))}return O?V:(U&&(V=Z.div(V)),m?V.mod(m):D?se(V,ie,H,L):V)},F.integerValue=function(g){var m=new q(this);return g==null?g=H:M(g,0,8),se(m,m.e+1,g)},F.isEqualTo=F.eq=function(g,m){return R(this,new q(g,m))===0},F.isFinite=function(){return!!this.c},F.isGreaterThan=F.gt=function(g,m){return R(this,new q(g,m))>0},F.isGreaterThanOrEqualTo=F.gte=function(g,m){return(m=R(this,new q(g,m)))===1||m===0},F.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},F.isLessThan=F.lt=function(g,m){return R(this,new q(g,m))<0},F.isLessThanOrEqualTo=F.lte=function(g,m){return(m=R(this,new q(g,m)))===-1||m===0},F.isNaN=function(){return!this.s},F.isNegative=function(){return this.s<0},F.isPositive=function(){return this.s>0},F.isZero=function(){return!!this.c&&this.c[0]==0},F.minus=function(g,m){var A,O,I,D,L=this,C=L.s;if(g=new q(g,m),m=g.s,!C||!m)return new q(NaN);if(C!=m)return g.s=-m,L.plus(g);var U=L.e/u,j=g.e/u,V=L.c,X=g.c;if(!U||!j){if(!V||!X)return V?(g.s=-m,g):new q(X?L:NaN);if(!V[0]||!X[0])return X[0]?(g.s=-m,g):new q(V[0]?L:H==3?-0:0)}if(U=E(U),j=E(j),V=V.slice(),C=U-j){for((D=C<0)?(C=-C,I=V):(j=U,I=X),I.reverse(),m=C;m--;I.push(0));I.reverse()}else for(O=(D=(C=V.length)<(m=X.length))?C:m,C=m=0;m0)for(;m--;V[A++]=0);for(m=a-1;O>C;){if(V[--O]=0;){for(A=0,ye=vt[I]%st,we=vt[I]/st|0,L=U,D=I+L;D>I;)j=Me[--L]%st,V=Me[L]/st|0,C=we*j+V*ye,j=ye*j+C%st*st+Pe[D]+A,A=(j/$e|0)+(C/st|0)+we*V,Pe[D--]=j%$e;Pe[D]=A}return A?++O:Pe.splice(0,1),le(g,Pe,O)},F.negated=function(){var g=new q(this);return g.s=-g.s||null,g},F.plus=function(g,m){var A,O=this,I=O.s;if(g=new q(g,m),m=g.s,!I||!m)return new q(NaN);if(I!=m)return g.s=-m,O.minus(g);var D=O.e/u,L=g.e/u,C=O.c,U=g.c;if(!D||!L){if(!C||!U)return new q(I/0);if(!C[0]||!U[0])return U[0]?g:new q(C[0]?O:I*0)}if(D=E(D),L=E(L),C=C.slice(),I=D-L){for(I>0?(L=D,A=U):(I=-I,A=C),A.reverse();I--;A.push(0));A.reverse()}for(I=C.length,m=U.length,I-m<0&&(A=U,U=C,C=A,m=I),I=0;m;)I=(C[--m]=C[m]+U[m]+I)/a|0,C[m]=a===C[m]?0:C[m]%a;return I&&(C=[I].concat(C),++L),le(g,C,L)},F.precision=F.sd=function(g,m){var A,O,I,D=this;if(g!=null&&g!==!!g)return M(g,1,y),m==null?m=H:M(m,0,8),se(new q(D),g,m);if(!(A=D.c))return null;if(I=A.length-1,O=I*u+1,I=A[I]){for(;I%10==0;I/=10,O--);for(I=A[0];I>=10;I/=10,O++);}return g&&D.e+1>O&&(O=D.e+1),O},F.shiftedBy=function(g){return M(g,-l,l),this.times("1e"+g)},F.squareRoot=F.sqrt=function(){var g,m,A,O,I,D=this,L=D.c,C=D.s,U=D.e,j=K+4,V=new q("0.5");if(C!==1||!L||!L[0])return new q(!C||C<0&&(!L||L[0])?NaN:L?D:1/0);if(C=Math.sqrt(+ue(D)),C==0||C==1/0?(m=N(L),(m.length+U)%2==0&&(m+="0"),C=Math.sqrt(+m),U=E((U+1)/2)-(U<0||U%2),C==1/0?m="5e"+U:(m=C.toExponential(),m=m.slice(0,m.indexOf("e")+1)+U),A=new q(m)):A=new q(C+""),A.c[0]){for(U=A.e,C=U+j,C<3&&(C=0);;)if(I=A,A=V.times(I.plus(B(D,I,j,1))),N(I.c).slice(0,C)===(m=N(A.c)).slice(0,C))if(A.e0&&Pe>0){for(D=Pe%C||C,V=we.substr(0,D);D0&&(V+=j+we.slice(D)),ye&&(V="-"+V)}O=X?V+(A.decimalSeparator||"")+((U=+A.fractionGroupSize)?X.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):X):V}return(A.prefix||"")+O+(A.suffix||"")},F.toFraction=function(g){var m,A,O,I,D,L,C,U,j,V,X,ye,we=this,Pe=we.c;if(g!=null&&(C=new q(g),!C.isInteger()&&(C.c||C.s!==1)||C.lt(Z)))throw Error(s+"Argument "+(C.isInteger()?"out of range: ":"not an integer: ")+ue(C));if(!Pe)return new q(we);for(m=new q(Z),j=A=new q(Z),O=U=new q(Z),ye=N(Pe),D=m.e=ye.length-we.e-1,m.c[0]=f[(L=D%u)<0?u+L:L],g=!g||C.comparedTo(m)>0?D>0?m:j:C,L=ae,ae=1/0,C=new q(ye),U.c[0]=0;V=B(C,m,0,1),I=A.plus(V.times(O)),I.comparedTo(g)!=1;)A=O,O=I,j=U.plus(V.times(I=j)),U=I,m=C.minus(V.times(I=m)),C=I;return I=B(g.minus(A),O,0,1),U=U.plus(I.times(j)),A=A.plus(I.times(O)),U.s=j.s=we.s,D=D*2,X=B(j,O,D,H).minus(we).abs().comparedTo(B(U,A,D,H).minus(we).abs())<1?[j,O]:[U,A],ae=L,X},F.toNumber=function(){return+ue(this)},F.toPrecision=function(g,m){return g!=null&&M(g,1,y),ce(this,g,m,2)},F.toString=function(g){var m,A=this,O=A.s,I=A.e;return I===null?O?(m="Infinity",O<0&&(m="-"+m)):m="NaN":(g==null?m=I<=G||I>=$?b(N(A.c),I):T(N(A.c),I,"0"):g===10?(A=se(new q(A),K+I+1,H),m=T(N(A.c),A.e,"0")):(M(g,2,ne.length,"Base"),m=_(T(N(A.c),I,"0"),10,g,O,!0)),O<0&&A.c[0]&&(m="-"+m)),m},F.valueOf=F.toJSON=function(){return ue(this)},F._isBigNumber=!0,P!=null&&q.set(P),q}function E(P){var B=P|0;return P>0||P===B?B:B-1}function N(P){for(var B,_,S=1,F=P.length,Z=P[0]+"";S$^_?1:-1;for(H=(G=F.length)<($=Z.length)?G:$,K=0;KZ[K]^_?1:-1;return G==$?0:G>$^_?1:-1}function M(P,B,_,S){if(P_||P!==i(P))throw Error(s+(S||"Argument")+(typeof P=="number"?P_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(P))}function x(P){var B=P.c.length-1;return E(P.e/u)==B&&P.c[B]%2!=0}function b(P,B){return(P.length>1?P.charAt(0)+"."+P.slice(1):P)+(B<0?"e":"e+")+B}function T(P,B,_){var S,F;if(B<0){for(F=_+".";++B;F+=_);P=F+P}else if(S=P.length,++B>S){for(F=_,B-=S;--B;F+=_);P+=F}else B{"use strict";c();Object.defineProperty(fe,"__esModule",{value:!0});fe.ErrGasLimitShouldBe0ForInnerTransaction=fe.ErrInvalidRelayedV2BuilderArguments=fe.ErrInvalidRelayedV1BuilderArguments=fe.ErrNotImplemented=fe.ErrContractInteraction=fe.ErrCodec=fe.ErrCannotParseTransactionOutcome=fe.ErrCannotParseContractResults=fe.ErrMissingFieldOnEnum=fe.ErrMissingFieldOnStruct=fe.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=fe.ErrTypingSystem=fe.ErrMock=fe.ErrContractHasNoAddress=fe.ErrContract=fe.ErrExpectedTransactionEventsNotFound=fe.ErrExpectedTransactionStatusNotReached=fe.ErrTransactionWatcherTimeout=fe.ErrAsyncTimerAborted=fe.ErrAsyncTimerAlreadyRunning=fe.ErrInvalidFunctionName=fe.ErrSignatureCannotCreate=fe.ErrTransactionOptionsInvalid=fe.ErrTransactionVersionInvalid=fe.ErrNonceInvalid=fe.ErrNotEnoughGas=fe.ErrAddressEmpty=fe.ErrAddressBadHrp=fe.ErrAddressCannotCreate=fe.ErrUnexpectedCondition=fe.ErrInvariantFailed=fe.ErrBadType=fe.ErrUnsupportedOperation=fe.ErrInvalidArgument=fe.Err=void 0;var Be=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};fe.Err=Be;var Z0=class extends Be{constructor(e,r){super(`Invalid argument: ${e}`,r)}};fe.ErrInvalidArgument=Z0;var ey=class extends Be{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};fe.ErrUnsupportedOperation=ey;var ty=class extends Be{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};fe.ErrBadType=ty;var ry=class extends Be{constructor(e){super(`Invariant failed: [${e}]`)}};fe.ErrInvariantFailed=ry;var ny=class extends Be{constructor(e){super(`Unexpected condition: [${e}]`)}};fe.ErrUnexpectedCondition=ny;var iy=class extends Be{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};fe.ErrAddressCannotCreate=iy;var sy=class extends Be{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};fe.ErrAddressBadHrp=sy;var oy=class extends Be{constructor(){super("Address is empty")}};fe.ErrAddressEmpty=oy;var ay=class extends Be{constructor(e){super(`Not enough gas provided: ${e}`)}};fe.ErrNotEnoughGas=ay;var uy=class extends Be{constructor(e){super(`Invalid nonce: ${e}`)}};fe.ErrNonceInvalid=uy;var cy=class extends Be{constructor(e){super(`Invalid transaction version: ${e}`)}};fe.ErrTransactionVersionInvalid=cy;var ly=class extends Be{constructor(e){super(`Invalid transaction options: ${e}`)}};fe.ErrTransactionOptionsInvalid=ly;var fy=class extends Be{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};fe.ErrSignatureCannotCreate=fy;var hy=class extends Be{constructor(){super("Invalid function name")}};fe.ErrInvalidFunctionName=hy;var dy=class extends Be{constructor(){super("Async timer already running")}};fe.ErrAsyncTimerAlreadyRunning=dy;var py=class extends Be{constructor(){super("Async timer aborted")}};fe.ErrAsyncTimerAborted=py;var gy=class extends Be{constructor(){super("TransactionWatcher has timed out")}};fe.ErrTransactionWatcherTimeout=gy;var yy=class extends Be{constructor(){super("Expected transaction status not reached")}};fe.ErrExpectedTransactionStatusNotReached=yy;var my=class extends Be{constructor(){super("Expected transaction events not found")}};fe.ErrExpectedTransactionEventsNotFound=my;var yf=class extends Be{constructor(e){super(e)}};fe.ErrContract=yf;var wy=class extends yf{constructor(){super(` +var kR=Object.create;var uc=Object.defineProperty,KR=Object.defineProperties,zR=Object.getOwnPropertyDescriptor,WR=Object.getOwnPropertyDescriptors,$R=Object.getOwnPropertyNames,P_=Object.getOwnPropertySymbols,YR=Object.getPrototypeOf,R_=Object.prototype.hasOwnProperty,JR=Object.prototype.propertyIsEnumerable;var B_=(t,e,r)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Do=(t,e)=>{for(var r in e||={})R_.call(e,r)&&B_(t,r,e[r]);if(P_)for(var r of P_(e))JR.call(e,r)&&B_(t,r,e[r]);return t},L_=(t,e)=>KR(t,WR(e));var F_=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),at=(t,e)=>{for(var r in e)uc(t,r,{get:e[r],enumerable:!0})},lf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $R(e))!R_.call(t,i)&&i!==r&&uc(t,i,{get:()=>e[i],enumerable:!(n=zR(e,i))||n.enumerable});return t},Lt=(t,e,r)=>(lf(t,e,"default"),r&&lf(r,e,"default")),be=(t,e,r)=>(r=t!=null?kR(YR(t)):{},lf(e||!t||!t.__esModule?uc(r,"default",{value:t,enumerable:!0}):r,t)),nt=t=>lf(uc({},"__esModule",{value:!0}),t);var Ce=(t,e,r)=>new Promise((n,i)=>{var s=u=>{try{a(r.next(u))}catch(l){i(l)}},o=u=>{try{a(r.throw(u))}catch(l){i(l)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((r=r.apply(t,e)).next())});var q0=v(ff=>{"use strict";c();ff.byteLength=ZR;ff.toByteArray=tL;ff.fromByteArray=iL;var Gr=[],lr=[],XR=typeof Uint8Array<"u"?Uint8Array:Array,U0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ls=0,M_=U0.length;ls0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function ZR(t){var e=U_(t),r=e[0],n=e[1];return(r+n)*3/4-n}function eL(t,e,r){return(e+r)*3/4-r}function tL(t){var e,r=U_(t),n=r[0],i=r[1],s=new XR(eL(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=lr[t.charCodeAt(u)]<<2|lr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=lr[t.charCodeAt(u)]<<10|lr[t.charCodeAt(u+1)]<<4|lr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function rL(t){return Gr[t>>18&63]+Gr[t>>12&63]+Gr[t>>6&63]+Gr[t&63]}function nL(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Gr[e>>2]+Gr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Gr[e>>10]+Gr[e>>4&63]+Gr[e<<2&63]+"=")),i.join("")}});var H0=v(V0=>{c();V0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,y=r?-1:1,w=t[e+d];for(d+=y,s=w&(1<<-f)-1,w>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=y,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=y,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};V0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,E=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=y/u:e+=y*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=T*128}});var J_=v(Po=>{"use strict";c();var j0=q0(),Oo=H0(),q_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Po.Buffer=W;Po.SlowBuffer=lL;Po.INSPECT_MAX_BYTES=50;var hf=2147483647;Po.kMaxLength=hf;W.TYPED_ARRAY_SUPPORT=sL();!W.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sL(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(W.prototype,"parent",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.buffer}});Object.defineProperty(W.prototype,"offset",{enumerable:!0,get:function(){if(W.isBuffer(this))return this.byteOffset}});function On(t){if(t>hf)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,W.prototype),e}function W(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return K0(t)}return j_(t,e,r)}W.poolSize=8192;function j_(t,e,r){if(typeof t=="string")return aL(t,e);if(ArrayBuffer.isView(t))return uL(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Qr(t,ArrayBuffer)||t&&Qr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Qr(t,SharedArrayBuffer)||t&&Qr(t.buffer,SharedArrayBuffer)))return Q0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return W.from(n,e,r);var i=cL(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return W.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}W.from=function(t,e,r){return j_(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function G_(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function oL(t,e,r){return G_(t),t<=0?On(t):e!==void 0?typeof r=="string"?On(t).fill(e,r):On(t).fill(e):On(t)}W.alloc=function(t,e,r){return oL(t,e,r)};function K0(t){return G_(t),On(t<0?0:z0(t)|0)}W.allocUnsafe=function(t){return K0(t)};W.allocUnsafeSlow=function(t){return K0(t)};function aL(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=Q_(t,e)|0,n=On(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function G0(t){for(var e=t.length<0?0:z0(t.length)|0,r=On(e),n=0;n=hf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hf.toString(16)+" bytes");return t|0}function lL(t){return+t!=t&&(t=0),W.alloc(+t)}W.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==W.prototype};W.compare=function(e,r){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),Qr(r,Uint8Array)&&(r=W.from(r,r.offset,r.byteLength)),!W.isBuffer(e)||!W.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?W.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(W.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function Q_(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Qr(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Y_(t).length;default:if(i)return n?-1:k0(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=Q_;function fL(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return AL(this,e,r);case"utf8":case"utf-8":return K_(this,e,r);case"ascii":return EL(this,e,r);case"latin1":case"binary":return vL(this,e,r);case"base64":return mL(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function fs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}W.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};q_&&(W.prototype[q_]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(Qr(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),!W.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,W0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=W.from(e,n)),W.isBuffer(e))return e.length===0?-1:V_(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):V_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function V_(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,y=0;yi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return hL(this,e,r,n);case"utf8":case"utf-8":return dL(this,e,r,n);case"ascii":case"latin1":case"binary":return pL(this,e,r,n);case"base64":return gL(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yL(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};W.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mL(t,e,r){return e===0&&r===t.length?j0.fromByteArray(t):j0.fromByteArray(t.slice(e,r))}function K_(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return wL(n)}var H_=4096;function wL(t){var e=t.length;if(e<=H_)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};W.prototype.readUint8=W.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};W.prototype.readUint32BE=W.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};W.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Oo.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Oo.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Oo.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Oo.read(this,e,!1,52,8)};function Jt(t,e,r,n,i,s){if(!W.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}W.prototype.writeUintLE=W.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Jt(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,255,0),this[r]=e&255,r+1};W.prototype.writeUint16LE=W.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeUint16BE=W.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeUint32LE=W.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};W.prototype.writeUint32BE=W.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Jt(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};W.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};W.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};W.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};W.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Jt(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function z_(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function W_(t,e,r,n,i){return e=+e,r=r>>>0,i||z_(t,e,r,4,34028234663852886e22,-34028234663852886e22),Oo.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return W_(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return W_(this,e,r,!1,n)};function $_(t,e,r,n,i){return e=+e,r=r>>>0,i||z_(t,e,r,8,17976931348623157e292,-17976931348623157e292),Oo.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return $_(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return $_(this,e,r,!1,n)};W.prototype.copy=function(e,r,n,i){if(!W.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function SL(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Y_(t){return j0.toByteArray(IL(t))}function df(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Qr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function W0(t){return t!==t}var TL=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var rb=v((mX,tb)=>{c();var ft=tb.exports={},kr,Kr;function $0(){throw new Error("setTimeout has not been defined")}function Y0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?kr=setTimeout:kr=$0}catch{kr=$0}try{typeof clearTimeout=="function"?Kr=clearTimeout:Kr=Y0}catch{Kr=Y0}})();function X_(t){if(kr===setTimeout)return setTimeout(t,0);if((kr===$0||!kr)&&setTimeout)return kr=setTimeout,setTimeout(t,0);try{return kr(t,0)}catch{try{return kr.call(null,t,0)}catch{return kr.call(this,t,0)}}}function xL(t){if(Kr===clearTimeout)return clearTimeout(t);if((Kr===Y0||!Kr)&&clearTimeout)return Kr=clearTimeout,clearTimeout(t);try{return Kr(t)}catch{try{return Kr.call(null,t)}catch{return Kr.call(this,t)}}}var Pn=[],Bo=!1,hs,pf=-1;function NL(){!Bo||!hs||(Bo=!1,hs.length?Pn=hs.concat(Pn):pf=-1,Pn.length&&Z_())}function Z_(){if(!Bo){var t=X_(NL);Bo=!0;for(var e=Pn.length;e;){for(hs=Pn,Pn=[];++pf1)for(var r=1;r{h=be(J_()),p=be(rb()),DL=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=DL});var Wt=v((nb,gf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,y=1e9;function w(P){var L,b,C,M=q.prototype={constructor:q,toString:null,valueOf:null},Z=new q(1),K=20,j=4,G=-7,$=21,de=-1e7,ae=1e7,re=!1,Y=1,ie=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ne="0123456789abcdefghijklmnopqrstuvwxyz";function q(g,m){var A,D,I,N,F,S,U,H,V=this;if(!(V instanceof q))return new q(g,m);if(m==null){if(g&&g._isBigNumber===!0){V.s=g.s,!g.c||g.e>ae?V.c=V.e=null:g.e=10;F/=10,N++);N>ae?V.c=V.e=null:(V.e=N,V.c=[g]);return}H=String(g)}else{if(!r.test(H=String(g)))return C(V,H,S);V.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(N=H.indexOf("."))>-1&&(H=H.replace(".","")),(F=H.search(/e/i))>0?(N<0&&(N=F),N+=+H.slice(F+1),H=H.substring(0,F)):N<0&&(N=H.length)}else{if(_(m,2,ne.length,"Base"),m==10)return V=new q(g),se(V,K+V.e+1,j);if(H=String(g),S=typeof g=="number"){if(g*0!=0)return C(V,H,S,m);if(V.s=1/g<0?(H=H.slice(1),-1):1,q.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+g)}else V.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(A=ne.slice(0,m),N=F=0,U=H.length;FN){N=U;continue}}else if(!I&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){I=!0,F=-1,N=0;continue}return C(V,String(g),S,m)}S=!1,H=b(H,m,10,V.s),(N=H.indexOf("."))>-1?H=H.replace(".",""):N=H.length}for(F=0;H.charCodeAt(F)===48;F++);for(U=H.length;H.charCodeAt(--U)===48;);if(H=H.slice(F,++U)){if(U-=F,S&&q.DEBUG&&U>15&&(g>l||g!==i(g)))throw Error(o+V.s*g);if((N=N-F-1)>ae)V.c=V.e=null;else if(N=-y&&I<=y&&I===i(I)){if(D[0]===0){if(I===0&&D.length===1)return!0;break e}if(m=(I+1)%u,m<1&&(m+=u),String(D[0]).length==m){for(m=0;m=a||A!==i(A))break e;if(A!==0)return!0}}}else if(D===null&&I===null&&(N===null||N===1||N===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},q.maximum=q.max=function(){return oe(arguments,M.lt)},q.minimum=q.min=function(){return oe(arguments,M.gt)},q.random=function(){var g=9007199254740992,m=Math.random()*g&2097151?function(){return i(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var D,I,N,F,S,U=0,H=[],V=new q(Z);if(A==null?A=K:_(A,0,y),F=n(A/u),re)if(crypto.getRandomValues){for(D=crypto.getRandomValues(new Uint32Array(F*=2));U>>11),S>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),D[U]=I[0],D[U+1]=I[1]):(H.push(S%1e14),U+=2);U=F/2}else if(crypto.randomBytes){for(D=crypto.randomBytes(F*=7);U=9e15?crypto.randomBytes(7).copy(D,U):(H.push(S%1e14),U+=7);U=F/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;S/=10,U++);UI-1&&(S[F+1]==null&&(S[F+1]=0),S[F+1]+=S[F]/I|0,S[F]%=I)}return S.reverse()}return function(A,D,I,N,F){var S,U,H,V,X,ye,we,Pe,$e=A.indexOf("."),ot=K,De=j;for($e>=0&&(V=ie,ie=0,A=A.replace(".",""),Pe=new q(D),ye=Pe.pow(A.length-$e),ie=V,Pe.c=m(O(T(ye.c),ye.e,"0"),10,I,g),Pe.e=Pe.c.length),we=m(A,D,I,F?(S=ne,g):(S=g,ne)),H=V=we.length;we[--V]==0;we.pop());if(!we[0])return S.charAt(0);if($e<0?--H:(ye.c=we,ye.e=H,ye.s=N,ye=L(ye,Pe,ot,De,I),we=ye.c,X=ye.r,H=ye.e),U=H+ot+1,$e=we[U],V=I/2,X=X||U<0||we[U+1]!=null,X=De<4?($e!=null||X)&&(De==0||De==(ye.s<0?3:2)):$e>V||$e==V&&(De==4||X||De==6&&we[U-1]&1||De==(ye.s<0?8:7)),U<1||!we[0])A=X?O(S.charAt(1),-ot,S.charAt(0)):S.charAt(0);else{if(we.length=U,X)for(--I;++we[--U]>I;)we[U]=0,U||(++H,we=[1].concat(we));for(V=we.length;!we[--V];);for($e=0,A="";$e<=V;A+=S.charAt(we[$e++]));A=O(A,H,S.charAt(0))}return A}}(),L=function(){function g(D,I,N){var F,S,U,H,V=0,X=D.length,ye=I%d,we=I/d|0;for(D=D.slice();X--;)U=D[X]%d,H=D[X]/d|0,F=we*U+H*ye,S=ye*U+F%d*d+V,V=(S/N|0)+(F/d|0)+we*H,D[X]=S%N;return V&&(D=[V].concat(D)),D}function m(D,I,N,F){var S,U;if(N!=F)U=N>F?1:-1;else for(S=U=0;SI[S]?1:-1;break}return U}function A(D,I,N,F){for(var S=0;N--;)D[N]-=S,S=D[N]1;D.splice(0,1));}return function(D,I,N,F,S){var U,H,V,X,ye,we,Pe,$e,ot,De,Me,vt,ni,us,cs,Yt,Dn,qt=D.s==I.s?1:-1,At=D.c,Qe=I.c;if(!At||!At[0]||!Qe||!Qe[0])return new q(!D.s||!I.s||(At?Qe&&At[0]==Qe[0]:!Qe)?NaN:At&&At[0]==0||!Qe?qt*0:qt/0);for($e=new q(qt),ot=$e.c=[],H=D.e-I.e,qt=N+H+1,S||(S=a,H=E(D.e/u)-E(I.e/u),qt=qt/u|0),V=0;Qe[V]==(At[V]||0);V++);if(Qe[V]>(At[V]||0)&&H--,qt<0)ot.push(1),X=!0;else{for(us=At.length,Yt=Qe.length,V=0,qt+=2,ye=i(S/(Qe[0]+1)),ye>1&&(Qe=g(Qe,ye,S),At=g(At,ye,S),Yt=Qe.length,us=At.length),ni=Yt,De=At.slice(0,Yt),Me=De.length;Me=S/2&&cs++;do{if(ye=0,U=m(Qe,De,Yt,Me),U<0){if(vt=De[0],Yt!=Me&&(vt=vt*S+(De[1]||0)),ye=i(vt/cs),ye>1)for(ye>=S&&(ye=S-1),we=g(Qe,ye,S),Pe=we.length,Me=De.length;m(we,De,Pe,Me)==1;)ye--,A(we,Yt=10;qt/=10,V++);se($e,N+($e.e=V+H*u-1)+1,F,X)}else $e.e=H,$e.r=+X;return $e}}();function ce(g,m,A,D){var I,N,F,S,U;if(A==null?A=j:_(A,0,8),!g.c)return g.toString();if(I=g.c[0],F=g.e,m==null)U=T(g.c),U=D==1||D==2&&(F<=G||F>=$)?x(U,F):O(U,F,"0");else if(g=se(new q(g),m,A),N=g.e,U=T(g.c),S=U.length,D==1||D==2&&(m<=N||N<=G)){for(;SS){if(--m>0)for(U+=".";m--;U+="0");}else if(m+=N-S,m>0)for(N+1==S&&(U+=".");m--;U+="0");return g.s<0&&I?"-"+U:U}function oe(g,m){for(var A,D=1,I=new q(g[0]);D=10;I/=10,D++);return(A=D+A*u-1)>ae?g.c=g.e=null:A=10;S/=10,I++);if(N=m-I,N<0)N+=u,F=m,U=X[H=0],V=U/ye[I-F-1]%10|0;else if(H=n((N+1)/u),H>=X.length)if(D){for(;X.length<=H;X.push(0));U=V=0,I=1,N%=u,F=N-u+1}else break e;else{for(U=S=X[H],I=1;S>=10;S/=10,I++);N%=u,F=N-u+I,V=F<0?0:U/ye[I-F-1]%10|0}if(D=D||m<0||X[H+1]!=null||(F<0?U:U%ye[I-F-1]),D=A<4?(V||D)&&(A==0||A==(g.s<0?3:2)):V>5||V==5&&(A==4||D||A==6&&(N>0?F>0?U/ye[I-F]:0:X[H-1])%10&1||A==(g.s<0?8:7)),m<1||!X[0])return X.length=0,D?(m-=g.e+1,X[0]=ye[(u-m%u)%u],g.e=-m||0):X[0]=g.e=0,g;if(N==0?(X.length=H,S=1,H--):(X.length=H+1,S=ye[u-N],X[H]=F>0?i(U/ye[I-F]%ye[F])*S:0),D)for(;;)if(H==0){for(N=1,F=X[0];F>=10;F/=10,N++);for(F=X[0]+=S,S=1;F>=10;F/=10,S++);N!=S&&(g.e++,X[0]==a&&(X[0]=1));break}else{if(X[H]+=S,X[H]!=a)break;X[H--]=0,S=1}for(N=X.length;X[--N]===0;X.pop());}g.e>ae?g.c=g.e=null:g.e=$?x(m,A):O(m,A,"0"),g.s<0?"-"+m:m)}return M.absoluteValue=M.abs=function(){var g=new q(this);return g.s<0&&(g.s=1),g},M.comparedTo=function(g,m){return R(this,new q(g,m))},M.decimalPlaces=M.dp=function(g,m){var A,D,I,N=this;if(g!=null)return _(g,0,y),m==null?m=j:_(m,0,8),se(new q(N),g+N.e+1,m);if(!(A=N.c))return null;if(D=((I=A.length-1)-E(this.e/u))*u,I=A[I])for(;I%10==0;I/=10,D--);return D<0&&(D=0),D},M.dividedBy=M.div=function(g,m){return L(this,new q(g,m),K,j)},M.dividedToIntegerBy=M.idiv=function(g,m){return L(this,new q(g,m),0,1)},M.exponentiatedBy=M.pow=function(g,m){var A,D,I,N,F,S,U,H,V,X=this;if(g=new q(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+ue(g));if(m!=null&&(m=new q(m)),S=g.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!g.c||!g.c[0])return V=new q(Math.pow(+ue(X),S?2-B(g):+ue(g))),m?V.mod(m):V;if(U=g.s<0,m){if(m.c?!m.c[0]:!m.s)return new q(NaN);D=!U&&X.isInteger()&&m.isInteger(),D&&(X=X.mod(m))}else{if(g.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||S&&X.c[1]>=24e7:X.c[0]<8e13||S&&X.c[0]<=9999975e7)))return N=X.s<0&&B(g)?-0:0,X.e>-1&&(N=1/N),new q(U?1/N:N);ie&&(N=n(ie/u+2))}for(S?(A=new q(.5),U&&(g.s=1),H=B(g)):(I=Math.abs(+ue(g)),H=I%2),V=new q(Z);;){if(H){if(V=V.times(X),!V.c)break;N?V.c.length>N&&(V.c.length=N):D&&(V=V.mod(m))}if(I){if(I=i(I/2),I===0)break;H=I%2}else if(g=g.times(A),se(g,g.e+1,1),g.e>14)H=B(g);else{if(I=+ue(g),I===0)break;H=I%2}X=X.times(X),N?X.c&&X.c.length>N&&(X.c.length=N):D&&(X=X.mod(m))}return D?V:(U&&(V=Z.div(V)),m?V.mod(m):N?se(V,ie,j,F):V)},M.integerValue=function(g){var m=new q(this);return g==null?g=j:_(g,0,8),se(m,m.e+1,g)},M.isEqualTo=M.eq=function(g,m){return R(this,new q(g,m))===0},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(g,m){return R(this,new q(g,m))>0},M.isGreaterThanOrEqualTo=M.gte=function(g,m){return(m=R(this,new q(g,m)))===1||m===0},M.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},M.isLessThan=M.lt=function(g,m){return R(this,new q(g,m))<0},M.isLessThanOrEqualTo=M.lte=function(g,m){return(m=R(this,new q(g,m)))===-1||m===0},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&this.c[0]==0},M.minus=function(g,m){var A,D,I,N,F=this,S=F.s;if(g=new q(g,m),m=g.s,!S||!m)return new q(NaN);if(S!=m)return g.s=-m,F.plus(g);var U=F.e/u,H=g.e/u,V=F.c,X=g.c;if(!U||!H){if(!V||!X)return V?(g.s=-m,g):new q(X?F:NaN);if(!V[0]||!X[0])return X[0]?(g.s=-m,g):new q(V[0]?F:j==3?-0:0)}if(U=E(U),H=E(H),V=V.slice(),S=U-H){for((N=S<0)?(S=-S,I=V):(H=U,I=X),I.reverse(),m=S;m--;I.push(0));I.reverse()}else for(D=(N=(S=V.length)<(m=X.length))?S:m,S=m=0;m0)for(;m--;V[A++]=0);for(m=a-1;D>S;){if(V[--D]=0;){for(A=0,ye=vt[I]%ot,we=vt[I]/ot|0,F=U,N=I+F;N>I;)H=Me[--F]%ot,V=Me[F]/ot|0,S=we*H+V*ye,H=ye*H+S%ot*ot+Pe[N]+A,A=(H/$e|0)+(S/ot|0)+we*V,Pe[N--]=H%$e;Pe[N]=A}return A?++D:Pe.splice(0,1),le(g,Pe,D)},M.negated=function(){var g=new q(this);return g.s=-g.s||null,g},M.plus=function(g,m){var A,D=this,I=D.s;if(g=new q(g,m),m=g.s,!I||!m)return new q(NaN);if(I!=m)return g.s=-m,D.minus(g);var N=D.e/u,F=g.e/u,S=D.c,U=g.c;if(!N||!F){if(!S||!U)return new q(I/0);if(!S[0]||!U[0])return U[0]?g:new q(S[0]?D:I*0)}if(N=E(N),F=E(F),S=S.slice(),I=N-F){for(I>0?(F=N,A=U):(I=-I,A=S),A.reverse();I--;A.push(0));A.reverse()}for(I=S.length,m=U.length,I-m<0&&(A=U,U=S,S=A,m=I),I=0;m;)I=(S[--m]=S[m]+U[m]+I)/a|0,S[m]=a===S[m]?0:S[m]%a;return I&&(S=[I].concat(S),++F),le(g,S,F)},M.precision=M.sd=function(g,m){var A,D,I,N=this;if(g!=null&&g!==!!g)return _(g,1,y),m==null?m=j:_(m,0,8),se(new q(N),g,m);if(!(A=N.c))return null;if(I=A.length-1,D=I*u+1,I=A[I]){for(;I%10==0;I/=10,D--);for(I=A[0];I>=10;I/=10,D++);}return g&&N.e+1>D&&(D=N.e+1),D},M.shiftedBy=function(g){return _(g,-l,l),this.times("1e"+g)},M.squareRoot=M.sqrt=function(){var g,m,A,D,I,N=this,F=N.c,S=N.s,U=N.e,H=K+4,V=new q("0.5");if(S!==1||!F||!F[0])return new q(!S||S<0&&(!F||F[0])?NaN:F?N:1/0);if(S=Math.sqrt(+ue(N)),S==0||S==1/0?(m=T(F),(m.length+U)%2==0&&(m+="0"),S=Math.sqrt(+m),U=E((U+1)/2)-(U<0||U%2),S==1/0?m="5e"+U:(m=S.toExponential(),m=m.slice(0,m.indexOf("e")+1)+U),A=new q(m)):A=new q(S+""),A.c[0]){for(U=A.e,S=U+H,S<3&&(S=0);;)if(I=A,A=V.times(I.plus(L(N,I,H,1))),T(I.c).slice(0,S)===(m=T(A.c)).slice(0,S))if(A.e0&&Pe>0){for(N=Pe%S||S,V=we.substr(0,N);N0&&(V+=H+we.slice(N)),ye&&(V="-"+V)}D=X?V+(A.decimalSeparator||"")+((U=+A.fractionGroupSize)?X.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):X):V}return(A.prefix||"")+D+(A.suffix||"")},M.toFraction=function(g){var m,A,D,I,N,F,S,U,H,V,X,ye,we=this,Pe=we.c;if(g!=null&&(S=new q(g),!S.isInteger()&&(S.c||S.s!==1)||S.lt(Z)))throw Error(s+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+ue(S));if(!Pe)return new q(we);for(m=new q(Z),H=A=new q(Z),D=U=new q(Z),ye=T(Pe),N=m.e=ye.length-we.e-1,m.c[0]=f[(F=N%u)<0?u+F:F],g=!g||S.comparedTo(m)>0?N>0?m:H:S,F=ae,ae=1/0,S=new q(ye),U.c[0]=0;V=L(S,m,0,1),I=A.plus(V.times(D)),I.comparedTo(g)!=1;)A=D,D=I,H=U.plus(V.times(I=H)),U=I,m=S.minus(V.times(I=m)),S=I;return I=L(g.minus(A),D,0,1),U=U.plus(I.times(H)),A=A.plus(I.times(D)),U.s=H.s=we.s,N=N*2,X=L(H,D,N,j).minus(we).abs().comparedTo(L(U,A,N,j).minus(we).abs())<1?[H,D]:[U,A],ae=F,X},M.toNumber=function(){return+ue(this)},M.toPrecision=function(g,m){return g!=null&&_(g,1,y),ce(this,g,m,2)},M.toString=function(g){var m,A=this,D=A.s,I=A.e;return I===null?D?(m="Infinity",D<0&&(m="-"+m)):m="NaN":(g==null?m=I<=G||I>=$?x(T(A.c),I):O(T(A.c),I,"0"):g===10?(A=se(new q(A),K+I+1,j),m=O(T(A.c),A.e,"0")):(_(g,2,ne.length,"Base"),m=b(O(T(A.c),I,"0"),10,g,D,!0)),D<0&&A.c[0]&&(m="-"+m)),m},M.valueOf=M.toJSON=function(){return ue(this)},M._isBigNumber=!0,P!=null&&q.set(P),q}function E(P){var L=P|0;return P>0||P===L?L:L-1}function T(P){for(var L,b,C=1,M=P.length,Z=P[0]+"";C$^b?1:-1;for(j=(G=M.length)<($=Z.length)?G:$,K=0;KZ[K]^b?1:-1;return G==$?0:G>$^b?1:-1}function _(P,L,b,C){if(Pb||P!==i(P))throw Error(s+(C||"Argument")+(typeof P=="number"?Pb?" out of range: ":" not an integer: ":" not a primitive number: ")+String(P))}function B(P){var L=P.c.length-1;return E(P.e/u)==L&&P.c[L]%2!=0}function x(P,L){return(P.length>1?P.charAt(0)+"."+P.slice(1):P)+(L<0?"e":"e+")+L}function O(P,L,b){var C,M;if(L<0){for(M=b+".";++L;M+=b);P=M+P}else if(C=P.length,++L>C){for(M=b,L-=C;--L;M+=b);P+=M}else L{"use strict";c();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrGasLimitShouldBe0ForInnerTransaction=pe.ErrInvalidRelayedV2BuilderArguments=pe.ErrInvalidRelayedV1BuilderArguments=pe.ErrNotImplemented=pe.ErrContractInteraction=pe.ErrCodec=pe.ErrCannotParseTransactionOutcome=pe.ErrCannotParseContractResults=pe.ErrMissingFieldOnEnum=pe.ErrMissingFieldOnStruct=pe.ErrTypingSystem=pe.ErrMock=pe.ErrContractHasNoAddress=pe.ErrContract=pe.ErrExpectedTransactionEventsNotFound=pe.ErrExpectedTransactionStatusNotReached=pe.ErrTransactionWatcherTimeout=pe.ErrAsyncTimerAborted=pe.ErrAsyncTimerAlreadyRunning=pe.ErrInvalidFunctionName=pe.ErrSignatureCannotCreate=pe.ErrTransactionOptionsInvalid=pe.ErrTransactionVersionInvalid=pe.ErrNonceInvalid=pe.ErrNotEnoughGas=pe.ErrAddressEmpty=pe.ErrAddressBadHrp=pe.ErrAddressCannotCreate=pe.ErrUnexpectedCondition=pe.ErrInvariantFailed=pe.ErrBadType=pe.ErrUnsupportedOperation=pe.ErrInvalidArgument=pe.Err=void 0;var Be=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};pe.Err=Be;var J0=class extends Be{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=J0;var X0=class extends Be{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=X0;var Z0=class extends Be{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=Z0;var ey=class extends Be{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=ey;var ty=class extends Be{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=ty;var ry=class extends Be{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=ry;var ny=class extends Be{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=ny;var iy=class extends Be{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=iy;var sy=class extends Be{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=sy;var oy=class extends Be{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=oy;var ay=class extends Be{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=ay;var uy=class extends Be{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=uy;var cy=class extends Be{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=cy;var ly=class extends Be{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=ly;var fy=class extends Be{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=fy;var hy=class extends Be{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=hy;var dy=class extends Be{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=dy;var py=class extends Be{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=py;var gy=class extends Be{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=gy;var yf=class extends Be{constructor(e){super(e)}};pe.ErrContract=yf;var yy=class extends yf{constructor(){super(` The smart contract has no address set. Make sure you provide the address in the constructor, or call setAddress() appropriately. If you need to recompute the address of the contract, make use of SmartContract.computeAddress() (static method). -`)}};fe.ErrContractHasNoAddress=wy;var Ey=class extends Be{constructor(e){super(e)}};fe.ErrMock=Ey;var mf=class extends Be{constructor(e){super(e)}};fe.ErrTypingSystem=mf;var vy=class extends mf{constructor(e){super(` -argument at position ${e} seems to be a TypedValue. The automatic type inference system requires regular javascript objects as input. -This error might occur when you pass a TypedValue to contract.methods.myFunction([...]). For passing TypedValues instead of regular javascript objects, and bypass the automatic type inference system, use contract.methodsExplicit.myFunction([...]) instead. -Also see https://github.com/multiversx/mx-sdk-js-core/pull/187. -`)}};fe.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=vy;var Ay=class extends Be{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};fe.ErrMissingFieldOnStruct=Ay;var _y=class extends Be{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};fe.ErrMissingFieldOnEnum=_y;var by=class extends Be{constructor(e){super(`cannot parse contract results: ${e}`)}};fe.ErrCannotParseContractResults=by;var Iy=class extends Be{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};fe.ErrCannotParseTransactionOutcome=Iy;var Sy=class extends Be{constructor(e){super(e)}};fe.ErrCodec=Sy;var Cy=class extends Be{constructor(e){super(e)}};fe.ErrContractInteraction=Cy;var Ty=class extends Be{constructor(){super("Method not yet implemented")}};fe.ErrNotImplemented=Ty;var xy=class extends Be{constructor(){super("invalid arguments for relayed v1 builder")}};fe.ErrInvalidRelayedV1BuilderArguments=xy;var Ny=class extends Be{constructor(){super("invalid arguments for relayed v2 builder")}};fe.ErrInvalidRelayedV2BuilderArguments=Ny;var Dy=class extends Be{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};fe.ErrGasLimitShouldBe0ForInnerTransaction=Dy});var ub=v(ii=>{"use strict";c();var BL=ii&&ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ii,"__esModule",{value:!0});ii.TokenPayment=ii.TokenTransfer=void 0;var cc=BL(Wt()),RL=je(),ob="EGLD",ab=18;cc.default.set({ROUNDING_MODE:1});var zr=class{constructor(e){let r=new cc.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new RL.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new cc.default(e).shiftedBy(ab).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new zr({tokenIdentifier:ob,nonce:0,amountAsBigInteger:e,numDecimals:ab})}static fungibleFromAmount(e,r,n){let i=new cc.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new zr({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new cc.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==ob}isFungible(){return this.nonce==0}};ii.TokenTransfer=zr;var Oy=class extends zr{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ii.TokenPayment=Oy});var Lo=v(ke=>{"use strict";c();Object.defineProperty(ke,"__esModule",{value:!0});ke.ARGUMENTS_SEPARATOR=ke.ESDT_TRANSFER_VALUE=ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_GAS_LIMIT=ke.TRANSACTION_VERSION_WITH_OPTIONS=ke.TRANSACTION_VERSION_DEFAULT=ke.TRANSACTION_OPTIONS_TX_GUARDED=ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=ke.TRANSACTION_OPTIONS_DEFAULT=ke.TRANSACTION_MIN_GAS_PRICE=void 0;ke.TRANSACTION_MIN_GAS_PRICE=1e9;ke.TRANSACTION_OPTIONS_DEFAULT=0;ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ke.TRANSACTION_OPTIONS_TX_GUARDED=2;ke.TRANSACTION_VERSION_DEFAULT=1;ke.TRANSACTION_VERSION_WITH_OPTIONS=2;ke.ESDT_TRANSFER_GAS_LIMIT=5e5;ke.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ke.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ke.ESDT_TRANSFER_VALUE="0";ke.ARGUMENTS_SEPARATOR="@"});var fr=v(Je=>{"use strict";c();var LL=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FL=Je&&Je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ML=Je&&Je.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LL(e,t,r);return FL(e,t),e};Object.defineProperty(Je,"__esModule",{value:!0});Je.isEmpty=Je.guardEmpty=Je.guardNotEmpty=Je.guardLength=Je.guardSameLength=Je.guardValueIsSetWithMessage=Je.guardValueIsSet=Je.guardTrue=void 0;var Fo=ML(je());function UL(t,e){if(!t)throw new Fo.ErrInvariantFailed(`[<${e}>] isn't true`)}Je.guardTrue=UL;function qL(t,e){cb(`${t} isn't set (null or undefined)`,e)}Je.guardValueIsSet=qL;function cb(t,e){if(e==null||e===void 0)throw new Fo.ErrInvariantFailed(t)}Je.guardValueIsSetWithMessage=cb;function VL(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Fo.ErrInvariantFailed("arrays do not have the same length")}Je.guardSameLength=VL;function jL(t,e){let r=t.length||0;if(r!=e)throw new Fo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Je.guardLength=jL;function HL(t,e){if(Py(t))throw new Fo.ErrInvariantFailed(`${e} is empty`)}Je.guardNotEmpty=HL;function GL(t,e){if(!Py(t))throw new Fo.ErrInvariantFailed(`${e} is not empty`)}Je.guardEmpty=GL;function Py(t){return t.isEmpty?t.isEmpty():t.length===0}Je.isEmpty=Py});var lb=v(wf=>{"use strict";c();Object.defineProperty(wf,"__esModule",{value:!0});wf.getJavascriptPrototypesInHierarchy=void 0;function QL(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}wf.getJavascriptPrototypesInHierarchy=QL});var mt=v(yt=>{"use strict";c();Object.defineProperty(yt,"__esModule",{value:!0});yt.NullType=yt.TypePlaceholder=yt.isTyped=yt.PrimitiveValue=yt.TypedValue=yt.CustomType=yt.PrimitiveType=yt.TypeCardinality=yt.Type=void 0;var By=lb(),fb=fr(),sr=class{constructor(e,r=[],n=Rn.fixed(1)){fb.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return sr.ClassName}getClassHierarchy(){return By.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return fb.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return sr.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!sr.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return sr.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return By.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};yt.Type=sr;sr.ClassName="Type";var Rn=class{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new Rn(e,e)}static variable(e){return new Rn(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||Rn.MaxCardinality}};yt.TypeCardinality=Rn;Rn.MaxCardinality=4096;var Mo=class extends sr{constructor(e){super(e)}getClassName(){return Mo.ClassName}};yt.PrimitiveType=Mo;Mo.ClassName="PrimitiveType";var Uo=class extends sr{getClassName(){return Uo.ClassName}};yt.CustomType=Uo;Uo.ClassName="CustomType";var fs=class{constructor(e){this.type=e}getClassName(){return fs.ClassName}getClassHierarchy(){return By.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};yt.TypedValue=fs;fs.ClassName="TypedValue";var qo=class extends fs{constructor(e){super(e)}getClassName(){return qo.ClassName}};yt.PrimitiveValue=qo;qo.ClassName="PrimitiveValue";function kL(t){return t.belongsToTypesystem!==void 0}yt.isTyped=kL;var Vo=class extends sr{constructor(){super("...")}getClassName(){return Vo.ClassName}};yt.TypePlaceholder=Vo;Vo.ClassName="TypePlaceholder";var jo=class extends sr{constructor(){super("?")}getClassName(){return jo.ClassName}};yt.NullType=jo;jo.ClassName="NullType"});var hb=v((Ho,Go)=>{c();(function(t){var e=typeof Ho=="object"&&Ho&&!Ho.nodeType&&Ho,r=typeof Go=="object"&&Go&&!Go.nodeType&&Go,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,y=128,w="-",E=/^xn--/,N=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=o-a,b=Math.floor,T=String.fromCharCode,P;function B(Y){throw new RangeError(M[Y])}function _(Y,ie){for(var te=Y.length,ne=[];te--;)ne[te]=ie(Y[te]);return ne}function S(Y,ie){var te=Y.split("@"),ne="";te.length>1&&(ne=te[0]+"@",Y=te[1]),Y=Y.replace(R,".");var q=Y.split("."),ce=_(q,ie).join(".");return ne+ce}function F(Y){for(var ie=[],te=0,ne=Y.length,q,ce;te=55296&&q<=56319&&te65535&&(ie-=65536,te+=T(ie>>>10&1023|55296),ie=56320|ie&1023),te+=T(ie),te}).join("")}function K(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function H(Y,ie){return Y+22+75*(Y<26)-((ie!=0)<<5)}function G(Y,ie,te){var ne=0;for(Y=te?b(Y/f):Y>>1,Y+=b(Y/ie);Y>x*u>>1;ne+=o)Y=b(Y/x);return b(ne+(x+1)*Y/(Y+l))}function $(Y){var ie=[],te=Y.length,ne,q=0,ce=y,oe=d,le,se,ue,g,m,A,O,I,D;for(le=Y.lastIndexOf(w),le<0&&(le=0),se=0;se=128&&B("not-basic"),ie.push(Y.charCodeAt(se));for(ue=le>0?le+1:0;ue=te&&B("invalid-input"),O=K(Y.charCodeAt(ue++)),(O>=o||O>b((s-q)/m))&&B("overflow"),q+=O*m,I=A<=oe?a:A>=oe+u?u:A-oe,!(Ob(s/D)&&B("overflow"),m*=D;ne=ie.length+1,oe=G(q-g,ne,g==0),b(q/ne)>s-ce&&B("overflow"),ce+=b(q/ne),q%=ne,ie.splice(q++,0,ce)}return Z(ie)}function pe(Y){var ie,te,ne,q,ce,oe,le,se,ue,g,m,A=[],O,I,D,L;for(Y=F(Y),O=Y.length,ie=y,te=0,ce=d,oe=0;oe=ie&&mb((s-te)/I)&&B("overflow"),te+=(le-ie)*I,ie=le,oe=0;oes&&B("overflow"),m==ie){for(se=te,ue=o;g=ue<=ce?a:ue>=ce+u?u:ue-ce,!(se{"use strict";c();var pb=hb();function KL(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Ry(t){return t>="0"&&t<="7"}function zL(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function db(t){return t=parseInt(t,16),pb.ucs2.encode([t])}function gb(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!zL(l))throw new KL(u,"Unexpected token ILLEGAL");return l}for(;e{c();var Eb=yb();_b.exports={validate:WL,parse:$L};function WL(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Ef(t,0,e,!1)}catch(n){r=n.message}return r}function $L(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Ef(t,0,e,!0);return r.value}function vb(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function ZL(t,e,r,n){for(var i=e,s=",",o=[],a=e;hs(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Ef(t,i,r,n),l=vb(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function e5(t,e){return t.substr(e,4)==="true"}function t5(t,e){return t.substr(e,5)==="false"}function r5(t,e){return t.substr(e,4)==="null"}var n5=new RegExp(/^\s$/);function hs(t){return n5.test(t)}var i5=new RegExp(/^\d$/);function mb(t){return i5.test(t)}function Ln(t,e,r){var n=10,i;t.length{"use strict";c();var s5=Wr&&Wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o5=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a5=Wr&&Wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s5(e,t,r);return o5(e,t),e};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.TypeExpressionParser=void 0;var Ib=a5(je()),u5=mt(),c5=bb(),Fy=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new Ib.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return c5.parse(r)}catch{throw new Ib.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new u5.Type(e,n)}};Wr.TypeExpressionParser=Fy});var My=v(si=>{"use strict";c();Object.defineProperty(si,"__esModule",{value:!0});si.EndpointParameterDefinition=si.EndpointModifiers=si.EndpointDefinition=void 0;var l5=vf(),Sb="?",f5="N / A",lc=class{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?Sb:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>ds.fromJSON(s)),n=e.outputs.map(s=>ds.fromJSON(s)),i=new Af(e.mutability,e.payableInTokens);return new lc(e.name,r,n,i)}};si.EndpointDefinition=lc;var Af=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};si.EndpointModifiers=Af;var ds=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new l5.TypeExpressionParser().parse(e.type);return new ds(e.name||Sb,e.description||f5,r)}};si.EndpointParameterDefinition=ds});var Qo=v(Xt=>{"use strict";c();var h5=Xt&&Xt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d5=Xt&&Xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p5=Xt&&Xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h5(e,t,r);return d5(e,t),e};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.Fields=Xt.Field=Xt.FieldDefinition=void 0;var Uy=p5(je()),g5=vf(),fc=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new g5.TypeExpressionParser().parse(e.type);return new fc(e.name,e.description,r)}};Xt.FieldDefinition=fc;var qy=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Uy.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Uy.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};Xt.Field=qy;var Vy=class{static checkTyping(e,r){if(e.length!=r.length)throw new Uy.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(ai,"__esModule",{value:!0});ai.EnumValue=ai.EnumVariantDefinition=ai.EnumType=void 0;var y5=je(),jy=fr(),_f=Qo(),Tb=mt(),Cb=256,ps=class extends Tb.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return ps.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>ko.fromJSON(n));return new ps(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return jy.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return jy.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};ai.EnumType=ps;ps.ClassName="EnumType";var ko=class{constructor(e,r,n=[]){this.fieldsDefinitions=[],jy.guardTrue(r_f.FieldDefinition.fromJSON(n));return new ko(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return _f.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ai.EnumVariantDefinition=ko;var oi=class extends Tb.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();_f.Fields.checkTyping(this.fields,i)}getClassName(){return oi.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new oi(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new oi(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=_f.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new y5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(r=>e.fields[r.name]=r.value.valueOf()),e}};ai.EnumValue=oi;oi.ClassName="EnumValue"});var ys=v(zo=>{"use strict";c();Object.defineProperty(zo,"__esModule",{value:!0});zo.Struct=zo.StructType=void 0;var m5=je(),bf=Qo(),xb=mt(),gs=class extends xb.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return gs.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>bf.FieldDefinition.fromJSON(n));return new gs(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return bf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};zo.StructType=gs;gs.ClassName="StructType";var Ko=class extends xb.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return Ko.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();bf.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new m5.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return bf.Fields.equals(r,n)}};zo.Struct=Ko;Ko.ClassName="Struct"});var Tf=v((XX,Ob)=>{"use strict";c();var Sf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Hy={};for(dc=0;dc>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Nb(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Wo(e)^n>>5}for(e=Wo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=Nb(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Wo(n)^o,i+=Sf.charAt(o)}for(s=0;s<6;++s)n=Wo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=Sf.charAt(a)}return i}function Db(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=Nb(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function E5(){var t=Db.apply(null,arguments);if(typeof t=="object")return t}function v5(t){var e=Db.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Cf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var S5=$r&&$r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C5=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pb=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S5(e,t,r);return C5(e,t),e};Object.defineProperty($r,"__esModule",{value:!0});$r.Address=void 0;var xf=Pb(Tf()),$o=Pb(je()),Gy="erd",Qy=32,T5="0".repeat(16),_t=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof _t)return _t.fromAddress(e);if(e instanceof h.Buffer)return _t.fromBuffer(e);if(typeof e=="string")return _t.fromString(e);throw new $o.ErrAddressCannotCreate(e)}}static fromAddress(e){return _t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new _t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Qy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e.toString("hex"))}static fromString(e){return _t.isValidHex(e)?_t.fromValidHex(e):_t.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Qy}static fromHex(e){if(!_t.isValidHex(e))throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e)}static empty(){return new _t}static fromBech32(e){let r;try{r=xf.decode(e)}catch(s){throw new $o.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Gy)throw new $o.ErrAddressBadHrp(Gy,n);let i=h.Buffer.from(xf.fromWords(r.words));if(i.length!=Qy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=xf.toWords(this.pubkey());return xf.encode(Gy,e)}pubkey(){return this.isEmpty()?h.Buffer.from([]):h.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new _t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(T5)}};$r.Address=_t});var Xo=v(Jo=>{"use strict";c();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.AddressValue=Jo.AddressType=void 0;var x5=Zt(),Bb=mt(),ms=class extends Bb.PrimitiveType{constructor(){super("Address")}getClassName(){return ms.ClassName}};Jo.AddressType=ms;ms.ClassName="AddressType";var Yo=class extends Bb.PrimitiveValue{constructor(e){super(new ms),this.value=new x5.Address(e.bech32())}getClassName(){return Yo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Jo.AddressValue=Yo;Yo.ClassName="AddressValue"});var Nf=v(Zo=>{"use strict";c();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.OptionalValue=Zo.OptionalType=void 0;var N5=fr(),pc=mt(),ui=class extends pc.Type{constructor(e){super("Optional",[e],pc.TypeCardinality.variable(1))}getClassName(){return ui.ClassName}isAssignableFrom(e){if(!e.hasExactClass(ui.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(pc.NullType.ClassName);return r||n}};Zo.OptionalType=ui;ui.ClassName="OptionalType";var ws=class extends pc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return ws.ClassName}static newMissing(){let e=new ui(new pc.NullType);return new ws(e)}isSet(){return!!this.value}getTypedValue(){return N5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Zo.OptionalValue=ws;ws.ClassName="OptionalValue"});var gc=v(ta=>{"use strict";c();Object.defineProperty(ta,"__esModule",{value:!0});ta.BooleanValue=ta.BooleanType=void 0;var Rb=mt(),Es=class extends Rb.PrimitiveType{constructor(){super("bool")}getClassName(){return Es.ClassName}};ta.BooleanType=Es;Es.ClassName="BooleanType";var ea=class extends Rb.PrimitiveValue{constructor(e){super(new Es),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ta.BooleanValue=ea;ea.ClassName="BooleanValue"});var li=v(ra=>{"use strict";c();Object.defineProperty(ra,"__esModule",{value:!0});ra.BytesValue=ra.BytesType=void 0;var Lb=mt(),vs=class extends Lb.PrimitiveType{constructor(){super("bytes")}getClassName(){return vs.ClassName}};ra.BytesType=vs;vs.ClassName="BytesType";var ci=class extends Lb.PrimitiveValue{constructor(e){super(new vs),this.value=e}getClassName(){return ci.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new ci(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new ci(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};ra.BytesValue=ci;ci.ClassName="BytesValue"});var Mb=v(na=>{"use strict";c();Object.defineProperty(na,"__esModule",{value:!0});na.CodeMetadataValue=na.CodeMetadataType=void 0;var Fb=mt(),Df=class extends Fb.PrimitiveType{constructor(){super("CodeMetadata")}};na.CodeMetadataType=Df;var ky=class extends Fb.PrimitiveValue{constructor(e){super(new Df),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};na.CodeMetadataValue=ky});var Of=v(ia=>{"use strict";c();Object.defineProperty(ia,"__esModule",{value:!0});ia.CompositeValue=ia.CompositeType=void 0;var D5=fr(),Ky=mt(),As=class extends Ky.Type{constructor(...e){super("Composite",e,Ky.TypeCardinality.variable(e.length))}getClassName(){return As.ClassName}};ia.CompositeType=As;As.ClassName="CompositeType";var _s=class extends Ky.TypedValue{constructor(e,r){super(e),D5.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return _s.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new As(...r);return new _s(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.CollectionOfTypedValues=void 0;var zy=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.List=Yr.OptionValue=Yr.ListType=Yr.OptionType=void 0;var O5=fr(),P5=Wy(),bs=mt(),Jr=class extends bs.Type{constructor(e){super("Option",[e])}getClassName(){return Jr.ClassName}isAssignableFrom(e){if(!e.hasExactClass(Jr.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(bs.NullType.ClassName);return r||n}};Yr.OptionType=Jr;Jr.ClassName="OptionType";var Is=class extends bs.Type{constructor(e){super("List",[e])}getClassName(){return Is.ClassName}};Yr.ListType=Is;Is.ClassName="ListType";var Fn=class extends bs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Fn.ClassName}static newMissing(){let e=new Jr(new bs.NullType);return new Fn(e)}static newMissingTyped(e){return new Fn(new Jr(e))}static newProvided(e){let r=new Jr(e.getType());return new Fn(r,e)}isSet(){return!!this.value}getTypedValue(){return O5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Yr.OptionValue=Fn;Fn.ClassName="OptionValue";var fi=class extends bs.TypedValue{constructor(e,r){super(e),this.backingCollection=new P5.CollectionOfTypedValues(r)}getClassName(){return fi.ClassName}static fromItems(e){if(e.length==0)return new fi(new bs.TypePlaceholder,[]);let r=e[0].getType(),n=new Is(r);return new fi(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Yr.List=fi;fi.ClassName="List"});var Bf=v(aa=>{"use strict";c();Object.defineProperty(aa,"__esModule",{value:!0});aa.ArrayVec=aa.ArrayVecType=void 0;var Ub=fr(),B5=Wy(),qb=mt(),sa=class extends qb.Type{constructor(e,r){super("Array",[r]),Ub.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return sa.ClassName}};aa.ArrayVecType=sa;sa.ClassName="ArrayVecType";var oa=class extends qb.TypedValue{constructor(e,r){super(e),Ub.guardLength(r,e.length),this.backingCollection=new B5.CollectionOfTypedValues(r)}getClassName(){return oa.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};aa.ArrayVec=oa;oa.ClassName="ArrayVec"});var mc=v(ca=>{"use strict";c();Object.defineProperty(ca,"__esModule",{value:!0});ca.H256Value=ca.H256Type=void 0;var Vb=mt(),Ss=class extends Vb.PrimitiveType{constructor(){super("H256")}getClassName(){return Ss.ClassName}};ca.H256Type=Ss;Ss.ClassName="H256Type";var ua=class extends Vb.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return ua.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ca.H256Value=ua;ua.ClassName="H256Value"});var Rf=v(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.NothingValue=fa.NothingType=void 0;var jb=mt(),Cs=class extends jb.PrimitiveType{constructor(){super("nothing")}getClassName(){return Cs.ClassName}};fa.NothingType=Cs;Cs.ClassName="NothingType";var la=class extends jb.PrimitiveValue{constructor(){super(new Cs)}getClassName(){return la.ClassName}equals(e){return!1}valueOf(){return{}}};fa.NothingValue=la;la.ClassName="NothingValue"});var wc=v(Ae=>{"use strict";c();var R5=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L5=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F5=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&R5(e,t,r);return L5(e,t),e},M5=Ae&&Ae.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var Hb=F5(je()),Gb=mt(),Ms=M5(Wt()),Vt=class extends Gb.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return Vt.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=Vt;Vt.ClassName="NumericalType";var Ts=class extends Vt{constructor(){super("u8",1,!1)}getClassName(){return Ts.ClassName}};Ae.U8Type=Ts;Ts.ClassName="U8Type";var xs=class extends Vt{constructor(){super("i8",1,!0)}getClassName(){return xs.ClassName}};Ae.I8Type=xs;xs.ClassName="I8Type";var Ns=class extends Vt{constructor(){super("u16",2,!1)}getClassName(){return Ns.ClassName}};Ae.U16Type=Ns;Ns.ClassName="U16Type";var Ds=class extends Vt{constructor(){super("i16",2,!0)}getClassName(){return Ds.ClassName}};Ae.I16Type=Ds;Ds.ClassName="I16Type";var Os=class extends Vt{constructor(){super("u32",4,!1)}getClassName(){return Os.ClassName}};Ae.U32Type=Os;Os.ClassName="U32Type";var Ps=class extends Vt{constructor(){super("i32",4,!0)}getClassName(){return Ps.ClassName}};Ae.I32Type=Ps;Ps.ClassName="I32Type";var Bs=class extends Vt{constructor(){super("u64",8,!1)}getClassName(){return Bs.ClassName}};Ae.U64Type=Bs;Bs.ClassName="U64Type";var Rs=class extends Vt{constructor(){super("i64",8,!0)}getClassName(){return Rs.ClassName}};Ae.I64Type=Rs;Rs.ClassName="I64Type";var Ls=class extends Vt{constructor(){super("BigUint",0,!1)}getClassName(){return Ls.ClassName}};Ae.BigUIntType=Ls;Ls.ClassName="BigUIntType";var Fs=class extends Vt{constructor(){super("Bigint",0,!0)}getClassName(){return Fs.ClassName}};Ae.BigIntType=Fs;Fs.ClassName="BigIntType";var jt=class extends Gb.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ms.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new Hb.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new Hb.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return jt.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=jt;jt.ClassName="NumericalValue";var ha=class extends jt{constructor(e){super(new Ts,new Ms.default(e))}getClassName(){return ha.ClassName}};Ae.U8Value=ha;ha.ClassName="U8Value";var da=class extends jt{constructor(e){super(new xs,new Ms.default(e))}getClassName(){return da.ClassName}};Ae.I8Value=da;da.ClassName="I8Value";var pa=class extends jt{constructor(e){super(new Ns,new Ms.default(e))}getClassName(){return pa.ClassName}};Ae.U16Value=pa;pa.ClassName="U16Value";var ga=class extends jt{constructor(e){super(new Ds,new Ms.default(e))}getClassName(){return ga.ClassName}};Ae.I16Value=ga;ga.ClassName="I16Value";var ya=class extends jt{constructor(e){super(new Os,new Ms.default(e))}getClassName(){return ya.ClassName}};Ae.U32Value=ya;ya.ClassName="U32Value";var ma=class extends jt{constructor(e){super(new Ps,new Ms.default(e))}getClassName(){return ma.ClassName}};Ae.I32Value=ma;ma.ClassName="I32Value";var wa=class extends jt{constructor(e){super(new Bs,e)}getClassName(){return wa.ClassName}};Ae.U64Value=wa;wa.ClassName="U64Value";var Ea=class extends jt{constructor(e){super(new Rs,e)}getClassName(){return Ea.ClassName}};Ae.I64Value=Ea;Ea.ClassName="I64Value";var va=class extends jt{constructor(e){super(new Ls,e)}getClassName(){return va.ClassName}};Ae.BigUIntValue=va;va.ClassName="BigUIntValue";var Aa=class extends jt{constructor(e){super(new Fs,e)}getClassName(){return Aa.ClassName}};Ae.BigIntValue=Aa;Aa.ClassName="BigIntValue"});var Lf=v(_a=>{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.StringValue=_a.StringType=void 0;var Qb=mt(),Us=class extends Qb.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return Us.ClassName}};_a.StringType=Us;Us.ClassName="StringType";var hi=class extends Qb.PrimitiveValue{constructor(e){super(new Us),this.value=e}getClassName(){return hi.ClassName}static fromUTF8(e){return new hi(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new hi(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};_a.StringValue=hi;hi.ClassName="StringValue"});var Ia=v(ba=>{"use strict";c();Object.defineProperty(ba,"__esModule",{value:!0});ba.TokenIdentifierValue=ba.TokenIdentifierType=void 0;var kb=mt(),U5="EGLD",qs=class extends kb.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return qs.ClassName}};ba.TokenIdentifierType=qs;qs.ClassName="TokenIdentifierType";var di=class extends kb.PrimitiveValue{constructor(e){super(new qs),this.value=e}static egld(){return new di(U5)}static esdtTokenIdentifier(e){return new di(e)}getClassName(){return di.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};ba.TokenIdentifierValue=di;di.ClassName="TokenIdentifierValue"});var Ff=v(hr=>{"use strict";c();var q5=hr&&hr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V5=hr&&hr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j5=hr&&hr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q5(e,t,r);return V5(e,t),e};Object.defineProperty(hr,"__esModule",{value:!0});hr.Tuple=hr.TupleType=void 0;var H5=j5(je()),G5=ys(),Kb=Qo(),Q5=ys(),Mn=class extends Q5.StructType{constructor(...e){super(Mn.prepareName(e),Mn.prepareFieldDefinitions(e))}getClassName(){return Mn.ClassName}static prepareName(e){let r=e.map(i=>i.toString()).join(", ");return`tuple${r.length}<${r}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new Kb.FieldDefinition(zb(i),"anonymous tuple field",n))}};hr.TupleType=Mn;Mn.ClassName="TupleType";function zb(t){return`field${t}`}var Vs=class extends G5.Struct{constructor(e,r){super(e,r)}getClassName(){return Vs.ClassName}static fromItems(e){if(e.length<1)throw new H5.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Mn(...r),i=e.map((s,o)=>new Kb.Field(s,zb(o)));return new Vs(n,i)}};hr.Tuple=Vs;Vs.ClassName="Tuple"});var Uf=v(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.VariadicValue=Sa.VariadicType=void 0;var Mf=mt(),gi=class extends Mf.Type{constructor(e){super("Variadic",[e],Mf.TypeCardinality.variable())}getClassName(){return gi.ClassName}};Sa.VariadicType=gi;gi.ClassName="VariadicType";var pi=class extends Mf.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return pi.ClassName}static fromItems(...e){if(e.length==0)return new pi(new gi(new Mf.TypePlaceholder),[]);let r=e[0].getType();return new pi(new gi(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var k5=Xr&&Xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K5=Xr&&Xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z5=Xr&&Xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&k5(e,t,r);return K5(e,t),e};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.TypeMapper=void 0;var Wb=z5(je()),W5=Xo(),$y=Nf(),$5=gc(),Y5=li(),J5=Mb(),qf=Of(),Yy=hc(),X5=Qo(),$b=yc(),Vf=Bf(),Z5=mc(),Yb=Rf(),dr=wc(),eF=Lf(),Jb=ys(),Xb=Ia(),yi=Ff(),Jy=Uf(),Xy=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new $b.OptionType(r[0])],["List",(...r)=>new $b.ListType(r[0])],["VarArgs",(...r)=>new Jy.VariadicType(r[0])],["MultiResultVec",(...r)=>new Jy.VariadicType(r[0])],["variadic",(...r)=>new Jy.VariadicType(r[0])],["OptionalArg",(...r)=>new $y.OptionalType(r[0])],["optional",(...r)=>new $y.OptionalType(r[0])],["OptionalResult",(...r)=>new $y.OptionalType(r[0])],["multi",(...r)=>new qf.CompositeType(...r)],["MultiArg",(...r)=>new qf.CompositeType(...r)],["MultiResult",(...r)=>new qf.CompositeType(...r)],["multi",(...r)=>new qf.CompositeType(...r)],["tuple",(...r)=>new yi.TupleType(...r)],["tuple2",(...r)=>new yi.TupleType(...r)],["tuple3",(...r)=>new yi.TupleType(...r)],["tuple4",(...r)=>new yi.TupleType(...r)],["tuple5",(...r)=>new yi.TupleType(...r)],["tuple6",(...r)=>new yi.TupleType(...r)],["tuple7",(...r)=>new yi.TupleType(...r)],["tuple8",(...r)=>new yi.TupleType(...r)],["array20",(...r)=>new Vf.ArrayVecType(20,r[0])],["array32",(...r)=>new Vf.ArrayVecType(32,r[0])],["array46",(...r)=>new Vf.ArrayVecType(46,r[0])],["array64",(...r)=>new Vf.ArrayVecType(64,r[0])]]),this.closedTypesMap=new Map([["u8",new dr.U8Type],["u16",new dr.U16Type],["u32",new dr.U32Type],["u64",new dr.U64Type],["U64",new dr.U64Type],["BigUint",new dr.BigUIntType],["i8",new dr.I8Type],["i16",new dr.I16Type],["i32",new dr.I32Type],["i64",new dr.I64Type],["Bigint",new dr.BigIntType],["BigInt",new dr.BigIntType],["bool",new $5.BooleanType],["bytes",new Y5.BytesType],["Address",new W5.AddressType],["H256",new Z5.H256Type],["utf-8 string",new eF.StringType],["TokenIdentifier",new Xb.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new Xb.TokenIdentifierType],["CodeMetadata",new J5.CodeMetadataType],["nothing",new Yb.NothingType],["AsyncCall",new Yb.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new Wb.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(Yy.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(Jb.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new Jb.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Yy.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Yy.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new X5.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new Wb.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};Xr.TypeMapper=Xy});var nI=v(Zr=>{"use strict";c();var tF=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rF=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nF=Zr&&Zr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tF(e,t,r);return rF(e,t),e};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.AbiRegistry=void 0;var Zb=nF(je()),em=fr(),Ec=My(),eI=hc(),tI=ys(),iF=Zy(),sF="?",Ca=class{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||sF,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Ec.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Ec.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let y=s[d];if(y.type=="struct")u.push(tI.StructType.fromJSON({name:d,fields:y.fields}));else if(y.type=="enum")u.push(eI.EnumType.fromJSON({name:d,variants:y.variants}));else throw new Zb.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new Ca({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(tI.StructType.ClassName));return em.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(eI.EnumType.ClassName));return em.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return em.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new iF.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new Zb.ErrTypingSystem("Did not re-map all custom types");let n=rI(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(rI(o,e));return new Ca({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};Zr.AbiRegistry=Ca;function rI(t,e){let r=t.input.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Ec.EndpointDefinition(t.name,r,n,t.modifiers)}});var sI=v(Ta=>{"use strict";c();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.createListOfTokenIdentifiers=Ta.createListOfAddresses=void 0;var oF=Xo(),iI=yc(),aF=Ia();function uF(t){let e=t.map(n=>new oF.AddressValue(n));return iI.List.fromItems(e)}Ta.createListOfAddresses=uF;function cF(t){let e=t.map(n=>new aF.TokenIdentifierValue(n));return iI.List.fromItems(e)}Ta.createListOfTokenIdentifiers=cF});var EI=v(Ht=>{"use strict";c();var lF=Ht&&Ht.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fF=Ht&&Ht.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hF=Ht&&Ht.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lF(e,t,r);return fF(e,t),e};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.onPrimitiveTypeSelect=Ht.onPrimitiveValueSelect=Ht.onTypedValueSelect=Ht.onTypeSelect=void 0;var Hf=hF(je()),oI=Xo(),aI=gc(),uI=li(),cI=hc(),jf=yc(),lI=mc(),fI=wc(),hI=Rf(),dI=ys(),pI=Ia(),gI=Ff(),yI=mt(),mI=Bf(),wI=Lf();function dF(t,e){if(t.hasExactClass(jf.OptionType.ClassName))return e.onOption();if(t.hasExactClass(jf.ListType.ClassName))return e.onList();if(t.hasExactClass(mI.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(yI.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(dI.StructType.ClassName))return e.onStruct();if(t.hasExactClass(gI.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(cI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't known: ${t}`)}Ht.onTypeSelect=dF;function pF(t,e){if(t.hasClassOrSuperclass(yI.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(jf.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(jf.List.ClassName))return e.onList();if(t.hasExactClass(mI.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(dI.Struct.ClassName))return e.onStruct();if(t.hasExactClass(gI.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(cI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't typed: ${t}`)}Ht.onTypedValueSelect=pF;function gF(t,e){if(t.hasExactClass(aI.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(fI.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(oI.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(uI.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(wI.StringValue.ClassName))return e.onString();if(t.hasExactClass(lI.H256Value.ClassName))return e.onH256();if(t.hasExactClass(pI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(hI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Ht.onPrimitiveValueSelect=gF;function yF(t,e){if(t.hasExactClass(aI.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(fI.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(oI.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(uI.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(wI.StringType.ClassName))return e.onString();if(t.hasExactClass(lI.H256Type.ClassName))return e.onH256();if(t.hasExactClass(pI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(hI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Ht.onPrimitiveTypeSelect=yF});var bt=v(Ue=>{"use strict";c();var mF=Ue&&Ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xe=Ue&&Ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mF(e,t,r)};Object.defineProperty(Ue,"__esModule",{value:!0});Xe(nI(),Ue);Xe(Xo(),Ue);Xe(Nf(),Ue);Xe(gc(),Ue);Xe(li(),Ue);Xe(Of(),Ue);Xe(My(),Ue);Xe(hc(),Ue);Xe(sI(),Ue);Xe(Qo(),Ue);Xe(yc(),Ue);Xe(Bf(),Ue);Xe(mc(),Ue);Xe(EI(),Ue);Xe(Rf(),Ue);Xe(wc(),Ue);Xe(Lf(),Ue);Xe(ys(),Ue);Xe(Ia(),Ue);Xe(Ff(),Ue);Xe(vf(),Ue);Xe(Zy(),Ue);Xe(mt(),Ue);Xe(Uf(),Ue)});var AI=v(en=>{"use strict";c();var wF=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EF=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vF=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wF(e,t,r);return EF(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.OptionValueBinaryCodec=void 0;var vI=vF(je()),Gf=bt(),tm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Gf.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new vI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Gf.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Gf.OptionValue(r);if(e[0]!=1)throw new vI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Gf.OptionValue(r,n)}encodeNested(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([])}};en.OptionValueBinaryCodec=tm});var _I=v(Qf=>{"use strict";c();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.AddressBinaryCodec=void 0;var AF=Zt(),_F=bt(),rm=class{decodeNested(e){let r=e.slice(0,32),n=new AF.Address(r);return[new _F.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Qf.AddressBinaryCodec=rm});var II=v(tn=>{"use strict";c();var bF=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IF=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SF=tn&&tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bF(e,t,r);return IF(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.BooleanBinaryCodec=void 0;var CF=SF(je()),bI=bt(),Dr=class{decodeNested(e){let r=e.readUInt8(0);return[new bI.BooleanValue(r==Dr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new CF.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new bI.BooleanValue(r==Dr.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([Dr.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([])}};tn.BooleanBinaryCodec=Dr;Dr.TRUE=1;Dr.FALSE=0});var Kf=v(kf=>{"use strict";c();Object.defineProperty(kf,"__esModule",{value:!0});kf.SizeOfU32=void 0;kf.SizeOfU32=4});var nm=v(rn=>{"use strict";c();var TF=rn&&rn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.zeroPadStringIfOddLength=rn.isPaddedHex=rn.numberToPaddedHex=void 0;var xF=TF(Wt());function NF(t){let e=new xF.default(t).toString(16);return SI(e)}rn.numberToPaddedHex=NF;function DF(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}rn.isPaddedHex=DF;function SI(t){return t=t||"",t.length%2==1?"0"+t:t}rn.zeroPadStringIfOddLength=SI});var zf=v(wt=>{"use strict";c();var OF=wt&&wt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wt,"__esModule",{value:!0});wt.prependByteToBuffer=wt.flipBufferBitsInPlace=wt.getHexMagnitudeOfBigInt=wt.bigIntToBuffer=wt.bufferToBigInt=wt.cloneBuffer=wt.isMsbZero=wt.isMsbOne=void 0;var im=OF(Wt()),PF=nm();function CI(t,e=0){return t[e]>>7==1}wt.isMsbOne=CI;function BF(t,e=0){return!CI(t,e)}wt.isMsbZero=BF;function RF(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}wt.cloneBuffer=RF;function LF(t){let e=t.toString("hex");return new im.default(`0x${e}`,16)}wt.bufferToBigInt=LF;function FF(t){let e=TI(t);return h.Buffer.from(e,"hex")}wt.bigIntToBuffer=FF;function TI(t){return t=new im.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new im.default(-1))),PF.numberToPaddedHex(t)):""}wt.getHexMagnitudeOfBigInt=TI;function MF(t){for(let e=0;e{"use strict";c();var qF=xa&&xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xa,"__esModule",{value:!0});xa.NumericalBinaryCodec=void 0;var vc=qF(Wt()),sm=bt(),xI=Kf(),ht=zf(),om=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=xI.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=ht.cloneBuffer(e);if(e.length==0)return new sm.NumericalValue(r,new vc.default(0));if(!r.withSign||ht.isMsbZero(n)){let l=ht.bufferToBigInt(n);return new sm.NumericalValue(r,l)}ht.flipBufferBitsInPlace(n);let u=ht.bufferToBigInt(n).multipliedBy(new vc.default(-1)).minus(new vc.default(1));return new sm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(xI.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=ht.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=ht.bigIntToBuffer(e.value);ht.isMsbOne(o)&&(o=ht.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new vc.default(1)),i=ht.bigIntToBuffer(n);ht.flipBufferBitsInPlace(i),ht.isMsbZero(i)&&(i=ht.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):ht.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=ht.bigIntToBuffer(e.value);return ht.isMsbOne(i)&&(i=ht.prependByteToBuffer(i,0)),i}let r=e.value.plus(new vc.default(1)),n=ht.bigIntToBuffer(r);return ht.flipBufferBitsInPlace(n),ht.isMsbZero(n)&&(n=ht.prependByteToBuffer(n,255)),n}};xa.NumericalBinaryCodec=om});var DI=v(Wf=>{"use strict";c();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.H256BinaryCodec=void 0;var VF=mc(),am=class{decodeNested(e){let r=e.slice(0,32);return[new VF.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Wf.H256BinaryCodec=am});var Jf=v(Yf=>{"use strict";c();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.BytesBinaryCodec=void 0;var OI=li(),$f=Kf(),um=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice($f.SizeOfU32,$f.SizeOfU32+r);return[new OI.BytesValue(n),$f.SizeOfU32+r]}decodeTopLevel(e){return new OI.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc($f.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Yf.BytesBinaryCodec=um});var BI=v(Xf=>{"use strict";c();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.TokenIdentifierCodec=void 0;var jF=li(),PI=Ia(),HF=Jf(),cm=class{constructor(){this.bytesCodec=new HF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new PI.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new PI.TokenIdentifierValue(r.toString())}encodeNested(e){let r=jF.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Xf.TokenIdentifierCodec=cm});var LI=v(Zf=>{"use strict";c();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.NothingCodec=void 0;var RI=bt(),lm=class{decodeNested(){return[new RI.NothingValue,0]}decodeTopLevel(){return new RI.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Zf.NothingCodec=lm});var MI=v(eh=>{"use strict";c();Object.defineProperty(eh,"__esModule",{value:!0});eh.StringBinaryCodec=void 0;var FI=bt(),GF=li(),QF=Jf(),fm=class{constructor(){this.bytesBinaryCodec=new QF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new FI.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new FI.StringValue(e.toString())}encodeNested(e){let r=GF.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};eh.StringBinaryCodec=fm});var UI=v(rh=>{"use strict";c();Object.defineProperty(rh,"__esModule",{value:!0});rh.PrimitiveBinaryCodec=void 0;var th=bt(),kF=_I(),KF=II(),zF=NI(),WF=DI(),$F=Jf(),YF=BI(),JF=LI(),XF=MI(),hm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new KF.BooleanBinaryCodec,this.numericalCodec=new zF.NumericalBinaryCodec,this.addressCodec=new kF.AddressBinaryCodec,this.h256Codec=new WF.H256BinaryCodec,this.bytesCodec=new $F.BytesBinaryCodec,this.stringCodec=new XF.StringBinaryCodec,this.tokenIdentifierCodec=new YF.TokenIdentifierCodec,this.nothingCodec=new JF.NothingCodec}decodeNested(e,r){return th.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return th.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return th.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return th.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};rh.PrimitiveBinaryCodec=hm});var jI=v(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.ListBinaryCodec=void 0;var qI=bt(),VI=Kf(),dm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=VI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new qI.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(VI.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return h.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return h.Buffer.concat(r)}};nh.ListBinaryCodec=dm});var gm=v(ih=>{"use strict";c();Object.defineProperty(ih,"__esModule",{value:!0});ih.FieldsBinaryCodec=void 0;var ZF=bt(),pm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new ZF.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return h.Buffer.concat(r)}};ih.FieldsBinaryCodec=pm});var mm=v(sh=>{"use strict";c();Object.defineProperty(sh,"__esModule",{value:!0});sh.StructBinaryCodec=void 0;var e4=bt(),t4=gm(),ym=class{constructor(e){this.fieldsCodec=new t4.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new e4.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};sh.StructBinaryCodec=ym});var HI=v(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.EnumBinaryCodec=void 0;var oh=bt(),r4=gm(),wm=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new r4.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new oh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new oh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new oh.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return h.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new oh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};ah.EnumBinaryCodec=wm});var GI=v(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.TupleBinaryCodec=void 0;var n4=mm(),Em=class{constructor(e){this.structCodec=new n4.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};uh.TupleBinaryCodec=Em});var QI=v(ch=>{"use strict";c();Object.defineProperty(ch,"__esModule",{value:!0});ch.ArrayVecBinaryCodec=void 0;var i4=bt(),vm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var s4=pr&&pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o4=pr&&pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a4=pr&&pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s4(e,t,r);return o4(e,t),e};Object.defineProperty(pr,"__esModule",{value:!0});pr.BinaryCodecConstraints=pr.BinaryCodec=void 0;var kI=a4(je()),lh=bt(),KI=fr(),u4=AI(),c4=UI(),l4=jI(),f4=mm(),h4=HI(),d4=GI(),p4=QI(),Am=class{constructor(e=null){this.constraints=e||new fh,this.optionCodec=new u4.OptionValueBinaryCodec(this),this.listCodec=new l4.ListBinaryCodec(this),this.arrayCodec=new p4.ArrayVecBinaryCodec(this),this.primitiveCodec=new c4.PrimitiveBinaryCodec(this),this.structCodec=new f4.StructBinaryCodec(this),this.tupleCodec=new d4.TupleBinaryCodec(this),this.enumCodec=new h4.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),lh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=lh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return KI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),lh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return KI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),lh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};pr.BinaryCodec=Am;var fh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||40960,this.maxListLength=e?.maxListLength||8192}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new kI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new kI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};pr.BinaryCodecConstraints=fh});var zI=v(gr=>{"use strict";c();var g4=gr&&gr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gr,"__esModule",{value:!0});gr.decodeBigNumber=gr.decodeString=gr.decodeBool=gr.decodeUnsignedNumber=void 0;var y4=g4(Wt()),hh=bt(),m4=_m(),dh=new m4.BinaryCodec;function w4(t){let e=dh.decodeTopLevel(t,new hh.BigUIntType);return Number(e.valueOf())}gr.decodeUnsignedNumber=w4;function E4(t){return!!dh.decodeTopLevel(t,new hh.BooleanType).valueOf()}gr.decodeBool=E4;function v4(t){let e=dh.decodeTopLevel(t,new hh.BytesType);return String(e.valueOf())}gr.decodeString=v4;function A4(t){let e=dh.decodeTopLevel(t,new hh.BigUIntType);return new y4.default(e.valueOf())}gr.decodeBigNumber=A4});var $I=v(mi=>{"use strict";c();var _4=mi&&mi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WI=mi&&mi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_4(e,t,r)};Object.defineProperty(mi,"__esModule",{value:!0});WI(_m(),mi);WI(zI(),mi)});var gh=v(ph=>{"use strict";c();Object.defineProperty(ph,"__esModule",{value:!0});ph.ArgSerializer=void 0;var YI=Lo(),b4=$I(),bm=Nf(),Im=Of(),Sm=Uf(),I4={codec:new b4.BinaryCodec},Cm=class{constructor(e){e=Object.assign(Object.assign({},I4),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(YI.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let f=0;f=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(YI.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let s of e)i(s);function i(s){if(s.hasExactClass(bm.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(Sm.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(Im.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};ph.ArgSerializer=Cm});var wh=v(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.Compatibility=void 0;var S4=Zt(),yh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==S4.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};mh.Compatibility=yh;yh.areWarningsEnabled=!0});var JI=v(nn=>{"use strict";c();var C4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C4(e,t,r);return T4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Hash=void 0;var N4=x4(je()),Ac=class{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new N4.ErrBadType("hash","buffer | string",e)}static empty(){return new Ac(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};nn.Hash=Ac});var ZI=v(yr=>{"use strict";c();var D4=yr&&yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O4=yr&&yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4=yr&&yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&D4(e,t,r);return O4(e,t),e};Object.defineProperty(yr,"__esModule",{value:!0});yr.TransactionOptions=yr.TransactionVersion=void 0;var Or=Lo(),XI=P4(je()),Na=class{constructor(e){if(e=Number(e),e<1)throw new XI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Na(Or.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new Na(Or.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};yr.TransactionVersion=Na;var Da=class{constructor(e){if(e=Number(e),e<0)throw new XI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new Da(Or.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Or.TRANSACTION_OPTIONS_TX_GUARDED),new Da(r)}isWithHashSign(){return(this.value&Or.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Or.TRANSACTION_OPTIONS_TX_GUARDED)==Or.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Or.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};yr.TransactionOptions=Da});var tS=v((Hee,eS)=>{"use strict";c();eS.exports=B4;function B4(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var Eh=iS;Eh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Oa=new Array(64),nS=new Array(123);for(Pr=0;Pr<64;)nS[Oa[Pr]=Pr<26?Pr+65:Pr<52?Pr+71:Pr<62?Pr-4:Pr-59|43]=Pr++;var Pr;Eh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Oa[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Oa[u|l>>6],s[o++]=Oa[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Oa[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var rS="invalid encoding";Eh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=nS[u])===void 0)throw Error(rS);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(rS);return n-i};Eh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var aS=v((Kee,oS)=>{"use strict";c();oS.exports=vh;function vh(){this._listeners={}}vh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};vh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();dS.exports=uS(uS);function uS(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,cS),t.writeFloatBE=e.bind(null,lS);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,fS),t.readFloatBE=r.bind(null,hS)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,cS,0,4),t.writeDoubleBE=e.bind(null,lS,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,y=4294967296*(l&1048575)+u;return d===2047?y?NaN:f*(1/0):d===0?f*5e-324*y:f*Math.pow(2,d-1075)*(y+4503599627370496)}t.readDoubleLE=r.bind(null,fS,0,4),t.readDoubleBE=r.bind(null,hS,4,0)}(),t}function cS(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function lS(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function fS(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function hS(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var gS=v((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var mS=v(yS=>{"use strict";c();var Tm=yS;Tm.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Tm.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var ES=v((Zee,wS)=>{"use strict";c();wS.exports=R4;function R4(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var AS=v((tte,vS)=>{"use strict";c();vS.exports=xt;var _c=Ei();function xt(t,e){this.lo=t>>>0,this.hi=e>>>0}var js=xt.zero=new xt(0,0);js.toNumber=function(){return 0};js.zzEncode=js.zzDecode=function(){return this};js.length=function(){return 1};var L4=xt.zeroHash="\0\0\0\0\0\0\0\0";xt.fromNumber=function(e){if(e===0)return js;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new xt(n,i)};xt.from=function(e){if(typeof e=="number")return xt.fromNumber(e);if(_c.isString(e))if(_c.Long)e=_c.Long.fromString(e);else return xt.fromNumber(parseInt(e,10));return e.low||e.high?new xt(e.low>>>0,e.high>>>0):js};xt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};xt.prototype.toLong=function(e){return _c.Long?new _c.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var wi=String.prototype.charCodeAt;xt.fromHash=function(e){return e===L4?js:new xt((wi.call(e,0)|wi.call(e,1)<<8|wi.call(e,2)<<16|wi.call(e,3)<<24)>>>0,(wi.call(e,4)|wi.call(e,5)<<8|wi.call(e,6)<<16|wi.call(e,7)<<24)>>>0)};xt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};xt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};xt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};xt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Ei=v(xm=>{"use strict";c();var me=xm;me.asPromise=tS();me.base64=sS();me.EventEmitter=aS();me.float=pS();me.inquire=gS();me.utf8=mS();me.pool=ES();me.LongBits=AS();me.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||xm;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};me.Buffer=function(){try{var t=me.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,r){var n=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function _S(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};me.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();TS.exports=Le;var mr=Ei(),Nm,Ah=mr.LongBits,IS=mr.base64,SS=mr.utf8;function bc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Om(){}function F4(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Le(){this.len=0,this.head=new bc(Om,0,0),this.tail=this.head,this.states=null}var CS=function(){return mr.Buffer?function(){return(Le.create=function(){return new Nm})()}:function(){return new Le}};Le.create=CS();Le.alloc=function(e){return new mr.Array(e)};mr.Array!==Array&&(Le.alloc=mr.pool(Le.alloc,mr.Array.prototype.subarray));Le.prototype._push=function(e,r,n){return this.tail=this.tail.next=new bc(e,r,n),this.len+=r,this};function Pm(t,e,r){e[r]=t&255}function M4(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Bm(t,e){this.len=t,this.next=void 0,this.val=e}Bm.prototype=Object.create(bc.prototype);Bm.prototype.fn=M4;Le.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Bm((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Le.prototype.int32=function(e){return e<0?this._push(Rm,10,Ah.fromNumber(e)):this.uint32(e)};Le.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Rm(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Le.prototype.uint64=function(e){var r=Ah.from(e);return this._push(Rm,r.length(),r)};Le.prototype.int64=Le.prototype.uint64;Le.prototype.sint64=function(e){var r=Ah.from(e).zzEncode();return this._push(Rm,r.length(),r)};Le.prototype.bool=function(e){return this._push(Pm,1,e?1:0)};function Dm(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Le.prototype.fixed32=function(e){return this._push(Dm,4,e>>>0)};Le.prototype.sfixed32=Le.prototype.fixed32;Le.prototype.fixed64=function(e){var r=Ah.from(e);return this._push(Dm,4,r.lo)._push(Dm,4,r.hi)};Le.prototype.sfixed64=Le.prototype.fixed64;Le.prototype.float=function(e){return this._push(mr.float.writeFloatLE,4,e)};Le.prototype.double=function(e){return this._push(mr.float.writeDoubleLE,8,e)};var U4=mr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Pm,1,0);if(mr.isString(e)){var n=Le.alloc(r=IS.length(e));IS.decode(e,n,0),e=n}return this.uint32(r)._push(U4,r,e)};Le.prototype.string=function(e){var r=SS.length(e);return r?this.uint32(r)._push(SS.write,r,e):this._push(Pm,1,0)};Le.prototype.fork=function(){return this.states=new F4(this),this.head=this.tail=new bc(Om,0,0),this.len=0,this};Le.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new bc(Om,0,0),this.len=0),this};Le.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Le.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Le._configure=function(t){Nm=t,Le.create=CS(),Nm._configure()}});var DS=v((ate,NS)=>{"use strict";c();NS.exports=sn;var xS=Lm();(sn.prototype=Object.create(xS.prototype)).constructor=sn;var vi=Ei();function sn(){xS.call(this)}sn._configure=function(){sn.alloc=vi._Buffer_allocUnsafe,sn.writeBytesBuffer=vi.Buffer&&vi.Buffer.prototype instanceof Uint8Array&&vi.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(sn.writeBytesBuffer,r,e),this};function q4(t,e,r){t.length<40?vi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}sn.prototype.string=function(e){var r=vi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(q4,r,e),this};sn._configure()});var Um=v((cte,LS)=>{"use strict";c();LS.exports=dt;var on=Ei(),Mm,BS=on.LongBits,V4=on.utf8;function Br(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function dt(t){this.buf=t,this.pos=0,this.len=t.length}var OS=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new dt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new dt(e);throw Error("illegal buffer")},RS=function(){return on.Buffer?function(r){return(dt.create=function(i){return on.Buffer.isBuffer(i)?new Mm(i):OS(i)})(r)}:OS};dt.create=RS();dt.prototype._slice=on.Array.prototype.subarray||on.Array.prototype.slice;dt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Br(this,10);return e}}();dt.prototype.int32=function(){return this.uint32()|0};dt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Fm(){var t=new BS(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Br(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Br(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}dt.prototype.bool=function(){return this.uint32()!==0};function _h(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}dt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return _h(this.buf,this.pos+=4)};dt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return _h(this.buf,this.pos+=4)|0};function PS(){if(this.pos+8>this.len)throw Br(this,8);return new BS(_h(this.buf,this.pos+=4),_h(this.buf,this.pos+=4))}dt.prototype.float=function(){if(this.pos+4>this.len)throw Br(this,4);var e=on.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};dt.prototype.double=function(){if(this.pos+8>this.len)throw Br(this,4);var e=on.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};dt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Br(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};dt.prototype.string=function(){var e=this.bytes();return V4.read(e,0,e.length)};dt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Br(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Br(this);while(this.buf[this.pos++]&128);return this};dt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};dt._configure=function(t){Mm=t,dt.create=RS(),Mm._configure();var e=on.Long?"toLong":"toNumber";on.merge(dt.prototype,{int64:function(){return Fm.call(this)[e](!1)},uint64:function(){return Fm.call(this)[e](!0)},sint64:function(){return Fm.call(this).zzDecode()[e](!1)},fixed64:function(){return PS.call(this)[e](!0)},sfixed64:function(){return PS.call(this)[e](!1)}})}});var qS=v((fte,US)=>{"use strict";c();US.exports=Hs;var MS=Um();(Hs.prototype=Object.create(MS.prototype)).constructor=Hs;var FS=Ei();function Hs(t){MS.call(this,t)}Hs._configure=function(){FS.Buffer&&(Hs.prototype._slice=FS.Buffer.prototype.slice)};Hs.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Hs._configure()});var jS=v((dte,VS)=>{"use strict";c();VS.exports=Ic;var qm=Ei();(Ic.prototype=Object.create(qm.EventEmitter.prototype)).constructor=Ic;function Ic(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");qm.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Ic.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return qm.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Ic.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var GS=v(HS=>{"use strict";c();var j4=HS;j4.Service=jS()});var kS=v((mte,QS)=>{"use strict";c();QS.exports={}});var WS=v(zS=>{"use strict";c();var er=zS;er.build="minimal";er.Writer=Lm();er.BufferWriter=DS();er.Reader=Um();er.BufferReader=qS();er.util=Ei();er.rpc=GS();er.roots=kS();er.configure=KS;function KS(){er.util._configure(),er.Writer._configure(er.BufferWriter),er.Reader._configure(er.BufferReader)}KS()});var YS=v((Ate,$S)=>{"use strict";c();$S.exports=WS()});var XS=v((bte,JS)=>{"use strict";c();var Pa=YS(),bh=Pa.Reader,H4=Pa.Writer,J=Pa.util,Sc=Pa.roots.default||(Pa.roots.default={});Sc.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof bh||(n=new bh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Sc.proto.Transaction)return n;var i=new Sc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Pa.util.toJSONOptions)},e}(),t}();JS.exports=Sc});var eC=v(wr=>{"use strict";c();var G4=wr&&wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q4=wr&&wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4=wr&&wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G4(e,t,r);return Q4(e,t),e},K4=wr&&wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wr,"__esModule",{value:!0});wr.ProtoSerializer=void 0;var z4=K4(Wt()),Vm=Zt(),W4=Lo(),$4=k4(je()),Y4=zf(),ZS=XS(),jm=class{serializeTransaction(e){let r=new Vm.Address(e.getReceiver().bech32()).pubkey(),n=new Vm.Address(e.getSender().bech32()).pubkey(),i=new ZS.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:r,RcvUserName:null,SndAddr:n,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==W4.TRANSACTION_OPTIONS_DEFAULT&&(i.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let a=e.getGuardian();i.GuardAddr=new Vm.Address(a.bech32()).pubkey(),i.GuardSignature=e.getGuardianSignature()}let s=ZS.proto.Transaction.encode(i).finish();return h.Buffer.from(s)}serializeTransactionValue(e){let r=new z4.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=Y4.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new $4.ErrUnsupportedOperation("deserializeTransaction")}};wr.ProtoSerializer=jm});var tC=v(Gs=>{"use strict";c();var J4=Gs&&Gs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X4=Gs&&Gs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&J4(e,t,r)};Object.defineProperty(Gs,"__esModule",{value:!0});X4(eC(),Gs)});var iC=v(an=>{"use strict";c();var Z4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eM=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tM=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z4(e,t,r);return eM(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.Signature=void 0;var rC=tM(je()),nC=64,Rr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Rr.fromHex(e);if(e instanceof h.Buffer)return Rr.fromBuffer(e)}}static empty(){return new Rr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Rr.isValidHex(e))throw new rC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==nC}static fromValidHex(e){let r=new Rr;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=nC)throw new rC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};an.Signature=Rr});var Cc=v(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.TransactionPayload=void 0;var Ba=class{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ba("");let r=h.Buffer.from(e,"base64").toString();return new Ba(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>h.Buffer.from(e,"hex"))}length(){return h.Buffer.from(this.data).length}};Ih.TransactionPayload=Ba});var Hm=v((Bte,sC)=>{c();Un.notEqual=nM;Un.notOk=iM;Un.equal=rM;Un.ok=Un;sC.exports=Un;function rM(t,e,r){Un(t==e,r)}function nM(t,e,r){Un(t!=e,r)}function iM(t,e){Un(!t,e)}function Un(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ua=v(Ma=>{"use strict";c();var Gm=j0(),La=G0(),oC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ma.Buffer=z;Ma.SlowBuffer=lM;Ma.INSPECT_MAX_BYTES=50;var Sh=2147483647;Ma.kMaxLength=Sh;z.TYPED_ARRAY_SUPPORT=sM();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sM(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Sh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return zm(t)}return lC(t,e,r)}z.poolSize=8192;function lC(t,e,r){if(typeof t=="string")return aM(t,e);if(ArrayBuffer.isView(t))return uM(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(un(t,ArrayBuffer)||t&&un(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(un(t,SharedArrayBuffer)||t&&un(t.buffer,SharedArrayBuffer)))return km(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=cM(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return lC(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function fC(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function oM(t,e,r){return fC(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return oM(t,e,r)};function zm(t){return fC(t),qn(t<0?0:Wm(t)|0)}z.allocUnsafe=function(t){return zm(t)};z.allocUnsafeSlow=function(t){return zm(t)};function aM(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=hC(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Qm(t){let e=t.length<0?0:Wm(t.length)|0,r=qn(e);for(let n=0;n=Sh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Sh.toString(16)+" bytes");return t|0}function lM(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),un(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function hC(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||un(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Km(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return AC(t).length;default:if(i)return n?-1:Km(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=hC;function fM(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return AM(this,e,r);case"utf8":case"utf-8":return pC(this,e,r);case"ascii":return EM(this,e,r);case"latin1":case"binary":return vM(this,e,r);case"base64":return mM(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function Qs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};oC&&(z.prototype[oC]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ym(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:aC(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):aC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function aC(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return hM(this,e,r,n);case"utf8":case"utf-8":return dM(this,e,r,n);case"ascii":case"latin1":case"binary":return pM(this,e,r,n);case"base64":return gM(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yM(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mM(t,e,r){return e===0&&r===t.length?Gm.fromByteArray(t):Gm.fromByteArray(t.slice(e,r))}function pC(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return wM(n)}var uC=4096;function wM(t){let e=t.length;if(e<=uC)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Nt(e,4,this.length),La.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),La.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!1,52,8)};function tr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function gC(t,e,r,n,i){vC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function yC(t,e,r,n,i){vC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=Ai(function(e,r=0){return gC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=Ai(function(e,r=0){return yC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=Ai(function(e,r=0){return gC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=Ai(function(e,r=0){return yC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mC(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function wC(t,e,r,n,i){return e=+e,r=r>>>0,i||mC(t,e,r,4,34028234663852886e22,-34028234663852886e22),La.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return wC(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return wC(this,e,r,!1,n)};function EC(t,e,r,n,i){return e=+e,r=r>>>0,i||mC(t,e,r,8,17976931348623157e292,-17976931348623157e292),La.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return EC(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return EC(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=cC(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=cC(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function cC(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function bM(t,e,r){Fa(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Tc(e,t.length-(r+1))}function vC(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Ra.ERR_OUT_OF_RANGE("value",a,t)}bM(n,i,s)}function Fa(t,e){if(typeof t!="number")throw new Ra.ERR_INVALID_ARG_TYPE(e,"number",t)}function Tc(t,e,r){throw Math.floor(t)!==t?(Fa(t,r),new Ra.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ra.ERR_BUFFER_OUT_OF_BOUNDS:new Ra.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var IM=/[^+/0-9A-Za-z-_]/g;function SM(t){if(t=t.split("=")[0],t=t.trim().replace(IM,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Km(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function CM(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function AC(t){return Gm.toByteArray(SM(t))}function Ch(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function un(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ym(t){return t!==t}var xM=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ai(t){return typeof BigInt>"u"?NM:t}function NM(){throw new Error("BigInt not supported")}});var bC=v((Ute,_C)=>{c();_C.exports=Jm;Jm.supported=typeof WebAssembly<"u";function Jm(t){if(!Jm.supported)return null;var e=t&&t.imports,r=DM("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function DM(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(OM)):new(Ua()).Buffer(t,"base64")}function OM(t){return t.charCodeAt(0)}});var DC=v((Hte,ln)=>{c();var cn=Hm(),Ke=bC()(),Vn=64,Th=[];ln.exports=Er;var IC=ln.exports.BYTES_MIN=16,SC=ln.exports.BYTES_MAX=64,Vte=ln.exports.BYTES=32,CC=ln.exports.KEYBYTES_MIN=16,TC=ln.exports.KEYBYTES_MAX=64,jte=ln.exports.KEYBYTES=32,xC=ln.exports.SALTBYTES=16,NC=ln.exports.PERSONALBYTES=16;function Er(t,e,r,n,i){if(!(this instanceof Er))return new Er(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(cn(t>=IC,"digestLength must be at least "+IC+", was given "+t),cn(t<=SC,"digestLength must be at most "+SC+", was given "+t),e!=null&&cn(e.length>=CC,"key must be at least "+CC+", was given "+e.length),e!=null&&cn(e.length<=TC,"key must be at least "+TC+", was given "+e.length),r!=null&&cn(r.length===xC,"salt must be exactly "+xC+", was given "+r.length),n!=null&&cn(n.length===NC,"personal must be exactly "+NC+", was given "+n.length)),Th.length||(Th.push(Vn),Vn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Th.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,Vn,Vn+e.length),Ke.memory[this.pointer+200]=128)}Er.prototype.update=function(t){return cn(this.finalized===!1,"Hash instance finalized"),cn(t,"input must be TypedArray or Buffer"),Vn+t.length>Ke.memory.length&&Ke.realloc(Vn+t.length),Ke.memory.set(t,Vn),Ke.exports.blake2b_update(this.pointer,Vn,Vn+t.length),this};Er.prototype.digest=function(t){if(cn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Th.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return BM(Ke.memory,this.pointer+128,this.digestLength);cn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ii=Hm(),Nc=DC();function xh(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function OC(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function UC(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function _i(t,e,r,n,i,s){var o=xc[i],a=xc[i+1],u=xc[s],l=xc[s+1];xh(Ie,t,e),OC(Ie,t,o,a);var f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1];Ie[n]=d,Ie[n+1]=f,xh(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=f>>>24^d<<8,Ie[e+1]=d>>>24^f<<8,xh(Ie,t,e),OC(Ie,t,u,l),f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1],Ie[n]=f>>>16^d<<16,Ie[n+1]=d>>>16^f<<16,xh(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=d>>>31^f<<1,Ie[e+1]=f>>>31^d<<1}var qC=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),LM=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Gt=new Uint8Array(LM.map(function(t){return t*2})),Ie=new Uint32Array(32),xc=new Uint32Array(32);function VC(t,e){var r=0;for(r=0;r<16;r++)Ie[r]=t.h[r],Ie[r+16]=qC[r];for(Ie[24]=Ie[24]^t.t,Ie[25]=Ie[25]^t.t/4294967296,e&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]),r=0;r<32;r++)xc[r]=UC(t.b,4*r);for(r=0;r<12;r++)_i(0,8,16,24,Gt[r*16+0],Gt[r*16+1]),_i(2,10,18,26,Gt[r*16+2],Gt[r*16+3]),_i(4,12,20,28,Gt[r*16+4],Gt[r*16+5]),_i(6,14,22,30,Gt[r*16+6],Gt[r*16+7]),_i(0,10,20,30,Gt[r*16+8],Gt[r*16+9]),_i(2,12,22,24,Gt[r*16+10],Gt[r*16+11]),_i(4,14,16,26,Gt[r*16+12],Gt[r*16+13]),_i(6,8,18,28,Gt[r*16+14],Gt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ie[r]^Ie[r+16]}var bi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function qa(t,e,r,n){bi.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,bi[0]=t,e&&(bi[1]=e.length),bi[2]=1,bi[3]=1,r&&bi.set(r,32),n&&bi.set(n,48);for(var i=0;i<16;i++)this.h[i]=qC[i]^UC(bi,i*4);e&&(jC(this,e),this.c=128)}qa.prototype.update=function(t){return Ii(t!=null,"input must be Uint8Array or Buffer"),jC(this,t),this};qa.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ii(e.length>=this.outlen,"out must have at least outlen bytes of space"),FM(this,e),t==="hex"?MM(e):e};qa.prototype.final=qa.prototype.digest;qa.ready=function(t){Nc.ready(function(){t()})};function jC(t,e){for(var r=0;r>2]>>8*(r&3);return e}function MM(t){for(var e="",r=0;r=PC,"outlen must be at least "+PC+", was given "+e),Ii(e<=BC,"outlen must be at most "+BC+", was given "+e),r!=null&&Ii(r.length>=RC,"key must be at least "+RC+", was given "+r.length),r!=null&&Ii(r.length<=LC,"key must be at most "+LC+", was given "+r.length),n!=null&&Ii(n.length===FC,"salt must be exactly "+FC+", was given "+n.length),i!=null&&Ii(i.length===MC,"personal must be exactly "+MC+", was given "+i.length)),new HC(e,r,n,i)};rr.exports.ready=function(t){Nc.ready(function(){t()})};rr.exports.WASM_SUPPORTED=Nc.SUPPORTED;rr.exports.WASM_LOADED=!1;var PC=rr.exports.BYTES_MIN=16,BC=rr.exports.BYTES_MAX=64,Qte=rr.exports.BYTES=32,RC=rr.exports.KEYBYTES_MIN=16,LC=rr.exports.KEYBYTES_MAX=64,kte=rr.exports.KEYBYTES=32,FC=rr.exports.SALTBYTES=16,MC=rr.exports.PERSONALBYTES=16;Nc.ready(function(t){t||(rr.exports.WASM_LOADED=!0,HC=Nc)})});var Pc=v(vr=>{"use strict";c();var qM=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VM=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jM=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qM(e,t,r);return VM(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.TransactionHash=vr.Transaction=void 0;var Va=Wt(),Dc=Zt(),HM=wh(),GM=Lo(),QM=jM(je()),kM=JI(),jn=ZI(),KM=tC(),QC=iC(),kC=Cc(),zM=fr(),WM=GC(),$M=32,Oc=class{constructor({nonce:e,value:r,receiver:n,sender:i,gasPrice:s,gasLimit:o,data:a,chainID:u,version:l,options:f,guardian:d}){this.nonce=e||0,this.value=r?new Va.BigNumber(r.toString()).toFixed(0):0,this.sender=i,this.receiver=n,this.gasPrice=s||GM.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new kC.TransactionPayload,this.chainID=u,this.version=l?new jn.TransactionVersion(l.valueOf()):jn.TransactionVersion.withDefaultVersion(),this.options=f?new jn.TransactionOptions(f.valueOf()):jn.TransactionOptions.withDefaultOptions(),this.guardian=d||Dc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Si.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new jn.TransactionVersion(e.valueOf())}getOptions(){return new jn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new jn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return zM.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return HM.Compatibility.guardAddressIsSetAndNonZero(new Dc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new Oc({nonce:Number(e.nonce),value:new Va.BigNumber(e.value).toFixed(0),receiver:Dc.Address.fromString(e.receiver),sender:Dc.Address.fromString(e.sender),guardian:e.guardian==null?void 0:Dc.Address.fromString(e.guardian||""),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new kC.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new jn.TransactionVersion(e.version),options:e.options==null?void 0:new jn.TransactionOptions(e.options)});return e.signature&&r.applySignature(new QC.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new QC.Signature(e.guardianSignature)),r}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}applyGuardianSignature(e){e instanceof h.Buffer?this.guardianSignature=e:this.guardianSignature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new QM.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new Va.BigNumber(this.gasPrice.valueOf()),i=new Va.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new Va.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new Va.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};vr.Transaction=Oc;var Si=class extends kM.Hash{constructor(e){super(e)}static compute(e){let n=new KM.ProtoSerializer().serializeTransaction(e),i=WM($M).update(n).digest("hex");return new Si(i)}};vr.TransactionHash=Si});var KC=v(Dh=>{"use strict";c();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.TransferTransactionsFactory=void 0;var Xm=gh(),Lr=bt(),Nh=Pc(),Zm=Cc(),ew=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new Nh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new Xm.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Zm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Nh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new Xm.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.U64Value(e.tokenTransfer.nonce),new Lr.BigUIntValue(e.tokenTransfer.valueOf()),new Lr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Zm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Nh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new Lr.AddressValue(e.destination),new Lr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Lr.BytesValue.fromUTF8(u.tokenIdentifier),new Lr.U64Value(u.nonce),new Lr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Xm.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Zm.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Nh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Dh.TransferTransactionsFactory=ew});var WC=v(ks=>{"use strict";c();Object.defineProperty(ks,"__esModule",{value:!0});ks.GasEstimator=ks.DefaultGasConfiguration=void 0;ks.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var YM=1e5,zC=8e5,tw=class{constructor(e){this.gasConfiguration=e||ks.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+YM}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+zC}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+zC)*r+this.gasConfiguration.gasPerDataByte*e}};ks.GasEstimator=tw});var Ph=v(Oh=>{"use strict";c();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.Account=void 0;var JM=Zt(),rw=class{constructor(e){this.address=new JM.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};Oh.Account=rw});var nw=v(zs=>{"use strict";c();Object.defineProperty(zs,"__esModule",{value:!0});zs.Logger=zs.LogLevel=void 0;var Ks;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(Ks=zs.LogLevel||(zs.LogLevel={}));var Fr=class{static setLevel(e){Fr.logLevel=e}static trace(e,...r){Fr.logLevel>=Ks.Debug||console.debug(e,r)}static debug(e,...r){Fr.logLevel>=Ks.Debug||console.debug(e,r)}static info(e,...r){Fr.logLevel>=Ks.Info||console.log(e,r)}static warn(e,...r){Fr.logLevel>=Ks.Warn||console.warn(e,r)}static error(e,...r){Fr.logLevel>=Ks.Error||console.error(e,r)}};zs.Logger=Fr;Fr.logLevel=Ks.Debug});var $C=v(fn=>{"use strict";c();var XM=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZM=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eU=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XM(e,t,r);return ZM(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.AsyncTimer=void 0;var tU=eU(je()),rU=je(),iw=nw(),sw=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new tU.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,iw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){iw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new rU.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(iw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};fn.AsyncTimer=sw});var uw=v(Ha=>{"use strict";c();var Ar=Ha&&Ha.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ha,"__esModule",{value:!0});Ha.TransactionWatcher=void 0;var ow=$C(),ja=je(),YC=nw(),_r=class{constructor(e,r={}){this.fetcher=new aw(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||_r.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||_r.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||_r.DefaultPatience}awaitPending(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new ja.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new ja.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new ja.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new ja.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Ar(this,void 0,void 0,function*(){let n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new ja.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Ar(this,void 0,void 0,function*(){let i=new ow.AsyncTimer("watcher:periodic"),s=new ow.AsyncTimer("watcher:patience"),o=new ow.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(YC.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof ja.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};Ha.TransactionWatcher=_r;_r.DefaultPollingInterval=6e3;_r.DefaultTimeout=_r.DefaultPollingInterval*15;_r.DefaultPatience=0;_r.NoopOnStatusReceived=t=>{};var aw=class{constructor(e){this.fetcher=e}getTransaction(e){return Ar(this,void 0,void 0,function*(){return YC.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var JC=v(Lh=>{"use strict";c();Object.defineProperty(Lh,"__esModule",{value:!0});Lh.CodeMetadata=void 0;var cw=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=Bh.Upgradeable),this.readable&&(e|=Bh.Readable),this.payable&&(r|=Rh.Payable),this.payableBySc&&(r|=Rh.PayableBySc),h.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};Lh.CodeMetadata=cw;var Bh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(Bh||(Bh={}));var Rh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Rh||(Rh={}))});var Fh=v(hn=>{"use strict";c();var nU=hn&&hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iU=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sU=hn&&hn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nU(e,t,r);return iU(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.ContractFunction=void 0;var oU=sU(je()),Bc=class{constructor(e){if(this.name=e,e==null)throw new oU.ErrInvalidFunctionName}static none(){return new Bc("untitled")}toString(){return this.name}valueOf(){return this.name}};hn.ContractFunction=Bc});var XC=v(br=>{"use strict";c();var aU=br&&br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uU=br&&br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cU=br&&br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aU(e,t,r);return uU(e,t),e},lU=br&&br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(br,"__esModule",{value:!0});br.InteractionChecker=void 0;var lw=cU(je()),fU=lU(Wt()),fw=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new fU.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new lw.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new lw.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.Query=void 0;var hU=Zt(),dU=gh(),hw=class{constructor(e){this.caller=e.caller||new hU.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new dU.ArgSerializer().valuesToStrings(this.args)}};Mh.Query=hw});var eT=v(qh=>{"use strict";c();Object.defineProperty(qh,"__esModule",{value:!0});qh.Interaction=void 0;var ZC=Zt(),pU=wh(),dw=Lo(),pw=Fh(),gU=XC(),yU=Uh(),Ga=bt(),gw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new ZC.Address,this.sender=new ZC.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new Qa([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){pU.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new pw.ContractFunction(dw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new pw.ContractFunction(dw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new pw.ContractFunction(dw.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new yU.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new Qa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new Qa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new Qa(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new gU.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};qh.Interaction=gw;var Qa=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new Ga.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Ga.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Ga.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Ga.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Ga.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Ga.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var tT=v(Vh=>{"use strict";c();Object.defineProperty(Vh,"__esModule",{value:!0});Vh.ArgumentErrorContext=void 0;var mU=je(),yw=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new mU.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) -Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};Vh.ArgumentErrorContext=yw});var nT=v(Ws=>{"use strict";c();var wU=Ws&&Ws.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.NativeSerializer=void 0;var EU=wU(Wt()),be=bt(),vU=tT(),jh=bt(),AU=Zt(),rT=je(),_U=nm(),bU;(function(t){function e(x,b){x=x||[],r(x),x=n(x,b);let T=b.input,P=[];for(let B=0;B0&&b[0].type.getCardinality().isComposite()&&(P=1/0,B=!0);for(let _ of b){if(_.type.getCardinality().isSingular())break;T-=1}return{min:T,max:P,variadic:B}}function s(x,b,T){if(b instanceof be.OptionType)return o(x,b,T);if(b instanceof be.OptionalType)return a(x,b,T);if(b instanceof be.VariadicType)return u(x,b,T);if(b instanceof be.CompositeType)return f(x,b,T);if(b instanceof be.TupleType)return d(x,b,T);if(b instanceof jh.StructType)return y(x,b,T);if(b instanceof be.ListType)return l(x,b,T);if(b instanceof be.PrimitiveType)return w(x,b,T);T.throwError(`convertToTypedValue: unhandled type ${b}`)}function o(x,b,T){if(x==null)return be.OptionValue.newMissing();let P=s(x,b.getFirstTypeParameter(),T);return be.OptionValue.newProvided(P)}function a(x,b,T){if(x==null)return new be.OptionalValue(b);let P=s(x,b.getFirstTypeParameter(),T);return new be.OptionalValue(b,P)}function u(x,b,T){x==null&&(x=[]),x.map===void 0&&T.convertError(x,"Variadic");let P=x.map(function(B){return s(B,b.getFirstTypeParameter(),T)});return new be.VariadicValue(b,P)}function l(x,b,T){x.map===void 0&&T.convertError(x,"List");let P=x.map(function(B){return s(B,b.getFirstTypeParameter(),T)});return new be.List(b,P)}function f(x,b,T){let P=[],B=b.getTypeParameters();T.guardSameLength(x,B);for(let _=0;_{"use strict";c();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.ContractCallPayloadBuilder=Mr.ContractUpgradePayloadBuilder=Mr.ContractDeployPayloadBuilder=Mr.ArwenVirtualMachine=void 0;var vw=Cc(),Aw=fr(),IU=gh();Mr.ArwenVirtualMachine="0500";var mw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Aw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Mr.ArwenVirtualMachine}@${r}`;return n=_w(n,this.arguments),new vw.TransactionPayload(n)}};Mr.ContractDeployPayloadBuilder=mw;var ww=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Aw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=_w(n,this.arguments),new vw.TransactionPayload(n)}};Mr.ContractUpgradePayloadBuilder=ww;var Ew=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){Aw.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=_w(e,this.arguments),new vw.TransactionPayload(e)}};Mr.ContractCallPayloadBuilder=Ew;function _w(t,e){let{argumentsString:r,count:n}=new IU.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Hn=v((Ire,bw)=>{"use strict";c();var ka=typeof Reflect=="object"?Reflect:null,sT=ka&&typeof ka.apply=="function"?ka.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Hh;ka&&typeof ka.ownKeys=="function"?Hh=ka.ownKeys:Object.getOwnPropertySymbols?Hh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Hh=function(e){return Object.getOwnPropertyNames(e)};function SU(t){console&&console.warn&&console.warn(t)}var aT=Number.isNaN||function(e){return e!==e};function He(){He.init.call(this)}bw.exports=He;bw.exports.once=NU;He.EventEmitter=He;He.prototype._events=void 0;He.prototype._eventsCount=0;He.prototype._maxListeners=void 0;var oT=10;function Gh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(He,"defaultMaxListeners",{enumerable:!0,get:function(){return oT},set:function(t){if(typeof t!="number"||t<0||aT(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");oT=t}});He.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};He.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||aT(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function uT(t){return t._maxListeners===void 0?He.defaultMaxListeners:t._maxListeners}He.prototype.getMaxListeners=function(){return uT(this)};He.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")sT(u,this,r);else for(var l=u.length,f=dT(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,SU(a)}return t}He.prototype.addListener=function(e,r){return cT(this,e,r,!1)};He.prototype.on=He.prototype.addListener;He.prototype.prependListener=function(e,r){return cT(this,e,r,!0)};function CU(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function lT(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=CU.bind(n);return i.listener=r,n.wrapFn=i,i}He.prototype.once=function(e,r){return Gh(r),this.on(e,lT(this,e,r)),this};He.prototype.prependOnceListener=function(e,r){return Gh(r),this.prependListener(e,lT(this,e,r)),this};He.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Gh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():TU(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};He.prototype.off=He.prototype.removeListener;He.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function fT(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?xU(i):dT(i,i.length)}He.prototype.listeners=function(e){return fT(this,e,!0)};He.prototype.rawListeners=function(e){return fT(this,e,!1)};He.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):hT.call(t,e)};He.prototype.listenerCount=hT;function hT(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}He.prototype.eventNames=function(){return this._eventsCount>0?Hh(this._events):[]};function dT(t,e){for(var r=new Array(e),n=0;n{c();gT.exports=Hn().EventEmitter});var Sw=v(()=>{c()});var AT=v((Ore,vT)=>{"use strict";c();function yT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function mT(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return Qh.alloc(0);for(var n=Qh.allocUnsafe(r>>>0),i=this.head,s=0;i;)UU(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=Qh.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:MU,value:function(r,n){return Cw(this,mT(mT({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var xw=v((Bre,bT)=>{"use strict";c();function qU(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(Tw,this,t)):p.default.nextTick(Tw,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(kh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(_T,r,s)):p.default.nextTick(_T,r,s):e?(p.default.nextTick(kh,r),e(s)):p.default.nextTick(kh,r)}),this)}function _T(t,e){Tw(t,e),kh(t)}function kh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function VU(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Tw(t,e){t.emit("error",e)}function jU(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}bT.exports={destroy:qU,undestroy:VU,errorOrDestroy:jU}});var $s=v((Lre,CT)=>{"use strict";c();function HU(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var ST={};function Ir(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){HU(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,ST[t]=i}function IT(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function GU(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function QU(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function kU(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Ir("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ir("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&GU(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(QU(t," argument"))i="The ".concat(t," ").concat(n," ").concat(IT(e,"type"));else{var s=kU(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(IT(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Ir("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ir("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ir("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ir("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ir("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ir("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ir("ERR_STREAM_WRITE_AFTER_END","write after end");Ir("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ir("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ir("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");CT.exports.codes=ST});var Nw=v((Mre,TT)=>{"use strict";c();var KU=$s().codes.ERR_INVALID_OPT_VALUE;function zU(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function WU(t,e,r,n){var i=zU(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new KU(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}TT.exports={getHighWaterMark:WU}});var Ka=v((qre,Dw)=>{c();typeof Object.create=="function"?Dw.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Dw.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var NT=v((jre,xT)=>{c();xT.exports=$U;function $U(t,e){if(Ow("noDeprecation"))return t;var r=!1;function n(){if(!r){if(Ow("throwDeprecation"))throw new Error(e);Ow("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function Ow(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var Rw=v((Gre,LT)=>{"use strict";c();LT.exports=at;function OT(t){var e=this;this.next=null,this.entry=null,this.finish=function(){_q(e,t)}}var za;at.WritableState=Lc;var YU={deprecate:NT()},PT=Iw(),zh=Ua().Buffer,JU=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function XU(t){return zh.from(t)}function ZU(t){return zh.isBuffer(t)||t instanceof JU}var Bw=xw(),eq=Nw(),tq=eq.getHighWaterMark,Ci=$s().codes,rq=Ci.ERR_INVALID_ARG_TYPE,nq=Ci.ERR_METHOD_NOT_IMPLEMENTED,iq=Ci.ERR_MULTIPLE_CALLBACK,sq=Ci.ERR_STREAM_CANNOT_PIPE,oq=Ci.ERR_STREAM_DESTROYED,aq=Ci.ERR_STREAM_NULL_VALUES,uq=Ci.ERR_STREAM_WRITE_AFTER_END,cq=Ci.ERR_UNKNOWN_ENCODING,Wa=Bw.errorOrDestroy;Ka()(at,PT);function lq(){}function Lc(t,e,r){za=za||Ys(),t=t||{},typeof r!="boolean"&&(r=e instanceof za),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=tq(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){mq(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new OT(this)}Lc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Lc.prototype,"buffer",{get:YU.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Kh;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Kh=Function.prototype[Symbol.hasInstance],Object.defineProperty(at,Symbol.hasInstance,{value:function(e){return Kh.call(this,e)?!0:this!==at?!1:e&&e._writableState instanceof Lc}})):Kh=function(e){return e instanceof this};function at(t){za=za||Ys();var e=this instanceof za;if(!e&&!Kh.call(at,this))return new at(t);this._writableState=new Lc(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),PT.call(this)}at.prototype.pipe=function(){Wa(this,new sq)};function fq(t,e){var r=new uq;Wa(t,r),p.default.nextTick(e,r)}function hq(t,e,r,n){var i;return r===null?i=new aq:typeof r!="string"&&!e.objectMode&&(i=new rq("chunk",["string","Buffer"],r)),i?(Wa(t,i),p.default.nextTick(n,i),!1):!0}at.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&ZU(t);return s&&!zh.isBuffer(t)&&(t=XU(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=lq),n.ending?fq(this,r):(s||hq(this,n,t,r))&&(n.pendingcb++,i=pq(this,n,s,t,e,r)),i};at.prototype.cork=function(){this._writableState.corked++};at.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&BT(this,t))};at.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new cq(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(at.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function dq(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=zh.from(e,r)),e}Object.defineProperty(at.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function pq(t,e,r,n,i,s){if(!r){var o=dq(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var bq=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};MT.exports=dn;var FT=Mw(),Fw=Rw();Ka()(dn,FT);for(Lw=bq(Fw.prototype),Wh=0;Wh{c();var Yh=Ua(),pn=Yh.Buffer;function UT(t,e){for(var r in t)e[r]=t[r]}pn.from&&pn.alloc&&pn.allocUnsafe&&pn.allocUnsafeSlow?qT.exports=Yh:(UT(Yh,Uw),Uw.Buffer=Js);function Js(t,e,r){return pn(t,e,r)}Js.prototype=Object.create(pn.prototype);UT(pn,Js);Js.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return pn(t,e,r)};Js.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=pn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Js.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return pn(t)};Js.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Yh.SlowBuffer(t)}});var jw=v(HT=>{"use strict";c();var Vw=VT().Buffer,jT=Vw.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Cq(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Tq(t){var e=Cq(t);if(typeof e!="string"&&(Vw.isEncoding===jT||!jT(t)))throw new Error("Unknown encoding: "+t);return e||t}HT.StringDecoder=Fc;function Fc(t){this.encoding=Tq(t);var e;switch(this.encoding){case"utf16le":this.text=Bq,this.end=Rq,e=4;break;case"utf8":this.fillLast=Dq,e=4;break;case"base64":this.text=Lq,this.end=Fq,e=3;break;default:this.write=Mq,this.end=Uq;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Vw.allocUnsafe(e)}Fc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function xq(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Nq(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Dq(t){var e=this.lastTotal-this.lastNeed,r=Nq(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Oq(t,e){var r=xq(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Pq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Bq(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Rq(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Lq(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Fq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Mq(t){return t.toString(this.encoding)}function Uq(t){return t&&t.length?this.write(t):""}});var Jh=v((Yre,kT)=>{"use strict";c();var GT=$s().codes.ERR_STREAM_PREMATURE_CLOSE;function qq(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var Xh;function Ti(t,e,r){return e=Hq(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Hq(t){var e=Gq(t,"string");return typeof e=="symbol"?e:String(e)}function Gq(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qq=Jh(),xi=Symbol("lastResolve"),Xs=Symbol("lastReject"),Mc=Symbol("error"),Zh=Symbol("ended"),Zs=Symbol("lastPromise"),Hw=Symbol("handlePromise"),eo=Symbol("stream");function Ni(t,e){return{value:t,done:e}}function kq(t){var e=t[xi];if(e!==null){var r=t[eo].read();r!==null&&(t[Zs]=null,t[xi]=null,t[Xs]=null,e(Ni(r,!1)))}}function Kq(t){p.default.nextTick(kq,t)}function zq(t,e){return function(r,n){t.then(function(){if(e[Zh]){r(Ni(void 0,!0));return}e[Hw](r,n)},n)}}var Wq=Object.getPrototypeOf(function(){}),$q=Object.setPrototypeOf((Xh={get stream(){return this[eo]},next:function(){var e=this,r=this[Mc];if(r!==null)return Promise.reject(r);if(this[Zh])return Promise.resolve(Ni(void 0,!0));if(this[eo].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Mc]?a(e[Mc]):o(Ni(void 0,!0))})});var n=this[Zs],i;if(n)i=new Promise(zq(n,this));else{var s=this[eo].read();if(s!==null)return Promise.resolve(Ni(s,!1));i=new Promise(this[Hw])}return this[Zs]=i,i}},Ti(Xh,Symbol.asyncIterator,function(){return this}),Ti(Xh,"return",function(){var e=this;return new Promise(function(r,n){e[eo].destroy(null,function(i){if(i){n(i);return}r(Ni(void 0,!0))})})}),Xh),Wq),Yq=function(e){var r,n=Object.create($q,(r={},Ti(r,eo,{value:e,writable:!0}),Ti(r,xi,{value:null,writable:!0}),Ti(r,Xs,{value:null,writable:!0}),Ti(r,Mc,{value:null,writable:!0}),Ti(r,Zh,{value:e._readableState.endEmitted,writable:!0}),Ti(r,Hw,{value:function(s,o){var a=n[eo].read();a?(n[Zs]=null,n[xi]=null,n[Xs]=null,s(Ni(a,!1))):(n[xi]=s,n[Xs]=o)},writable:!0}),r));return n[Zs]=null,Qq(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Xs];s!==null&&(n[Zs]=null,n[xi]=null,n[Xs]=null,s(i)),n[Mc]=i;return}var o=n[xi];o!==null&&(n[Zs]=null,n[xi]=null,n[Xs]=null,o(Ni(void 0,!0))),n[Zh]=!0}),e.on("readable",Kq.bind(null,n)),n};KT.exports=Yq});var $T=v((ene,WT)=>{c();WT.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Mw=v((nne,sx)=>{"use strict";c();sx.exports=Fe;var $a;Fe.ReadableState=ZT;var rne=Hn().EventEmitter,XT=function(e,r){return e.listeners(r).length},qc=Iw(),ed=Ua().Buffer,Jq=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Xq(t){return ed.from(t)}function Zq(t){return ed.isBuffer(t)||t instanceof Jq}var Gw=Sw(),xe;Gw&&Gw.debuglog?xe=Gw.debuglog("stream"):xe=function(){};var eV=AT(),Yw=xw(),tV=Nw(),rV=tV.getHighWaterMark,td=$s().codes,nV=td.ERR_INVALID_ARG_TYPE,iV=td.ERR_STREAM_PUSH_AFTER_EOF,sV=td.ERR_METHOD_NOT_IMPLEMENTED,oV=td.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ya,Qw,kw;Ka()(Fe,qc);var Uc=Yw.errorOrDestroy,Kw=["error","close","destroy","pause","resume"];function aV(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function ZT(t,e,r){$a=$a||Ys(),t=t||{},typeof r!="boolean"&&(r=e instanceof $a),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=rV(this,t,"readableHighWaterMark",r),this.buffer=new eV,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Ya||(Ya=jw().StringDecoder),this.decoder=new Ya(t.encoding),this.encoding=t.encoding)}function Fe(t){if($a=$a||Ys(),!(this instanceof Fe))return new Fe(t);var e=this instanceof $a;this._readableState=new ZT(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),qc.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=Yw.destroy;Fe.prototype._undestroy=Yw.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=ed.from(t,e),e=""),n=!0),ex(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return ex(this,t,null,!0,!1)};function ex(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,lV(t,s);else{var o;if(i||(o=uV(s,e)),o)Uc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==ed.prototype&&(e=Xq(e)),n)s.endEmitted?Uc(t,new oV):zw(t,s,e,!0);else if(s.ended)Uc(t,new iV);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?zw(t,s,e,!1):$w(t,s)):zw(t,s,e,!1)}else n||(s.reading=!1,$w(t,s))}return!s.ended&&(s.length=YT?t=YT:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function JT(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=cV(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Ww(this):rd(this),null;if(t=JT(t,e),t===0&&e.ended)return e.length===0&&Ww(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=nx(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Ww(this)),i!==null&&this.emit("data",i),i};function lV(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?rd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,tx(t)))}}function rd(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(tx,t))}function tx(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Jw(t)}function $w(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(fV,t,e))}function fV(t,e){for(;!e.reading&&!e.ended&&(e.length1&&ix(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function y(R){xe("onerror",R),N(),t.removeListener("error",y),XT(t,"error")===0&&Uc(t,R)}aV(t,"error",y);function w(){t.removeListener("finish",E),N()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),N()}t.once("finish",E);function N(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function hV(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&XT(t,"data")&&(r.flowing=!0,Jw(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?rd(this):n.reading||p.default.nextTick(dV,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=qc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(rx,this),r};Fe.prototype.removeAllListeners=function(t){var e=qc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(rx,this),e};function rx(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function dV(t){xe("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,pV(this,t)),t.paused=!1,this};function pV(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(gV,t,e))}function gV(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Jw(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Jw(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Ww(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(yV,e,t))}function yV(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return kw===void 0&&(kw=$T()),kw(Fe,t,e)});function ix(t,e){for(var r=0,n=t.length;r{"use strict";c();ax.exports=Gn;var nd=$s().codes,mV=nd.ERR_METHOD_NOT_IMPLEMENTED,wV=nd.ERR_MULTIPLE_CALLBACK,EV=nd.ERR_TRANSFORM_ALREADY_TRANSFORMING,vV=nd.ERR_TRANSFORM_WITH_LENGTH_0,id=Ys();Ka()(Gn,id);function AV(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new wV);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();cx.exports=Vc;var ux=Xw();Ka()(Vc,ux);function Vc(t){if(!(this instanceof Vc))return new Vc(t);ux.call(this,t)}Vc.prototype._transform=function(t,e,r){r(null,t)}});var gx=v((cne,px)=>{"use strict";c();var Zw;function bV(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var dx=$s().codes,IV=dx.ERR_MISSING_ARGS,SV=dx.ERR_STREAM_DESTROYED;function fx(t){if(t)throw t}function CV(t){return t.setHeader&&typeof t.abort=="function"}function TV(t,e,r,n){n=bV(n);var i=!1;t.on("close",function(){i=!0}),Zw===void 0&&(Zw=Jh()),Zw(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,CV(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new SV("pipe"))}}}function hx(t){t()}function xV(t,e){return t.pipe(e)}function NV(t){return!t.length||typeof t[t.length-1]!="function"?fx:t.pop()}function DV(){for(var t=arguments.length,e=new Array(t),r=0;r0;return TV(o,u,l,function(f){i||(i=f),f&&s.forEach(hx),!u&&(s.forEach(hx),n(i))})});return e.reduce(xV)}px.exports=DV});var eE=v((Sr,yx)=>{c();Sr=yx.exports=Mw();Sr.Stream=Sr;Sr.Readable=Sr;Sr.Writable=Rw();Sr.Duplex=Ys();Sr.Transform=Xw();Sr.PassThrough=lx();Sr.finished=Jh();Sr.pipeline=gx()});var Ex=v((hne,wx)=>{c();var{Transform:OV}=eE();wx.exports=t=>class mx extends OV{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new mx(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _x=v((pne,Ax)=>{c();var{Transform:PV}=eE();Ax.exports=t=>class vx extends PV{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new vx(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var Ix=v((yne,bx)=>{c();var BV=Ex(),RV=_x();bx.exports=function(t){let e=BV(t),r=RV(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var Tx=v(Cx=>{c();var Sx=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Cx.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],y=f^(i<<1|s>>>31),w=d^(s<<1|i>>>31),E=t[0]^y,N=t[1]^w,R=t[10]^y,M=t[11]^w,x=t[20]^y,b=t[21]^w,T=t[30]^y,P=t[31]^w,B=t[40]^y,_=t[41]^w;y=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let S=t[2]^y,F=t[3]^w,Z=t[12]^y,K=t[13]^w,H=t[22]^y,G=t[23]^w,$=t[32]^y,pe=t[33]^w,ae=t[42]^y,re=t[43]^w;y=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^y,ie=t[5]^w,te=t[14]^y,ne=t[15]^w,q=t[24]^y,ce=t[25]^w,oe=t[34]^y,le=t[35]^w,se=t[44]^y,ue=t[45]^w;y=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let g=t[6]^y,m=t[7]^w,A=t[16]^y,O=t[17]^w,I=t[26]^y,D=t[27]^w,L=t[36]^y,C=t[37]^w,U=t[46]^y,j=t[47]^w;y=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let V=t[8]^y,X=t[9]^w,ye=t[18]^y,we=t[19]^w,Pe=t[28]^y,$e=t[29]^w,st=t[38]^y,De=t[39]^w,Me=t[48]^y,vt=t[49]^w,ni=E,os=N,as=M<<4|R>>>28,Yt=R<<4|M>>>28,Dn=x<<3|b>>>29,qt=b<<3|x>>>29,At=P<<9|T>>>23,Qe=T<<9|P>>>23,Xg=B<<18|_>>>14,Zg=_<<18|B>>>14,e0=S<<1|F>>>31,t0=F<<1|S>>>31,r0=K<<12|Z>>>20,n0=Z<<12|K>>>20,i0=H<<10|G>>>22,s0=G<<10|H>>>22,o0=pe<<13|$>>>19,a0=$<<13|pe>>>19,u0=ae<<2|re>>>30,c0=re<<2|ae>>>30,l0=ie<<30|Y>>>2,f0=Y<<30|ie>>>2,h0=te<<6|ne>>>26,d0=ne<<6|te>>>26,p0=ce<<11|q>>>21,g0=q<<11|ce>>>21,y0=oe<<15|le>>>17,m0=le<<15|oe>>>17,w0=ue<<29|se>>>3,E0=se<<29|ue>>>3,v0=g<<28|m>>>4,A0=m<<28|g>>>4,_0=O<<23|A>>>9,b0=A<<23|O>>>9,I0=I<<25|D>>>7,S0=D<<25|I>>>7,C0=L<<21|C>>>11,T0=C<<21|L>>>11,x0=j<<24|U>>>8,N0=U<<24|j>>>8,D0=V<<27|X>>>5,O0=X<<27|V>>>5,P0=ye<<20|we>>>12,B0=we<<20|ye>>>12,R0=$e<<7|Pe>>>25,L0=Pe<<7|$e>>>25,F0=st<<8|De>>>24,M0=De<<8|st>>>24,U0=Me<<14|vt>>>18,q0=vt<<14|Me>>>18;t[0]=ni^~r0&p0,t[1]=os^~n0&g0,t[10]=v0^~P0&Dn,t[11]=A0^~B0&qt,t[20]=e0^~h0&I0,t[21]=t0^~d0&S0,t[30]=D0^~as&i0,t[31]=O0^~Yt&s0,t[40]=l0^~_0&R0,t[41]=f0^~b0&L0,t[2]=r0^~p0&C0,t[3]=n0^~g0&T0,t[12]=P0^~Dn&o0,t[13]=B0^~qt&a0,t[22]=h0^~I0&F0,t[23]=d0^~S0&M0,t[32]=as^~i0&y0,t[33]=Yt^~s0&m0,t[42]=_0^~R0&At,t[43]=b0^~L0&Qe,t[4]=p0^~C0&U0,t[5]=g0^~T0&q0,t[14]=Dn^~o0&w0,t[15]=qt^~a0&E0,t[24]=I0^~F0&Xg,t[25]=S0^~M0&Zg,t[34]=i0^~y0&x0,t[35]=s0^~m0&N0,t[44]=R0^~At&u0,t[45]=L0^~Qe&c0,t[6]=C0^~U0&ni,t[7]=T0^~q0&os,t[16]=o0^~w0&v0,t[17]=a0^~E0&A0,t[26]=F0^~Xg&e0,t[27]=M0^~Zg&t0,t[36]=y0^~x0&D0,t[37]=m0^~N0&O0,t[46]=At^~u0&l0,t[47]=Qe^~c0&f0,t[8]=U0^~ni&r0,t[9]=q0^~os&n0,t[18]=w0^~v0&P0,t[19]=E0^~A0&B0,t[28]=Xg^~e0&h0,t[29]=Zg^~t0&d0,t[38]=x0^~D0&as,t[39]=N0^~O0&Yt,t[48]=u0^~l0&_0,t[49]=c0^~f0&b0,t[0]^=Sx[e*2],t[1]^=Sx[e*2+1]}}});var Nx=v((vne,xx)=>{c();var sd=Tx();function Ja(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Ja.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};Ja.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(sd.p1600(this.state),this.count=0);return e};Ja.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};xx.exports=Ja});var Ox=v((_ne,Dx)=>{c();Dx.exports=Ix()(Nx())});var Lx=v(Xa=>{"use strict";c();var LV=Xa&&Xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xa,"__esModule",{value:!0});Xa.SmartContract=void 0;var FV=LV(Wt()),jc=Zt(),tE=wh(),MV=je(),rE=Pc(),UV=fr(),qV=zf(),Px=JC(),Bx=Fh(),Rx=eT(),VV=nT(),jV=Uh(),od=iT(),HV=Ox(),nE=class{constructor(e={}){this.address=new jc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new jc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new Bx.ContractFunction(i);return new Rx.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new Bx.ContractFunction(i),a=VV.NativeSerializer.nativeToTypedValues(s||[],n);return new Rx.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return UV.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){tE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new Px.CodeMetadata,i=i||[],s=s||0;let l=new od.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new rE.Transaction({receiver:jc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){tE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new Px.CodeMetadata,i=i||[],s=s||0;let l=new od.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new rE.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){tE.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new od.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new rE.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new jV.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new MV.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new jc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new FV.default(r.valueOf().toString(10)),u=qV.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=HV("keccak256").update(l).digest(),d=h.Buffer.from(od.ArwenVirtualMachine,"hex"),y=h.Buffer.concat([n,d,f.slice(10,30),s]);return new jc.Address(y)}};Xa.SmartContract=nE});var Fx=v(Za=>{"use strict";c();Object.defineProperty(Za,"__esModule",{value:!0});Za.Signature=Za.Address=void 0;var iE=class{constructor(e){this.value=e}bech32(){return this.value}};Za.Address=iE;var sE=class{constructor(e){this.value=e}hex(){return this.value}};Za.Signature=sE});var Mx=v(Hc=>{"use strict";c();Object.defineProperty(Hc,"__esModule",{value:!0});Hc.Operation=void 0;var GV;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(GV=Hc.Operation||(Hc.Operation={}))});var Ux=v(Di=>{"use strict";c();Object.defineProperty(Di,"__esModule",{value:!0});Di.ErrAccountNotConnected=Di.ErrCannotSignSingleTransaction=Di.Err=void 0;var Gc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Di.Err=Gc;var oE=class extends Gc{constructor(){super("Cannot sign single transaction.")}};Di.ErrCannotSignSingleTransaction=oE;var aE=class extends Gc{constructor(){super("Account is not connected.")}};Di.ErrAccountNotConnected=aE});var uE=v(eu=>{"use strict";c();var Oi=eu&&eu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(eu,"__esModule",{value:!0});eu.ExtensionProvider=void 0;var ad=Fx(),Qc=Mx(),qx=Ux(),gn=class{constructor(){if(this.account={address:""},this.initialized=!1,gn._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");gn._instance=this}static getInstance(){return gn._instance}setAddress(e){return this.account.address=e,gn._instance}init(){return Oi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Qc.Operation.Connect,n),this.account.address})}logout(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Qc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Oi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new qx.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new qx.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Qc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{for(let n=0;n{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};eu.ExtensionProvider=gn;gn._instance=new gn});var kx=v((Gne,Qx)=>{"use strict";c();function QV(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Qx.exports=kV;function kV(t,e,r){var n=r&&r.stringify||QV,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var Kx=kx();$x.exports=mn;var kc=tj().console||{},KV={mapHttpRequest:hd,mapHttpResponse:hd,wrapRequestSerializer:cE,wrapResponseSerializer:cE,wrapErrorSerializer:cE,req:hd,res:hd,err:JV};function zV(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function mn(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||kc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=zV(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=Kc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:y});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:XV(t)};u.levels=mn.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Kc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=lE());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function y(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,tu(l,u,"error","log"),tu(l,u,"fatal","error"),tu(l,u,"warn","error"),tu(l,u,"info","log"),tu(l,u,"debug","log"),tu(l,u,"trace","log")}function w(E,N){if(!E)throw new Error("missing bindings for child Pino");N=N||{},i&&E.serializers&&(N.serializers=E.serializers);let R=N.serializers;if(i&&R){var M=Object.assign({},n,R),x=t.browser.serialize===!0?Object.keys(M):i;delete E.serializers,dd([E],x,M,this._stdErrSerialize)}function b(T){this._childLevel=(T._childLevel|0)+1,this.error=ru(T,E,"error"),this.fatal=ru(T,E,"fatal"),this.warn=ru(T,E,"warn"),this.info=ru(T,E,"info"),this.debug=ru(T,E,"debug"),this.trace=ru(T,E,"trace"),M&&(this.serializers=M,this._serialize=x),e&&(this._logEvent=lE([].concat(T._logEvent.bindings,E)))}return b.prototype=this,new b(this)}return u}mn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};mn.stdSerializers=KV;mn.stdTimeFunctions=Object.assign({},{nullTime:zx,epochTime:Wx,unixTime:ZV,isoTime:ej});function tu(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Kc:i[r]?i[r]:kc[r]||kc[n]||Kc,WV(t,e,r)}function WV(t,e,r){!t.transmit&&e[r]===Kc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===kc?kc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ru(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;ihE,__asyncDelegator:()=>pj,__asyncGenerator:()=>dj,__asyncValues:()=>gj,__await:()=>zc,__awaiter:()=>aj,__classPrivateFieldGet:()=>Ej,__classPrivateFieldSet:()=>vj,__createBinding:()=>cj,__decorate:()=>ij,__exportStar:()=>lj,__extends:()=>rj,__generator:()=>uj,__importDefault:()=>wj,__importStar:()=>mj,__makeTemplateObject:()=>yj,__metadata:()=>oj,__param:()=>sj,__read:()=>Yx,__rest:()=>nj,__spread:()=>fj,__spreadArrays:()=>hj,__values:()=>dE});function rj(t,e){fE(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function nj(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function sj(t,e){return function(r,n){e(r,n,t)}}function oj(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function aj(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function uj(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Yx(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function fj(){for(var t=[],e=0;e1||a(y,w)})})}function a(y,w){try{u(n[y](w))}catch(E){d(s[0][3],E)}}function u(y){y.value instanceof zc?Promise.resolve(y.value.v).then(l,f):d(s[0][2],y)}function l(y){a("next",y)}function f(y){a("throw",y)}function d(y,w){y(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function pj(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:zc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function gj(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof dE=="function"?dE(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function yj(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function mj(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function wj(t){return t&&t.__esModule?t:{default:t}}function Ej(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function vj(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var fE,hE,ar=ge(()=>{c();fE=function(t,e){return fE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},fE(t,e)};hE=function(){return hE=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(gd,"__esModule",{value:!0});function Aj(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}gd.safeJsonParse=Aj;function _j(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}gd.safeJsonStringify=_j});var Jx=v((Yne,yd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?yd.exports=global.localStorage:typeof window<"u"&&window.localStorage?yd.exports=window.localStorage:yd.exports=new e})()});var Xx=v(md=>{"use strict";c();Object.defineProperty(md,"__esModule",{value:!0});md.IKeyValueStorage=void 0;var gE=class{};md.IKeyValueStorage=gE});var Zx=v(wd=>{"use strict";c();Object.defineProperty(wd,"__esModule",{value:!0});wd.parseEntry=void 0;var bj=pE();function Ij(t){var e;return[t[0],bj.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}wd.parseEntry=Ij});var t2=v(Ed=>{"use strict";c();Object.defineProperty(Ed,"__esModule",{value:!0});var e2=(ar(),rt(or));e2.__exportStar(Xx(),Ed);e2.__exportStar(Zx(),Ed)});var n2=v(Wc=>{"use strict";c();Object.defineProperty(Wc,"__esModule",{value:!0});Wc.KeyValueStorage=void 0;var nu=(ar(),rt(or)),r2=pE(),Sj=nu.__importDefault(Jx()),Cj=t2(),vd=class{constructor(){this.localStorage=Sj.default}getKeys(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(Cj.parseEntry)})}getItem(e){return nu.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return r2.safeJsonParse(r)})}setItem(e,r){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,r2.safeJsonStringify(r))})}removeItem(e){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Wc.KeyValueStorage=vd;Wc.default=vd});var i2=v(Ad=>{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.delay=void 0;function Tj(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ad.delay=Tj});var s2=v(iu=>{"use strict";c();Object.defineProperty(iu,"__esModule",{value:!0});iu.ONE_THOUSAND=iu.ONE_HUNDRED=void 0;iu.ONE_HUNDRED=100;iu.ONE_THOUSAND=1e3});var o2=v(he=>{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ONE_YEAR=he.FOUR_WEEKS=he.THREE_WEEKS=he.TWO_WEEKS=he.ONE_WEEK=he.THIRTY_DAYS=he.SEVEN_DAYS=he.FIVE_DAYS=he.THREE_DAYS=he.ONE_DAY=he.TWENTY_FOUR_HOURS=he.TWELVE_HOURS=he.SIX_HOURS=he.THREE_HOURS=he.ONE_HOUR=he.SIXTY_MINUTES=he.THIRTY_MINUTES=he.TEN_MINUTES=he.FIVE_MINUTES=he.ONE_MINUTE=he.SIXTY_SECONDS=he.THIRTY_SECONDS=he.TEN_SECONDS=he.FIVE_SECONDS=he.ONE_SECOND=void 0;he.ONE_SECOND=1;he.FIVE_SECONDS=5;he.TEN_SECONDS=10;he.THIRTY_SECONDS=30;he.SIXTY_SECONDS=60;he.ONE_MINUTE=he.SIXTY_SECONDS;he.FIVE_MINUTES=he.ONE_MINUTE*5;he.TEN_MINUTES=he.ONE_MINUTE*10;he.THIRTY_MINUTES=he.ONE_MINUTE*30;he.SIXTY_MINUTES=he.ONE_MINUTE*60;he.ONE_HOUR=he.SIXTY_MINUTES;he.THREE_HOURS=he.ONE_HOUR*3;he.SIX_HOURS=he.ONE_HOUR*6;he.TWELVE_HOURS=he.ONE_HOUR*12;he.TWENTY_FOUR_HOURS=he.ONE_HOUR*24;he.ONE_DAY=he.TWENTY_FOUR_HOURS;he.THREE_DAYS=he.ONE_DAY*3;he.FIVE_DAYS=he.ONE_DAY*5;he.SEVEN_DAYS=he.ONE_DAY*7;he.THIRTY_DAYS=he.ONE_DAY*30;he.ONE_WEEK=he.SEVEN_DAYS;he.TWO_WEEKS=he.ONE_WEEK*2;he.THREE_WEEKS=he.ONE_WEEK*3;he.FOUR_WEEKS=he.ONE_WEEK*4;he.ONE_YEAR=he.ONE_DAY*365});var yE=v(_d=>{"use strict";c();Object.defineProperty(_d,"__esModule",{value:!0});var a2=(ar(),rt(or));a2.__exportStar(s2(),_d);a2.__exportStar(o2(),_d)});var c2=v(su=>{"use strict";c();Object.defineProperty(su,"__esModule",{value:!0});su.fromMiliseconds=su.toMiliseconds=void 0;var u2=yE();function xj(t){return t*u2.ONE_THOUSAND}su.toMiliseconds=xj;function Nj(t){return Math.floor(t/u2.ONE_THOUSAND)}su.fromMiliseconds=Nj});var f2=v(bd=>{"use strict";c();Object.defineProperty(bd,"__esModule",{value:!0});var l2=(ar(),rt(or));l2.__exportStar(i2(),bd);l2.__exportStar(c2(),bd)});var h2=v($c=>{"use strict";c();Object.defineProperty($c,"__esModule",{value:!0});$c.Watch=void 0;var Id=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};$c.Watch=Id;$c.default=Id});var d2=v(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.IWatch=void 0;var mE=class{};Sd.IWatch=mE});var p2=v(wE=>{"use strict";c();Object.defineProperty(wE,"__esModule",{value:!0});var Dj=(ar(),rt(or));Dj.__exportStar(d2(),wE)});var to=v(ou=>{"use strict";c();Object.defineProperty(ou,"__esModule",{value:!0});var Cd=(ar(),rt(or));Cd.__exportStar(f2(),ou);Cd.__exportStar(h2(),ou);Cd.__exportStar(p2(),ou);Cd.__exportStar(yE(),ou)});var EE,g2=ge(()=>{c();EE=class{}});var vE={};ot(vE,{IEvents:()=>EE});var AE=ge(()=>{c();g2()});var y2=v(Td=>{"use strict";c();Object.defineProperty(Td,"__esModule",{value:!0});Td.IHeartBeat=void 0;var Oj=(AE(),rt(vE)),_E=class extends Oj.IEvents{constructor(e){super()}};Td.IHeartBeat=_E});var IE=v(bE=>{"use strict";c();Object.defineProperty(bE,"__esModule",{value:!0});var Pj=(ar(),rt(or));Pj.__exportStar(y2(),bE)});var m2=v(au=>{"use strict";c();Object.defineProperty(au,"__esModule",{value:!0});au.HEARTBEAT_EVENTS=au.HEARTBEAT_INTERVAL=void 0;var Bj=to();au.HEARTBEAT_INTERVAL=Bj.FIVE_SECONDS;au.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var CE=v(SE=>{"use strict";c();Object.defineProperty(SE,"__esModule",{value:!0});var Rj=(ar(),rt(or));Rj.__exportStar(m2(),SE)});var w2=v(xd=>{"use strict";c();Object.defineProperty(xd,"__esModule",{value:!0});xd.HeartBeat=void 0;var TE=(ar(),rt(or)),Lj=Hn(),Fj=to(),Mj=IE(),xE=CE(),Yc=class extends Mj.IHeartBeat{constructor(e){super(e),this.events=new Lj.EventEmitter,this.interval=xE.HEARTBEAT_INTERVAL,this.interval=e?.interval||xE.HEARTBEAT_INTERVAL}static init(e){return TE.__awaiter(this,void 0,void 0,function*(){let r=new Yc(e);return yield r.init(),r})}init(){return TE.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return TE.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),Fj.toMiliseconds(this.interval))})}pulse(){this.events.emit(xE.HEARTBEAT_EVENTS.pulse)}};xd.HeartBeat=Yc});var E2=v(Jc=>{"use strict";c();Object.defineProperty(Jc,"__esModule",{value:!0});var NE=(ar(),rt(or));NE.__exportStar(w2(),Jc);NE.__exportStar(IE(),Jc);NE.__exportStar(CE(),Jc)});var DE=v(uu=>{"use strict";c();Object.defineProperty(uu,"__esModule",{value:!0});uu.PINO_CUSTOM_CONTEXT_KEY=uu.PINO_LOGGER_DEFAULTS=void 0;uu.PINO_LOGGER_DEFAULTS={level:"info"};uu.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var I2=v(nr=>{"use strict";c();Object.defineProperty(nr,"__esModule",{value:!0});nr.generateChildLogger=nr.formatChildLoggerContext=nr.getLoggerContext=nr.setBrowserLoggerContext=nr.getBrowserLoggerContext=nr.getDefaultLoggerOptions=void 0;var cu=DE();function Uj(t){return Object.assign(Object.assign({},t),{level:t?.level||cu.PINO_LOGGER_DEFAULTS.level})}nr.getDefaultLoggerOptions=Uj;function v2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}nr.getBrowserLoggerContext=v2;function A2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}nr.setBrowserLoggerContext=A2;function _2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=v2(t,e):r=t.bindings().context||"",r}nr.getLoggerContext=_2;function b2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=_2(t,r);return n.trim()?`${n}/${e}`:e}nr.formatChildLoggerContext=b2;function qj(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=b2(t,e,r),i=t.child({context:n});return A2(i,n,r)}nr.generateChildLogger=qj});var PE=v(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.pino=void 0;var OE=(ar(),rt(or)),Vj=OE.__importDefault(pd());Object.defineProperty(lu,"pino",{enumerable:!0,get:function(){return Vj.default}});OE.__exportStar(DE(),lu);OE.__exportStar(I2(),lu)});var $E=v(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var fu=(AE(),rt(vE)),S2=Hn();function jj(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var Hj=jj(S2),BE=class extends fu.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},RE=class{constructor(e,r,n){this.core=e,this.logger=r}},LE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},FE=class{constructor(e,r){this.logger=e,this.core=r}},ME=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},UE=class extends fu.IEvents{constructor(e){super()}},qE=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VE=class{constructor(){this.map=new Map}},jE=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},HE=class{constructor(e,r){this.core=e,this.logger=r}},GE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},QE=class{constructor(e,r){this.logger=e,this.core=r}},kE=class extends Hj.default{constructor(){super()}},KE=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},zE=class extends S2.EventEmitter{constructor(){super()}},WE=class{constructor(e){this.client=e}};Dt.ICore=BE,Dt.ICrypto=RE,Dt.IEngine=WE,Dt.IEngineEvents=zE,Dt.IExpirer=GE,Dt.IJsonRpcHistory=LE,Dt.IKeyChain=HE,Dt.IMessageTracker=FE,Dt.IPairing=QE,Dt.IPublisher=ME,Dt.IRelayer=UE,Dt.ISignClient=KE,Dt.ISignClientEvents=kE,Dt.IStore=qE,Dt.ISubscriber=jE,Dt.ISubscriberTopicMap=VE});var C2={};ot(C2,{safeJsonParse:()=>Xc,safeJsonStringify:()=>Zc});function Xc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Qj(t)}catch{return t}}function Zc(t){return typeof t=="string"?t:Gj(t)||""}var Gj,Qj,Nd=ge(()=>{c();Gj=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Qj=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var x2=v(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.BrowserRandomSource=void 0;var T2=65536,YE=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(JE,"__esModule",{value:!0});function kj(t){for(var e=0;e{c()});var D2=v(Od=>{"use strict";c();Object.defineProperty(Od,"__esModule",{value:!0});Od.NodeRandomSource=void 0;var Kj=Cr(),XE=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof U_<"u"){let e=N2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.SystemRandomSource=void 0;var zj=x2(),Wj=D2(),ZE=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new zj.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Wj.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};Pd.SystemRandomSource=ZE});var P2=v(ur=>{"use strict";c();Object.defineProperty(ur,"__esModule",{value:!0});function $j(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}ur.mul=Math.imul||$j;function Yj(t,e){return t+e|0}ur.add=Yj;function Jj(t,e){return t-e|0}ur.sub=Jj;function Xj(t,e){return t<>>32-e}ur.rotl=Xj;function Zj(t,e){return t<<32-e|t>>>e}ur.rotr=Zj;function eH(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}ur.isInteger=Number.isInteger||eH;ur.MAX_SAFE_INTEGER=9007199254740991;ur.isSafeInteger=function(t){return ur.isInteger(t)&&t>=-ur.MAX_SAFE_INTEGER&&t<=ur.MAX_SAFE_INTEGER}});var hu=v(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var B2=P2();function tH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=tH;function rH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=rH;function nH(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=nH;function iH(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=iH;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=R2;Ne.writeInt16BE=R2;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=L2;Ne.writeInt16LE=L2;function e1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=e1;function t1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=t1;function r1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=r1;function n1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=n1;function Bd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Bd;Ne.writeInt32BE=Bd;function Rd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Rd;Ne.writeInt32LE=Rd;function sH(t,e){e===void 0&&(e=0);var r=e1(t,e),n=e1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=sH;function oH(t,e){e===void 0&&(e=0);var r=t1(t,e),n=t1(t,e+4);return r*4294967296+n}Ne.readUint64BE=oH;function aH(t,e){e===void 0&&(e=0);var r=r1(t,e),n=r1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=aH;function uH(t,e){e===void 0&&(e=0);var r=n1(t,e),n=n1(t,e+4);return n*4294967296+r}Ne.readUint64LE=uH;function F2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Bd(t/4294967296>>>0,e,r),Bd(t>>>0,e,r+4),e}Ne.writeUint64BE=F2;Ne.writeInt64BE=F2;function M2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Rd(t>>>0,e,r),Rd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=M2;Ne.writeInt64LE=M2;function cH(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=cH;function lH(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=fH;function hH(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!B2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.randomStringForEntropy=Qt.randomString=Qt.randomUint32=Qt.randomBytes=Qt.defaultRandomSource=void 0;var AH=O2(),_H=hu(),U2=Cr();Qt.defaultRandomSource=new AH.SystemRandomSource;function i1(t,e=Qt.defaultRandomSource){return e.randomBytes(t)}Qt.randomBytes=i1;function bH(t=Qt.defaultRandomSource){let e=i1(4,t),r=(0,_H.readUint32LE)(e);return(0,U2.wipe)(e),r}Qt.randomUint32=bH;var q2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function V2(t,e=q2,r=Qt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=i1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Qn,"__esModule",{value:!0});var pu=hu(),du=Cr();Qn.DIGEST_LENGTH=64;Qn.BLOCK_SIZE=128;var H2=function(){function t(){this.digestLength=Qn.DIGEST_LENGTH,this.blockSize=Qn.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){du.wipe(this._buffer),du.wipe(this._tempHi),du.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(s1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=s1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){du.wipe(e.stateHi),du.wipe(e.stateLo),e.buffer&&du.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Qn.SHA512=H2;var j2=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],y=r[5],w=r[6],E=r[7],N=n[0],R=n[1],M=n[2],x=n[3],b=n[4],T=n[5],P=n[6],B=n[7],_,S,F,Z,K,H,G,$;o>=128;){for(var pe=0;pe<16;pe++){var ae=8*pe+s;t[pe]=pu.readUint32BE(i,ae),e[pe]=pu.readUint32BE(i,ae+4)}for(var pe=0;pe<80;pe++){var re=a,Y=u,ie=l,te=f,ne=d,q=y,ce=w,oe=E,le=N,se=R,ue=M,g=x,m=b,A=T,O=P,I=B;if(_=E,S=B,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=(d>>>14|b<<32-14)^(d>>>18|b<<32-18)^(b>>>41-32|d<<32-(41-32)),S=(b>>>14|d<<32-14)^(b>>>18|d<<32-18)^(d>>>41-32|b<<32-(41-32)),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=d&y^~d&w,S=b&T^~b&P,K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=j2[pe*2],S=j2[pe*2+1],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=t[pe%16],S=e[pe%16],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,F=G&65535|$<<16,Z=K&65535|H<<16,_=F,S=Z,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=(a>>>28|N<<32-28)^(N>>>34-32|a<<32-(34-32))^(N>>>39-32|a<<32-(39-32)),S=(N>>>28|a<<32-28)^(a>>>34-32|N<<32-(34-32))^(a>>>39-32|N<<32-(39-32)),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,_=a&u^a&l^u&l,S=N&R^N&M^R&M,K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,oe=G&65535|$<<16,I=K&65535|H<<16,_=te,S=g,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=F,S=Z,K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,te=G&65535|$<<16,g=K&65535|H<<16,u=re,l=Y,f=ie,d=te,y=ne,w=q,E=ce,a=oe,R=le,M=se,x=ue,b=g,T=m,P=A,B=O,N=I,pe%16===15)for(var ae=0;ae<16;ae++)_=t[ae],S=e[ae],K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=t[(ae+9)%16],S=e[(ae+9)%16],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,F=t[(ae+1)%16],Z=e[(ae+1)%16],_=(F>>>1|Z<<32-1)^(F>>>8|Z<<32-8)^F>>>7,S=(Z>>>1|F<<32-1)^(Z>>>8|F<<32-8)^(Z>>>7|F<<32-7),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,F=t[(ae+14)%16],Z=e[(ae+14)%16],_=(F>>>19|Z<<32-19)^(Z>>>61-32|F<<32-(61-32))^F>>>6,S=(Z>>>19|F<<32-19)^(F>>>61-32|Z<<32-(61-32))^(Z>>>6|F<<32-6),K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,t[ae]=G&65535|$<<16,e[ae]=K&65535|H<<16}_=a,S=N,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[0],S=n[0],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[0]=a=G&65535|$<<16,n[0]=N=K&65535|H<<16,_=u,S=R,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[1],S=n[1],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[1]=u=G&65535|$<<16,n[1]=R=K&65535|H<<16,_=l,S=M,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[2],S=n[2],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[2]=l=G&65535|$<<16,n[2]=M=K&65535|H<<16,_=f,S=x,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[3],S=n[3],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[3]=f=G&65535|$<<16,n[3]=x=K&65535|H<<16,_=d,S=b,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[4],S=n[4],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[4]=d=G&65535|$<<16,n[4]=b=K&65535|H<<16,_=y,S=T,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[5],S=n[5],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[5]=y=G&65535|$<<16,n[5]=T=K&65535|H<<16,_=w,S=P,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[6],S=n[6],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[6]=w=G&65535|$<<16,n[6]=P=K&65535|H<<16,_=E,S=B,K=S&65535,H=S>>>16,G=_&65535,$=_>>>16,_=r[7],S=n[7],K+=S&65535,H+=S>>>16,G+=_&65535,$+=_>>>16,H+=K>>>16,G+=H>>>16,$+=G>>>16,r[7]=E=G&65535|$<<16,n[7]=B=K&65535|H<<16,s+=128,o-=128}return s}function SH(t){var e=new H2;e.update(t);var r=e.digest();return e.clean(),r}Qn.hash=SH});var nN=v(qe=>{"use strict";c();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var CH=el(),tl=G2(),W2=Cr();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function Ee(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,$2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function Y2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function K2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return rl(r,t),rl(n,e),Y2(r,n)}function J2(t){let e=new Uint8Array(32);return rl(e,t),e[0]&1}function OH(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function ro(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function io(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Ge(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,N=0,R=0,M=0,x=0,b=0,T=0,P=0,B=0,_=0,S=0,F=0,Z=0,K=0,H=0,G=0,$=0,pe=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],O=r[11],I=r[12],D=r[13],L=r[14],C=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,N+=n*A,R+=n*O,M+=n*I,x+=n*D,b+=n*L,T+=n*C,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,N+=n*m,R+=n*A,M+=n*O,x+=n*I,b+=n*D,T+=n*L,P+=n*C,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,N+=n*g,R+=n*m,M+=n*A,x+=n*O,b+=n*I,T+=n*D,P+=n*L,B+=n*C,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,N+=n*ue,R+=n*g,M+=n*m,x+=n*A,b+=n*O,T+=n*I,P+=n*D,B+=n*L,_+=n*C,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,N+=n*se,R+=n*ue,M+=n*g,x+=n*m,b+=n*A,T+=n*O,P+=n*I,B+=n*D,_+=n*L,S+=n*C,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,N+=n*le,R+=n*se,M+=n*ue,x+=n*g,b+=n*m,T+=n*A,P+=n*O,B+=n*I,_+=n*D,S+=n*L,F+=n*C,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,N+=n*oe,R+=n*le,M+=n*se,x+=n*ue,b+=n*g,T+=n*m,P+=n*A,B+=n*O,_+=n*I,S+=n*D,F+=n*L,Z+=n*C,n=e[7],y+=n*te,w+=n*ne,E+=n*q,N+=n*ce,R+=n*oe,M+=n*le,x+=n*se,b+=n*ue,T+=n*g,P+=n*m,B+=n*A,_+=n*O,S+=n*I,F+=n*D,Z+=n*L,K+=n*C,n=e[8],w+=n*te,E+=n*ne,N+=n*q,R+=n*ce,M+=n*oe,x+=n*le,b+=n*se,T+=n*ue,P+=n*g,B+=n*m,_+=n*A,S+=n*O,F+=n*I,Z+=n*D,K+=n*L,H+=n*C,n=e[9],E+=n*te,N+=n*ne,R+=n*q,M+=n*ce,x+=n*oe,b+=n*le,T+=n*se,P+=n*ue,B+=n*g,_+=n*m,S+=n*A,F+=n*O,Z+=n*I,K+=n*D,H+=n*L,G+=n*C,n=e[10],N+=n*te,R+=n*ne,M+=n*q,x+=n*ce,b+=n*oe,T+=n*le,P+=n*se,B+=n*ue,_+=n*g,S+=n*m,F+=n*A,Z+=n*O,K+=n*I,H+=n*D,G+=n*L,$+=n*C,n=e[11],R+=n*te,M+=n*ne,x+=n*q,b+=n*ce,T+=n*oe,P+=n*le,B+=n*se,_+=n*ue,S+=n*g,F+=n*m,Z+=n*A,K+=n*O,H+=n*I,G+=n*D,$+=n*L,pe+=n*C,n=e[12],M+=n*te,x+=n*ne,b+=n*q,T+=n*ce,P+=n*oe,B+=n*le,_+=n*se,S+=n*ue,F+=n*g,Z+=n*m,K+=n*A,H+=n*O,G+=n*I,$+=n*D,pe+=n*L,ae+=n*C,n=e[13],x+=n*te,b+=n*ne,T+=n*q,P+=n*ce,B+=n*oe,_+=n*le,S+=n*se,F+=n*ue,Z+=n*g,K+=n*m,H+=n*A,G+=n*O,$+=n*I,pe+=n*D,ae+=n*L,re+=n*C,n=e[14],b+=n*te,T+=n*ne,P+=n*q,B+=n*ce,_+=n*oe,S+=n*le,F+=n*se,Z+=n*ue,K+=n*g,H+=n*m,G+=n*A,$+=n*O,pe+=n*I,ae+=n*D,re+=n*L,Y+=n*C,n=e[15],T+=n*te,P+=n*ne,B+=n*q,_+=n*ce,S+=n*oe,F+=n*le,Z+=n*se,K+=n*ue,H+=n*g,G+=n*m,$+=n*A,pe+=n*O,ae+=n*I,re+=n*D,Y+=n*L,ie+=n*C,s+=38*P,o+=38*B,a+=38*_,u+=38*S,l+=38*F,f+=38*Z,d+=38*K,y+=38*H,w+=38*G,E+=38*$,N+=38*pe,R+=38*ae,M+=38*re,x+=38*Y,b+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=N,t[11]=R,t[12]=M,t[13]=x,t[14]=b,t[15]=T}function no(t,e){Ge(t,e,e)}function X2(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)no(r,r),n!==2&&n!==4&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function PH(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)no(r,r),n!==1&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function c1(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee(),l=Ee(),f=Ee();io(r,t[1],t[0]),io(f,e[1],e[0]),Ge(r,r,f),ro(n,t[0],t[1]),ro(f,e[0],e[1]),Ge(n,n,f),Ge(i,t[3],e[3]),Ge(i,i,NH),Ge(s,t[2],e[2]),ro(s,s,s),io(o,n,r),io(a,s,i),ro(u,s,i),ro(l,n,r),Ge(t[0],o,a),Ge(t[1],l,u),Ge(t[2],u,a),Ge(t[3],o,l)}function z2(t,e,r){for(let n=0;n<4;n++)$2(t[n],e[n],r)}function f1(t,e){let r=Ee(),n=Ee(),i=Ee();X2(i,e[2]),Ge(r,e[0],i),Ge(n,e[1],i),rl(t,n),t[31]^=J2(r)<<7}function Z2(t,e,r){Pi(t[0],u1),Pi(t[1],gu),Pi(t[2],gu),Pi(t[3],u1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;z2(t,e,i),c1(e,t),c1(t,t),z2(t,e,i)}}function h1(t,e){let r=[Ee(),Ee(),Ee(),Ee()];Pi(r[0],Q2),Pi(r[1],k2),Pi(r[2],gu),Ge(r[3],Q2,k2),Z2(t,r,e)}function eN(t){if(t.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,tl.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ee(),Ee(),Ee(),Ee()];h1(n,e),f1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}qe.generateKeyPairFromSeed=eN;function BH(t){let e=(0,CH.randomBytes)(32,t),r=eN(e);return(0,W2.wipe)(e),r}qe.generateKeyPair=BH;function RH(t){if(t.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}qe.extractPublicKeyFromSecretKey=RH;var a1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function tN(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*a1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*a1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function l1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;tN(t,e)}function LH(t,e){let r=new Float64Array(64),n=[Ee(),Ee(),Ee(),Ee()],i=(0,tl.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new tl.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),l1(a),h1(n,a),f1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();l1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return tN(s.subarray(32),r),s}qe.sign=LH;function rN(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee();return Pi(t[2],gu),OH(t[1],e),no(i,t[1]),Ge(s,i,xH),io(i,i,t[2]),ro(s,t[2],s),no(o,s),no(a,o),Ge(u,a,o),Ge(r,u,i),Ge(r,r,s),PH(r,r),Ge(r,r,i),Ge(r,r,s),Ge(r,r,s),Ge(t[0],r,s),no(n,t[0]),Ge(n,n,s),K2(n,i)&&Ge(t[0],t[0],DH),no(n,t[0]),Ge(n,n,s),K2(n,i)?-1:(J2(t[0])===e[31]>>7&&io(t[0],u1,t[0]),Ge(t[3],t[0],t[1]),0)}function FH(t,e,r){let n=new Uint8Array(32),i=[Ee(),Ee(),Ee(),Ee()],s=[Ee(),Ee(),Ee(),Ee()];if(r.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(rN(s,t))return!1;let o=new tl.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return l1(a),Z2(i,s,a),h1(s,r.subarray(32)),c1(i,s),f1(n,i),!Y2(r,n)}qe.verify=FH;function MH(t){let e=[Ee(),Ee(),Ee(),Ee()];if(rN(e,t))throw new Error("Ed25519: invalid public key");let r=Ee(),n=Ee(),i=e[1];ro(r,gu,i),io(n,gu,i),X2(n,n),Ge(r,r,n);let s=new Uint8Array(32);return rl(s,r),s}qe.convertPublicKeyToX25519=MH;function UH(t){let e=(0,tl.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,W2.wipe)(e),r}qe.convertSecretKeyToX25519=UH});var Ld,Fd,so,yu,Md,nl,Ud,qd,Vd,mu,jd,Hd,iN,sN,Gd=ge(()=>{c();Ld="EdDSA",Fd="JWT",so=".",yu="base64url",Md="utf8",nl="utf8",Ud=":",qd="did",Vd="key",mu="base58btc",jd="z",Hd="K36",iN=32,sN=32});function Bi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var il=ge(()=>{c()});function wu(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Bi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Qd=ge(()=>{c();il()});function kd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=wu(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Bi(r)}var d1=ge(()=>{c();Qd();il()});function qH(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,T=new Uint8Array(b);M!==x;){for(var P=E[M],B=0,_=b-1;(P!==0||B>>0,T[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=B,M++}for(var S=b-R;S!==b&&T[S]===0;)S++;for(var F=u.repeat(N);S>>0,b=new Uint8Array(x);E[N];){var T=r[E.charCodeAt(N)];if(T===255)return;for(var P=0,B=x-1;(T!==0||P>>0,b[B]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");M=P,N++}if(E[N]!==" "){for(var _=x-M;_!==x&&b[_]===0;)_++;for(var S=new Uint8Array(R+(x-_)),F=R;_!==x;)S[F++]=b[_++];return S}}}function w(E){var N=y(E);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var VH,jH,oN,aN=ge(()=>{c();VH=qH,jH=VH,oN=jH});var Pse,uN,kn,cN,lN,Ri=ge(()=>{c();Pse=new Uint8Array(0),uN=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},cN=t=>new TextEncoder().encode(t),lN=t=>new TextDecoder().decode(t)});var p1,g1,y1,hN,m1,Eu,Li,HH,GH,ut,Ur=ge(()=>{c();aN();Ri();p1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},g1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hN(this,e)}},y1=class{constructor(e){this.decoders=e}or(e){return hN(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},hN=(t,e)=>new y1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),m1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new p1(e,r,n),this.decoder=new g1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Eu=({name:t,prefix:e,encode:r,decode:n})=>new m1(t,e,r,n),Li=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=oN(r,e);return Eu({prefix:t,name:e,encode:n,decode:s=>kn(i(s))})},HH=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},GH=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Eu({prefix:e,name:t,encode(i){return GH(i,n,r)},decode(i){return HH(i,n,r,t)}})});var w1={};ot(w1,{identity:()=>QH});var QH,dN=ge(()=>{c();Ur();Ri();QH=Eu({prefix:"\0",name:"identity",encode:t=>lN(t),decode:t=>cN(t)})});var E1={};ot(E1,{base2:()=>kH});var kH,pN=ge(()=>{c();Ur();kH=ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var v1={};ot(v1,{base8:()=>KH});var KH,gN=ge(()=>{c();Ur();KH=ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var A1={};ot(A1,{base10:()=>zH});var zH,yN=ge(()=>{c();Ur();zH=Li({prefix:"9",name:"base10",alphabet:"0123456789"})});var _1={};ot(_1,{base16:()=>WH,base16upper:()=>$H});var WH,$H,mN=ge(()=>{c();Ur();WH=ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$H=ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var b1={};ot(b1,{base32:()=>vu,base32hex:()=>ZH,base32hexpad:()=>t7,base32hexpadupper:()=>r7,base32hexupper:()=>e7,base32pad:()=>JH,base32padupper:()=>XH,base32upper:()=>YH,base32z:()=>n7});var vu,YH,JH,XH,ZH,e7,t7,r7,n7,I1=ge(()=>{c();Ur();vu=ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),YH=ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),JH=ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),XH=ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ZH=ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),e7=ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),t7=ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),r7=ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),n7=ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var S1={};ot(S1,{base36:()=>i7,base36upper:()=>s7});var i7,s7,wN=ge(()=>{c();Ur();i7=Li({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),s7=Li({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var C1={};ot(C1,{base58btc:()=>wn,base58flickr:()=>o7});var wn,o7,T1=ge(()=>{c();Ur();wn=Li({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),o7=Li({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var x1={};ot(x1,{base64:()=>a7,base64pad:()=>u7,base64url:()=>c7,base64urlpad:()=>l7});var a7,u7,c7,l7,EN=ge(()=>{c();Ur();a7=ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),u7=ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),c7=ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),l7=ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var N1={};ot(N1,{base256emoji:()=>g7});function d7(t){return t.reduce((e,r)=>(e+=f7[r],e),"")}function p7(t){let e=[];for(let r of t){let n=h7[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var vN,f7,h7,g7,AN=ge(()=>{c();Ur();vN=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),f7=vN.reduce((t,e,r)=>(t[r]=e,t),[]),h7=vN.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);g7=Eu({prefix:"\u{1F680}",name:"base256emoji",encode:d7,decode:p7})});function IN(t,e,r){e=e||[],r=r||0;for(var n=r;t>=E7;)e[r++]=t&255|_N,t/=128;for(;t&w7;)e[r++]=t&255|_N,t>>>=7;return e[r]=t|0,IN.bytes=r-n+1,e}function D1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw D1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&bN)<=A7);return D1.bytes=s-n,r}var y7,_N,m7,w7,E7,v7,A7,bN,_7,b7,I7,S7,C7,T7,x7,N7,D7,O7,P7,B7,sl,SN=ge(()=>{c();y7=IN,_N=128,m7=127,w7=~m7,E7=Math.pow(2,31);v7=D1,A7=128,bN=127;_7=Math.pow(2,7),b7=Math.pow(2,14),I7=Math.pow(2,21),S7=Math.pow(2,28),C7=Math.pow(2,35),T7=Math.pow(2,42),x7=Math.pow(2,49),N7=Math.pow(2,56),D7=Math.pow(2,63),O7=function(t){return t<_7?1:t{c();SN();ol=(t,e=0)=>[sl.decode(t,e),sl.decode.bytes],Au=(t,e,r=0)=>(sl.encode(t,e,r),e),_u=t=>sl.encodingLength(t)});var oo,CN,TN,bu,ul=ge(()=>{c();Ri();zd();oo=(t,e)=>{let r=e.byteLength,n=_u(t),i=n+_u(r),s=new Uint8Array(i+r);return Au(t,s,0),Au(r,s,n),s.set(e,i),new bu(t,r,e,s)},CN=t=>{let e=kn(t),[r,n]=ol(e),[i,s]=ol(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new bu(r,i,o,e)},TN=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&uN(t.bytes,e.bytes),bu=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var P1,O1,B1=ge(()=>{c();ul();P1=({name:t,code:e,encode:r})=>new O1(t,e,r),O1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?oo(this.code,r):r.then(n=>oo(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var R1={};ot(R1,{sha256:()=>R7,sha512:()=>L7});var NN,R7,L7,DN=ge(()=>{c();B1();NN=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),R7=P1({name:"sha2-256",code:18,encode:NN("SHA-256")}),L7=P1({name:"sha2-512",code:19,encode:NN("SHA-512")})});var L1={};ot(L1,{identity:()=>U7});var ON,F7,PN,M7,U7,BN=ge(()=>{c();Ri();ul();ON=0,F7="identity",PN=kn,M7=t=>oo(ON,PN(t)),U7={code:ON,name:F7,encode:PN,digest:M7}});var RN=ge(()=>{c();Ri()});var woe,Eoe,LN=ge(()=>{c();woe=new TextEncoder,Eoe=new TextDecoder});var It,j7,H7,G7,cl,Q7,FN,MN,Wd,$d,k7,K7,z7,UN=ge(()=>{c();zd();ul();T1();I1();Ri();It=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:$d,byteLength:$d,code:Wd,version:Wd,multihash:Wd,bytes:Wd,_baseCache:$d,asCID:$d})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==cl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Q7)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return It.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=oo(e,r);return It.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&TN(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return H7(r,i,e||wn.encoder);default:return G7(r,i,e||vu.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return K7(/^0\.0/,z7),!!(e&&(e[MN]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof It)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new It(r,n,i,s||FN(r,n,i.bytes))}else if(e!=null&&e[MN]===!0){let{version:r,multihash:n,code:i}=e,s=CN(n);return It.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==cl)throw new Error(`Version 0 CID must use dag-pb (code: ${cl}) block encoding`);return new It(e,r,n,n.bytes)}case 1:{let i=FN(e,r,n.bytes);return new It(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return It.create(0,cl,e)}static createV1(e,r){return It.create(1,e,r)}static decode(e){let[r,n]=It.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=It.inspectBytes(e),n=r.size-r.multihashSize,i=kn(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new bu(r.multihashCode,r.digestSize,s,i);return[r.version===0?It.createV0(o):It.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,y]=ol(e.subarray(r));return r+=y,d},i=n(),s=cl;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=j7(e,r),s=It.decode(i);return s._baseCache.set(n,e),s}},j7=(t,e)=>{switch(t[0]){case"Q":{let r=e||wn;return[wn.prefix,r.decode(`${wn.prefix}${t}`)]}case wn.prefix:{let r=e||wn;return[wn.prefix,r.decode(t)]}case vu.prefix:{let r=e||vu;return[vu.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},H7=(t,e,r)=>{let{prefix:n}=r;if(n!==wn.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},G7=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},cl=112,Q7=18,FN=(t,e,r)=>{let n=_u(t),i=n+_u(e),s=new Uint8Array(i+r.byteLength);return Au(t,s,0),Au(e,s,n),s.set(r,i),s},MN=Symbol.for("@ipld/js-cid/CID"),Wd={writable:!1,configurable:!1,enumerable:!0},$d={writable:!1,enumerable:!1,configurable:!1},k7="0.0.0-dev",K7=(t,e)=>{if(t.test(k7))console.warn(e);else throw new Error(e)},z7=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};pe.ErrContractHasNoAddress=yy;var my=class extends Be{constructor(e){super(e)}};pe.ErrMock=my;var wy=class extends Be{constructor(e){super(e)}};pe.ErrTypingSystem=wy;var Ey=class extends Be{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=Ey;var vy=class extends Be{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=vy;var Ay=class extends Be{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Ay;var _y=class extends Be{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=_y;var by=class extends Be{constructor(e){super(e)}};pe.ErrCodec=by;var Iy=class extends Be{constructor(e){super(e)}};pe.ErrContractInteraction=Iy;var Sy=class extends Be{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Sy;var Cy=class extends Be{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Cy;var Ty=class extends Be{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=Ty;var xy=class extends Be{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=xy});var ob=v(ii=>{"use strict";c();var OL=ii&&ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ii,"__esModule",{value:!0});ii.TokenPayment=ii.TokenTransfer=void 0;var cc=OL(Wt()),PL=He(),ib="EGLD",sb=18;cc.default.set({ROUNDING_MODE:1});var zr=class{constructor(e){let r=new cc.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new PL.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new cc.default(e).shiftedBy(sb).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new zr({tokenIdentifier:ib,nonce:0,amountAsBigInteger:e,numDecimals:sb})}static fungibleFromAmount(e,r,n){let i=new cc.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new zr({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new cc.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new zr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==ib}isFungible(){return this.nonce==0}};ii.TokenTransfer=zr;var Ny=class extends zr{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ii.TokenPayment=Ny});var Ro=v(ke=>{"use strict";c();Object.defineProperty(ke,"__esModule",{value:!0});ke.ARGUMENTS_SEPARATOR=ke.ESDT_TRANSFER_VALUE=ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_GAS_LIMIT=ke.TRANSACTION_VERSION_WITH_OPTIONS=ke.TRANSACTION_VERSION_DEFAULT=ke.TRANSACTION_OPTIONS_TX_GUARDED=ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=ke.TRANSACTION_OPTIONS_DEFAULT=ke.TRANSACTION_MIN_GAS_PRICE=void 0;ke.TRANSACTION_MIN_GAS_PRICE=1e9;ke.TRANSACTION_OPTIONS_DEFAULT=0;ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ke.TRANSACTION_OPTIONS_TX_GUARDED=2;ke.TRANSACTION_VERSION_DEFAULT=1;ke.TRANSACTION_VERSION_WITH_OPTIONS=2;ke.ESDT_TRANSFER_GAS_LIMIT=5e5;ke.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ke.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ke.ESDT_TRANSFER_VALUE="0";ke.ARGUMENTS_SEPARATOR="@"});var fr=v(Je=>{"use strict";c();var BL=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RL=Je&&Je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LL=Je&&Je.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BL(e,t,r);return RL(e,t),e};Object.defineProperty(Je,"__esModule",{value:!0});Je.isEmpty=Je.guardEmpty=Je.guardNotEmpty=Je.guardLength=Je.guardSameLength=Je.guardValueIsSetWithMessage=Je.guardValueIsSet=Je.guardTrue=void 0;var Lo=LL(He());function FL(t,e){if(!t)throw new Lo.ErrInvariantFailed(`[<${e}>] isn't true`)}Je.guardTrue=FL;function ML(t,e){ab(`${t} isn't set (null or undefined)`,e)}Je.guardValueIsSet=ML;function ab(t,e){if(e==null||e===void 0)throw new Lo.ErrInvariantFailed(t)}Je.guardValueIsSetWithMessage=ab;function UL(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Lo.ErrInvariantFailed("arrays do not have the same length")}Je.guardSameLength=UL;function qL(t,e){let r=t.length||0;if(r!=e)throw new Lo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Je.guardLength=qL;function VL(t,e){if(Dy(t))throw new Lo.ErrInvariantFailed(`${e} is empty`)}Je.guardNotEmpty=VL;function HL(t,e){if(!Dy(t))throw new Lo.ErrInvariantFailed(`${e} is not empty`)}Je.guardEmpty=HL;function Dy(t){return t.isEmpty?t.isEmpty():t.length===0}Je.isEmpty=Dy});var ub=v(mf=>{"use strict";c();Object.defineProperty(mf,"__esModule",{value:!0});mf.getJavascriptPrototypesInHierarchy=void 0;function jL(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}mf.getJavascriptPrototypesInHierarchy=jL});var mt=v(yt=>{"use strict";c();Object.defineProperty(yt,"__esModule",{value:!0});yt.NullType=yt.TypePlaceholder=yt.isTyped=yt.PrimitiveValue=yt.TypedValue=yt.CustomType=yt.PrimitiveType=yt.TypeCardinality=yt.Type=void 0;var Oy=ub(),cb=fr(),sr=class{constructor(e,r=[],n=Rn.fixed(1)){cb.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return sr.ClassName}getClassHierarchy(){return Oy.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return cb.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return sr.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!sr.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return sr.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Oy.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};yt.Type=sr;sr.ClassName="Type";var Rn=class{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new Rn(e,e)}static variable(e){return new Rn(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||Rn.MaxCardinality}};yt.TypeCardinality=Rn;Rn.MaxCardinality=4096;var Fo=class extends sr{constructor(e){super(e)}getClassName(){return Fo.ClassName}};yt.PrimitiveType=Fo;Fo.ClassName="PrimitiveType";var Mo=class extends sr{getClassName(){return Mo.ClassName}};yt.CustomType=Mo;Mo.ClassName="CustomType";var ds=class{constructor(e){this.type=e}getClassName(){return ds.ClassName}getClassHierarchy(){return Oy.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};yt.TypedValue=ds;ds.ClassName="TypedValue";var Uo=class extends ds{constructor(e){super(e)}getClassName(){return Uo.ClassName}};yt.PrimitiveValue=Uo;Uo.ClassName="PrimitiveValue";function GL(t){return t.belongsToTypesystem!==void 0}yt.isTyped=GL;var qo=class extends sr{constructor(){super("...")}getClassName(){return qo.ClassName}};yt.TypePlaceholder=qo;qo.ClassName="TypePlaceholder";var Vo=class extends sr{constructor(){super("?")}getClassName(){return Vo.ClassName}};yt.NullType=Vo;Vo.ClassName="NullType"});var lb=v((Ho,jo)=>{c();(function(t){var e=typeof Ho=="object"&&Ho&&!Ho.nodeType&&Ho,r=typeof jo=="object"&&jo&&!jo.nodeType&&jo,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,y=128,w="-",E=/^xn--/,T=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},B=o-a,x=Math.floor,O=String.fromCharCode,P;function L(Y){throw new RangeError(_[Y])}function b(Y,ie){for(var te=Y.length,ne=[];te--;)ne[te]=ie(Y[te]);return ne}function C(Y,ie){var te=Y.split("@"),ne="";te.length>1&&(ne=te[0]+"@",Y=te[1]),Y=Y.replace(R,".");var q=Y.split("."),ce=b(q,ie).join(".");return ne+ce}function M(Y){for(var ie=[],te=0,ne=Y.length,q,ce;te=55296&&q<=56319&&te65535&&(ie-=65536,te+=O(ie>>>10&1023|55296),ie=56320|ie&1023),te+=O(ie),te}).join("")}function K(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function j(Y,ie){return Y+22+75*(Y<26)-((ie!=0)<<5)}function G(Y,ie,te){var ne=0;for(Y=te?x(Y/f):Y>>1,Y+=x(Y/ie);Y>B*u>>1;ne+=o)Y=x(Y/B);return x(ne+(B+1)*Y/(Y+l))}function $(Y){var ie=[],te=Y.length,ne,q=0,ce=y,oe=d,le,se,ue,g,m,A,D,I,N;for(le=Y.lastIndexOf(w),le<0&&(le=0),se=0;se=128&&L("not-basic"),ie.push(Y.charCodeAt(se));for(ue=le>0?le+1:0;ue=te&&L("invalid-input"),D=K(Y.charCodeAt(ue++)),(D>=o||D>x((s-q)/m))&&L("overflow"),q+=D*m,I=A<=oe?a:A>=oe+u?u:A-oe,!(Dx(s/N)&&L("overflow"),m*=N;ne=ie.length+1,oe=G(q-g,ne,g==0),x(q/ne)>s-ce&&L("overflow"),ce+=x(q/ne),q%=ne,ie.splice(q++,0,ce)}return Z(ie)}function de(Y){var ie,te,ne,q,ce,oe,le,se,ue,g,m,A=[],D,I,N,F;for(Y=M(Y),D=Y.length,ie=y,te=0,ce=d,oe=0;oe=ie&&mx((s-te)/I)&&L("overflow"),te+=(le-ie)*I,ie=le,oe=0;oes&&L("overflow"),m==ie){for(se=te,ue=o;g=ue<=ce?a:ue>=ce+u?u:ue-ce,!(se{"use strict";c();var hb=lb();function QL(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Py(t){return t>="0"&&t<="7"}function kL(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function fb(t){return t=parseInt(t,16),hb.ucs2.encode([t])}function db(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!kL(l))throw new QL(u,"Unexpected token ILLEGAL");return l}for(;e{c();var mb=pb();vb.exports={validate:KL,parse:zL};function KL(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{wf(t,0,e,!1)}catch(n){r=n.message}return r}function zL(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=wf(t,0,e,!0);return r.value}function wb(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function JL(t,e,r,n){for(var i=e,s=",",o=[],a=e;ps(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=wf(t,i,r,n),l=wb(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function XL(t,e){return t.substr(e,4)==="true"}function ZL(t,e){return t.substr(e,5)==="false"}function e5(t,e){return t.substr(e,4)==="null"}var t5=new RegExp(/^\s$/);function ps(t){return t5.test(t)}var r5=new RegExp(/^\d$/);function gb(t){return r5.test(t)}function Ln(t,e,r){var n=10,i;t.length{"use strict";c();var n5=Wr&&Wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i5=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s5=Wr&&Wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n5(e,t,r);return i5(e,t),e};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.TypeExpressionParser=void 0;var _b=s5(He()),o5=mt(),a5=Ab(),Ry=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new _b.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return a5.parse(r)}catch{throw new _b.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new o5.Type(e,n)}};Wr.TypeExpressionParser=Ry});var Ly=v(si=>{"use strict";c();Object.defineProperty(si,"__esModule",{value:!0});si.EndpointParameterDefinition=si.EndpointModifiers=si.EndpointDefinition=void 0;var u5=Ef(),bb="?",c5="N / A",lc=class{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?bb:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>gs.fromJSON(s)),n=e.outputs.map(s=>gs.fromJSON(s)),i=new vf(e.mutability,e.payableInTokens);return new lc(e.name,r,n,i)}};si.EndpointDefinition=lc;var vf=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};si.EndpointModifiers=vf;var gs=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new u5.TypeExpressionParser().parse(e.type);return new gs(e.name||bb,e.description||c5,r)}};si.EndpointParameterDefinition=gs});var Go=v(Xt=>{"use strict";c();var l5=Xt&&Xt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f5=Xt&&Xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h5=Xt&&Xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&l5(e,t,r);return f5(e,t),e};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.Fields=Xt.Field=Xt.FieldDefinition=void 0;var Fy=h5(He()),d5=Ef(),fc=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new d5.TypeExpressionParser().parse(e.type);return new fc(e.name,e.description,r)}};Xt.FieldDefinition=fc;var My=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Fy.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Fy.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};Xt.Field=My;var Uy=class{static checkTyping(e,r){if(e.length!=r.length)throw new Fy.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(ai,"__esModule",{value:!0});ai.EnumValue=ai.EnumVariantDefinition=ai.EnumType=void 0;var p5=He(),qy=fr(),Af=Go(),Sb=mt(),Ib=256,ys=class extends Sb.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return ys.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>Qo.fromJSON(n));return new ys(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return qy.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return qy.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};ai.EnumType=ys;ys.ClassName="EnumType";var Qo=class{constructor(e,r,n=[]){this.fieldsDefinitions=[],qy.guardTrue(rAf.FieldDefinition.fromJSON(n));return new Qo(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ai.EnumVariantDefinition=Qo;var oi=class extends Sb.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Af.Fields.checkTyping(this.fields,i)}getClassName(){return oi.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new oi(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new oi(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Af.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new p5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(r=>e.fields[r.name]=r.value.valueOf()),e}};ai.EnumValue=oi;oi.ClassName="EnumValue"});var zo=v(Ko=>{"use strict";c();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.Struct=Ko.StructType=void 0;var g5=He(),_f=Go(),Cb=mt(),ms=class extends Cb.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return ms.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>_f.FieldDefinition.fromJSON(n));return new ms(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return _f.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ko.StructType=ms;ms.ClassName="StructType";var ko=class extends Cb.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return ko.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();_f.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new g5.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return _f.Fields.equals(r,n)}};Ko.Struct=ko;ko.ClassName="Struct"});var Cf=v((WX,Nb)=>{"use strict";c();var If="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Vy={};for(dc=0;dc>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Tb(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Wo(e)^n>>5}for(e=Wo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=Tb(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Wo(n)^o,i+=If.charAt(o)}for(s=0;s<6;++s)n=Wo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=If.charAt(a)}return i}function xb(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=Tb(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function m5(){var t=xb.apply(null,arguments);if(typeof t=="object")return t}function w5(t){var e=xb.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Sf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var b5=$r&&$r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),I5=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Db=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b5(e,t,r);return I5(e,t),e};Object.defineProperty($r,"__esModule",{value:!0});$r.Address=void 0;var Tf=Db(Cf()),$o=Db(He()),Hy="erd",jy=32,S5="0".repeat(16),_t=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof _t)return _t.fromAddress(e);if(e instanceof h.Buffer)return _t.fromBuffer(e);if(typeof e=="string")return _t.fromString(e);throw new $o.ErrAddressCannotCreate(e)}}static fromAddress(e){return _t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new _t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=jy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e.toString("hex"))}static fromString(e){return _t.isValidHex(e)?_t.fromValidHex(e):_t.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==jy}static fromHex(e){if(!_t.isValidHex(e))throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(e)}static empty(){return new _t}static fromBech32(e){let r;try{r=Tf.decode(e)}catch(s){throw new $o.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Hy)throw new $o.ErrAddressBadHrp(Hy,n);let i=h.Buffer.from(Tf.fromWords(r.words));if(i.length!=jy)throw new $o.ErrAddressCannotCreate(e);return _t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Tf.toWords(this.pubkey());return Tf.encode(Hy,e)}pubkey(){return this.isEmpty()?h.Buffer.from([]):h.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new _t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(S5)}};$r.Address=_t});var Xo=v(Jo=>{"use strict";c();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.AddressValue=Jo.AddressType=void 0;var C5=Zt(),Ob=mt(),ws=class extends Ob.PrimitiveType{constructor(){super("Address")}getClassName(){return ws.ClassName}};Jo.AddressType=ws;ws.ClassName="AddressType";var Yo=class extends Ob.PrimitiveValue{constructor(e){super(new ws),this.value=new C5.Address(e.bech32())}getClassName(){return Yo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Jo.AddressValue=Yo;Yo.ClassName="AddressValue"});var xf=v(Zo=>{"use strict";c();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.OptionalValue=Zo.OptionalType=void 0;var T5=fr(),pc=mt(),ui=class extends pc.Type{constructor(e){super("Optional",[e],pc.TypeCardinality.variable(1))}getClassName(){return ui.ClassName}isAssignableFrom(e){if(!e.hasExactClass(ui.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(pc.NullType.ClassName);return r||n}};Zo.OptionalType=ui;ui.ClassName="OptionalType";var Es=class extends pc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Es.ClassName}static newMissing(){let e=new ui(new pc.NullType);return new Es(e)}isSet(){return!!this.value}getTypedValue(){return T5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Zo.OptionalValue=Es;Es.ClassName="OptionalValue"});var gc=v(ta=>{"use strict";c();Object.defineProperty(ta,"__esModule",{value:!0});ta.BooleanValue=ta.BooleanType=void 0;var Pb=mt(),vs=class extends Pb.PrimitiveType{constructor(){super("bool")}getClassName(){return vs.ClassName}};ta.BooleanType=vs;vs.ClassName="BooleanType";var ea=class extends Pb.PrimitiveValue{constructor(e){super(new vs),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ta.BooleanValue=ea;ea.ClassName="BooleanValue"});var li=v(ra=>{"use strict";c();Object.defineProperty(ra,"__esModule",{value:!0});ra.BytesValue=ra.BytesType=void 0;var Bb=mt(),As=class extends Bb.PrimitiveType{constructor(){super("bytes")}getClassName(){return As.ClassName}};ra.BytesType=As;As.ClassName="BytesType";var ci=class extends Bb.PrimitiveValue{constructor(e){super(new As),this.value=e}getClassName(){return ci.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new ci(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new ci(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};ra.BytesValue=ci;ci.ClassName="BytesValue"});var Lb=v(na=>{"use strict";c();Object.defineProperty(na,"__esModule",{value:!0});na.CodeMetadataValue=na.CodeMetadataType=void 0;var Rb=mt(),Nf=class extends Rb.PrimitiveType{constructor(){super("CodeMetadata")}};na.CodeMetadataType=Nf;var Gy=class extends Rb.PrimitiveValue{constructor(e){super(new Nf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};na.CodeMetadataValue=Gy});var Df=v(ia=>{"use strict";c();Object.defineProperty(ia,"__esModule",{value:!0});ia.CompositeValue=ia.CompositeType=void 0;var x5=fr(),Qy=mt(),_s=class extends Qy.Type{constructor(...e){super("Composite",e,Qy.TypeCardinality.variable(e.length))}getClassName(){return _s.ClassName}};ia.CompositeType=_s;_s.ClassName="CompositeType";var bs=class extends Qy.TypedValue{constructor(e,r){super(e),x5.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return bs.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new _s(...r);return new bs(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Of,"__esModule",{value:!0});Of.CollectionOfTypedValues=void 0;var ky=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.List=Yr.OptionValue=Yr.ListType=Yr.OptionType=void 0;var N5=fr(),D5=Ky(),Is=mt(),Jr=class extends Is.Type{constructor(e){super("Option",[e])}getClassName(){return Jr.ClassName}isAssignableFrom(e){if(!e.hasExactClass(Jr.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Is.NullType.ClassName);return r||n}};Yr.OptionType=Jr;Jr.ClassName="OptionType";var Ss=class extends Is.Type{constructor(e){super("List",[e])}getClassName(){return Ss.ClassName}};Yr.ListType=Ss;Ss.ClassName="ListType";var Fn=class extends Is.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Fn.ClassName}static newMissing(){let e=new Jr(new Is.NullType);return new Fn(e)}static newMissingTyped(e){return new Fn(new Jr(e))}static newProvided(e){let r=new Jr(e.getType());return new Fn(r,e)}isSet(){return!!this.value}getTypedValue(){return N5.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Yr.OptionValue=Fn;Fn.ClassName="OptionValue";var fi=class extends Is.TypedValue{constructor(e,r){super(e),this.backingCollection=new D5.CollectionOfTypedValues(r)}getClassName(){return fi.ClassName}static fromItems(e){if(e.length==0)return new fi(new Is.TypePlaceholder,[]);let r=e[0].getType(),n=new Ss(r);return new fi(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Yr.List=fi;fi.ClassName="List"});var Pf=v(aa=>{"use strict";c();Object.defineProperty(aa,"__esModule",{value:!0});aa.ArrayVec=aa.ArrayVecType=void 0;var Fb=fr(),O5=Ky(),Mb=mt(),sa=class extends Mb.Type{constructor(e,r){super("Array",[r]),Fb.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return sa.ClassName}};aa.ArrayVecType=sa;sa.ClassName="ArrayVecType";var oa=class extends Mb.TypedValue{constructor(e,r){super(e),Fb.guardLength(r,e.length),this.backingCollection=new O5.CollectionOfTypedValues(r)}getClassName(){return oa.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};aa.ArrayVec=oa;oa.ClassName="ArrayVec"});var mc=v(ca=>{"use strict";c();Object.defineProperty(ca,"__esModule",{value:!0});ca.H256Value=ca.H256Type=void 0;var Ub=mt(),Cs=class extends Ub.PrimitiveType{constructor(){super("H256")}getClassName(){return Cs.ClassName}};ca.H256Type=Cs;Cs.ClassName="H256Type";var ua=class extends Ub.PrimitiveValue{constructor(e){super(new Cs),this.value=e}getClassName(){return ua.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ca.H256Value=ua;ua.ClassName="H256Value"});var Bf=v(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.NothingValue=fa.NothingType=void 0;var qb=mt(),Ts=class extends qb.PrimitiveType{constructor(){super("nothing")}getClassName(){return Ts.ClassName}};fa.NothingType=Ts;Ts.ClassName="NothingType";var la=class extends qb.PrimitiveValue{constructor(){super(new Ts)}getClassName(){return la.ClassName}equals(e){return!1}valueOf(){return{}}};fa.NothingValue=la;la.ClassName="NothingValue"});var wc=v(Ae=>{"use strict";c();var P5=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B5=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R5=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P5(e,t,r);return B5(e,t),e},L5=Ae&&Ae.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var Vb=R5(He()),Hb=mt(),Us=L5(Wt()),Vt=class extends Hb.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return Vt.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=Vt;Vt.ClassName="NumericalType";var xs=class extends Vt{constructor(){super("u8",1,!1)}getClassName(){return xs.ClassName}};Ae.U8Type=xs;xs.ClassName="U8Type";var Ns=class extends Vt{constructor(){super("i8",1,!0)}getClassName(){return Ns.ClassName}};Ae.I8Type=Ns;Ns.ClassName="I8Type";var Ds=class extends Vt{constructor(){super("u16",2,!1)}getClassName(){return Ds.ClassName}};Ae.U16Type=Ds;Ds.ClassName="U16Type";var Os=class extends Vt{constructor(){super("i16",2,!0)}getClassName(){return Os.ClassName}};Ae.I16Type=Os;Os.ClassName="I16Type";var Ps=class extends Vt{constructor(){super("u32",4,!1)}getClassName(){return Ps.ClassName}};Ae.U32Type=Ps;Ps.ClassName="U32Type";var Bs=class extends Vt{constructor(){super("i32",4,!0)}getClassName(){return Bs.ClassName}};Ae.I32Type=Bs;Bs.ClassName="I32Type";var Rs=class extends Vt{constructor(){super("u64",8,!1)}getClassName(){return Rs.ClassName}};Ae.U64Type=Rs;Rs.ClassName="U64Type";var Ls=class extends Vt{constructor(){super("i64",8,!0)}getClassName(){return Ls.ClassName}};Ae.I64Type=Ls;Ls.ClassName="I64Type";var Fs=class extends Vt{constructor(){super("BigUint",0,!1)}getClassName(){return Fs.ClassName}};Ae.BigUIntType=Fs;Fs.ClassName="BigUIntType";var Ms=class extends Vt{constructor(){super("Bigint",0,!0)}getClassName(){return Ms.ClassName}};Ae.BigIntType=Ms;Ms.ClassName="BigIntType";var Ht=class extends Hb.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Us.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new Vb.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new Vb.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return Ht.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=Ht;Ht.ClassName="NumericalValue";var ha=class extends Ht{constructor(e){super(new xs,new Us.default(e))}getClassName(){return ha.ClassName}};Ae.U8Value=ha;ha.ClassName="U8Value";var da=class extends Ht{constructor(e){super(new Ns,new Us.default(e))}getClassName(){return da.ClassName}};Ae.I8Value=da;da.ClassName="I8Value";var pa=class extends Ht{constructor(e){super(new Ds,new Us.default(e))}getClassName(){return pa.ClassName}};Ae.U16Value=pa;pa.ClassName="U16Value";var ga=class extends Ht{constructor(e){super(new Os,new Us.default(e))}getClassName(){return ga.ClassName}};Ae.I16Value=ga;ga.ClassName="I16Value";var ya=class extends Ht{constructor(e){super(new Ps,new Us.default(e))}getClassName(){return ya.ClassName}};Ae.U32Value=ya;ya.ClassName="U32Value";var ma=class extends Ht{constructor(e){super(new Bs,new Us.default(e))}getClassName(){return ma.ClassName}};Ae.I32Value=ma;ma.ClassName="I32Value";var wa=class extends Ht{constructor(e){super(new Rs,e)}getClassName(){return wa.ClassName}};Ae.U64Value=wa;wa.ClassName="U64Value";var Ea=class extends Ht{constructor(e){super(new Ls,e)}getClassName(){return Ea.ClassName}};Ae.I64Value=Ea;Ea.ClassName="I64Value";var va=class extends Ht{constructor(e){super(new Fs,e)}getClassName(){return va.ClassName}};Ae.BigUIntValue=va;va.ClassName="BigUIntValue";var Aa=class extends Ht{constructor(e){super(new Ms,e)}getClassName(){return Aa.ClassName}};Ae.BigIntValue=Aa;Aa.ClassName="BigIntValue"});var Rf=v(_a=>{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.StringValue=_a.StringType=void 0;var jb=mt(),qs=class extends jb.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return qs.ClassName}};_a.StringType=qs;qs.ClassName="StringType";var hi=class extends jb.PrimitiveValue{constructor(e){super(new qs),this.value=e}getClassName(){return hi.ClassName}static fromUTF8(e){return new hi(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new hi(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};_a.StringValue=hi;hi.ClassName="StringValue"});var Ia=v(ba=>{"use strict";c();Object.defineProperty(ba,"__esModule",{value:!0});ba.TokenIdentifierValue=ba.TokenIdentifierType=void 0;var Gb=mt(),F5="EGLD",Vs=class extends Gb.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Vs.ClassName}};ba.TokenIdentifierType=Vs;Vs.ClassName="TokenIdentifierType";var di=class extends Gb.PrimitiveValue{constructor(e){super(new Vs),this.value=e}static egld(){return new di(F5)}static esdtTokenIdentifier(e){return new di(e)}getClassName(){return di.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};ba.TokenIdentifierValue=di;di.ClassName="TokenIdentifierValue"});var Lf=v(hr=>{"use strict";c();var M5=hr&&hr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U5=hr&&hr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q5=hr&&hr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M5(e,t,r);return U5(e,t),e};Object.defineProperty(hr,"__esModule",{value:!0});hr.Tuple=hr.TupleType=void 0;var V5=q5(He()),Qb=Go(),kb=zo(),Mn=class extends kb.StructType{constructor(...e){super(Mn.prepareName(e),Mn.prepareFieldDefinitions(e))}getClassName(){return Mn.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new Qb.FieldDefinition(Kb(i),"anonymous tuple field",n))}};hr.TupleType=Mn;Mn.ClassName="TupleType";function Kb(t){return`field${t}`}var Hs=class extends kb.Struct{constructor(e,r){super(e,r)}getClassName(){return Hs.ClassName}static fromItems(e){if(e.length<1)throw new V5.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Mn(...r),i=e.map((s,o)=>new Qb.Field(s,Kb(o)));return new Hs(n,i)}};hr.Tuple=Hs;Hs.ClassName="Tuple"});var Mf=v(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.VariadicValue=Sa.VariadicType=void 0;var Ff=mt(),gi=class extends Ff.Type{constructor(e){super("Variadic",[e],Ff.TypeCardinality.variable())}getClassName(){return gi.ClassName}};Sa.VariadicType=gi;gi.ClassName="VariadicType";var pi=class extends Ff.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return pi.ClassName}static fromItems(...e){if(e.length==0)return new pi(new gi(new Ff.TypePlaceholder),[]);let r=e[0].getType();return new pi(new gi(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var H5=Xr&&Xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j5=Xr&&Xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G5=Xr&&Xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H5(e,t,r);return j5(e,t),e};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.TypeMapper=void 0;var zb=G5(He()),Q5=Xo(),zy=xf(),k5=gc(),K5=li(),z5=Lb(),Uf=Df(),Wy=hc(),W5=Go(),Wb=yc(),qf=Pf(),$5=mc(),$b=Bf(),dr=wc(),Y5=Rf(),Yb=zo(),Jb=Ia(),yi=Lf(),$y=Mf(),Yy=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new Wb.OptionType(r[0])],["List",(...r)=>new Wb.ListType(r[0])],["VarArgs",(...r)=>new $y.VariadicType(r[0])],["MultiResultVec",(...r)=>new $y.VariadicType(r[0])],["variadic",(...r)=>new $y.VariadicType(r[0])],["OptionalArg",(...r)=>new zy.OptionalType(r[0])],["optional",(...r)=>new zy.OptionalType(r[0])],["OptionalResult",(...r)=>new zy.OptionalType(r[0])],["multi",(...r)=>new Uf.CompositeType(...r)],["MultiArg",(...r)=>new Uf.CompositeType(...r)],["MultiResult",(...r)=>new Uf.CompositeType(...r)],["multi",(...r)=>new Uf.CompositeType(...r)],["tuple",(...r)=>new yi.TupleType(...r)],["tuple2",(...r)=>new yi.TupleType(...r)],["tuple3",(...r)=>new yi.TupleType(...r)],["tuple4",(...r)=>new yi.TupleType(...r)],["tuple5",(...r)=>new yi.TupleType(...r)],["tuple6",(...r)=>new yi.TupleType(...r)],["tuple7",(...r)=>new yi.TupleType(...r)],["tuple8",(...r)=>new yi.TupleType(...r)],["array20",(...r)=>new qf.ArrayVecType(20,r[0])],["array32",(...r)=>new qf.ArrayVecType(32,r[0])],["array46",(...r)=>new qf.ArrayVecType(46,r[0])],["array64",(...r)=>new qf.ArrayVecType(64,r[0])]]),this.closedTypesMap=new Map([["u8",new dr.U8Type],["u16",new dr.U16Type],["u32",new dr.U32Type],["u64",new dr.U64Type],["U64",new dr.U64Type],["BigUint",new dr.BigUIntType],["i8",new dr.I8Type],["i16",new dr.I16Type],["i32",new dr.I32Type],["i64",new dr.I64Type],["Bigint",new dr.BigIntType],["BigInt",new dr.BigIntType],["bool",new k5.BooleanType],["bytes",new K5.BytesType],["Address",new Q5.AddressType],["H256",new $5.H256Type],["utf-8 string",new Y5.StringType],["TokenIdentifier",new Jb.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new Jb.TokenIdentifierType],["CodeMetadata",new z5.CodeMetadataType],["nothing",new $b.NothingType],["AsyncCall",new $b.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new zb.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(Wy.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(Yb.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new Yb.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Wy.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Wy.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new W5.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new zb.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};Xr.TypeMapper=Yy});var rI=v(Zr=>{"use strict";c();var J5=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X5=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z5=Zr&&Zr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J5(e,t,r);return X5(e,t),e};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.AbiRegistry=void 0;var Xb=Z5(He()),Xy=fr(),Ec=Ly(),Zb=hc(),eI=zo(),eF=Jy(),tF="?",Ca=class{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||tF,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Ec.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Ec.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let y=s[d];if(y.type=="struct")u.push(eI.StructType.fromJSON({name:d,fields:y.fields}));else if(y.type=="enum")u.push(Zb.EnumType.fromJSON({name:d,variants:y.variants}));else throw new Xb.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new Ca({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(eI.StructType.ClassName));return Xy.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(Zb.EnumType.ClassName));return Xy.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Xy.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new eF.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new Xb.ErrTypingSystem("Did not re-map all custom types");let n=tI(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(tI(o,e));return new Ca({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};Zr.AbiRegistry=Ca;function tI(t,e){let r=t.input.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Ec.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Ec.EndpointDefinition(t.name,r,n,t.modifiers)}});var iI=v(Ta=>{"use strict";c();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.createListOfTokenIdentifiers=Ta.createListOfAddresses=void 0;var rF=Xo(),nI=yc(),nF=Ia();function iF(t){let e=t.map(n=>new rF.AddressValue(n));return nI.List.fromItems(e)}Ta.createListOfAddresses=iF;function sF(t){let e=t.map(n=>new nF.TokenIdentifierValue(n));return nI.List.fromItems(e)}Ta.createListOfTokenIdentifiers=sF});var wI=v(jt=>{"use strict";c();var oF=jt&&jt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aF=jt&&jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uF=jt&&jt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oF(e,t,r);return aF(e,t),e};Object.defineProperty(jt,"__esModule",{value:!0});jt.onPrimitiveTypeSelect=jt.onPrimitiveValueSelect=jt.onTypedValueSelect=jt.onTypeSelect=void 0;var Hf=uF(He()),sI=Xo(),oI=gc(),aI=li(),uI=hc(),Vf=yc(),cI=mc(),lI=wc(),fI=Bf(),hI=zo(),dI=Ia(),pI=Lf(),gI=mt(),yI=Pf(),mI=Rf();function cF(t,e){if(t.hasExactClass(Vf.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Vf.ListType.ClassName))return e.onList();if(t.hasExactClass(yI.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(gI.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(hI.StructType.ClassName))return e.onStruct();if(t.hasExactClass(pI.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(uI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't known: ${t}`)}jt.onTypeSelect=cF;function lF(t,e){if(t.hasClassOrSuperclass(gI.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Vf.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Vf.List.ClassName))return e.onList();if(t.hasExactClass(yI.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(hI.Struct.ClassName))return e.onStruct();if(t.hasExactClass(pI.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(uI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't typed: ${t}`)}jt.onTypedValueSelect=lF;function fF(t,e){if(t.hasExactClass(oI.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(lI.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(sI.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(aI.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(mI.StringValue.ClassName))return e.onString();if(t.hasExactClass(cI.H256Value.ClassName))return e.onH256();if(t.hasExactClass(dI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(fI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}jt.onPrimitiveValueSelect=fF;function hF(t,e){if(t.hasExactClass(oI.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(lI.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(sI.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(aI.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(mI.StringType.ClassName))return e.onString();if(t.hasExactClass(cI.H256Type.ClassName))return e.onH256();if(t.hasExactClass(dI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(fI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Hf.ErrTypingSystem(`type isn't a known primitive: ${t}`)}jt.onPrimitiveTypeSelect=hF});var Tt=v(Ue=>{"use strict";c();var dF=Ue&&Ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xe=Ue&&Ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dF(e,t,r)};Object.defineProperty(Ue,"__esModule",{value:!0});Xe(rI(),Ue);Xe(Xo(),Ue);Xe(xf(),Ue);Xe(gc(),Ue);Xe(li(),Ue);Xe(Df(),Ue);Xe(Ly(),Ue);Xe(hc(),Ue);Xe(iI(),Ue);Xe(Go(),Ue);Xe(yc(),Ue);Xe(Pf(),Ue);Xe(mc(),Ue);Xe(wI(),Ue);Xe(Bf(),Ue);Xe(wc(),Ue);Xe(Rf(),Ue);Xe(zo(),Ue);Xe(Ia(),Ue);Xe(Lf(),Ue);Xe(Ef(),Ue);Xe(Jy(),Ue);Xe(mt(),Ue);Xe(Mf(),Ue)});var vI=v(en=>{"use strict";c();var pF=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gF=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yF=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pF(e,t,r);return gF(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.OptionValueBinaryCodec=void 0;var EI=yF(He()),jf=Tt(),Zy=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[jf.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new EI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[jf.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new jf.OptionValue(r);if(e[0]!=1)throw new EI.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new jf.OptionValue(r,n)}encodeNested(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([])}};en.OptionValueBinaryCodec=Zy});var AI=v(Gf=>{"use strict";c();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.AddressBinaryCodec=void 0;var mF=Zt(),wF=Tt(),em=class{decodeNested(e){let r=e.slice(0,32),n=new mF.Address(r);return[new wF.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Gf.AddressBinaryCodec=em});var bI=v(tn=>{"use strict";c();var EF=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vF=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AF=tn&&tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EF(e,t,r);return vF(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.BooleanBinaryCodec=void 0;var _F=AF(He()),_I=Tt(),Dr=class{decodeNested(e){let r=e.readUInt8(0);return[new _I.BooleanValue(r==Dr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new _F.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new _I.BooleanValue(r==Dr.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([Dr.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([Dr.TRUE]):h.Buffer.from([])}};tn.BooleanBinaryCodec=Dr;Dr.TRUE=1;Dr.FALSE=0});var kf=v(Qf=>{"use strict";c();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.SizeOfU32=void 0;Qf.SizeOfU32=4});var tm=v(rn=>{"use strict";c();var bF=rn&&rn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.zeroPadStringIfOddLength=rn.isPaddedHex=rn.numberToPaddedHex=void 0;var IF=bF(Wt());function SF(t){let e=new IF.default(t).toString(16);return II(e)}rn.numberToPaddedHex=SF;function CF(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}rn.isPaddedHex=CF;function II(t){return t=t||"",t.length%2==1?"0"+t:t}rn.zeroPadStringIfOddLength=II});var Kf=v(wt=>{"use strict";c();var TF=wt&&wt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wt,"__esModule",{value:!0});wt.prependByteToBuffer=wt.flipBufferBitsInPlace=wt.getHexMagnitudeOfBigInt=wt.bigIntToBuffer=wt.bufferToBigInt=wt.cloneBuffer=wt.isMsbZero=wt.isMsbOne=void 0;var rm=TF(Wt()),xF=tm();function SI(t,e=0){return t[e]>>7==1}wt.isMsbOne=SI;function NF(t,e=0){return!SI(t,e)}wt.isMsbZero=NF;function DF(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}wt.cloneBuffer=DF;function OF(t){let e=t.toString("hex");return new rm.default(`0x${e}`,16)}wt.bufferToBigInt=OF;function PF(t){let e=CI(t);return h.Buffer.from(e,"hex")}wt.bigIntToBuffer=PF;function CI(t){return t=new rm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new rm.default(-1))),xF.numberToPaddedHex(t)):""}wt.getHexMagnitudeOfBigInt=CI;function BF(t){for(let e=0;e{"use strict";c();var LF=xa&&xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xa,"__esModule",{value:!0});xa.NumericalBinaryCodec=void 0;var vc=LF(Wt()),nm=Tt(),TI=kf(),ht=Kf(),im=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=TI.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=ht.cloneBuffer(e);if(e.length==0)return new nm.NumericalValue(r,new vc.default(0));if(!r.withSign||ht.isMsbZero(n)){let l=ht.bufferToBigInt(n);return new nm.NumericalValue(r,l)}ht.flipBufferBitsInPlace(n);let u=ht.bufferToBigInt(n).multipliedBy(new vc.default(-1)).minus(new vc.default(1));return new nm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(TI.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=ht.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=ht.bigIntToBuffer(e.value);ht.isMsbOne(o)&&(o=ht.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new vc.default(1)),i=ht.bigIntToBuffer(n);ht.flipBufferBitsInPlace(i),ht.isMsbZero(i)&&(i=ht.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):ht.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=ht.bigIntToBuffer(e.value);return ht.isMsbOne(i)&&(i=ht.prependByteToBuffer(i,0)),i}let r=e.value.plus(new vc.default(1)),n=ht.bigIntToBuffer(r);return ht.flipBufferBitsInPlace(n),ht.isMsbZero(n)&&(n=ht.prependByteToBuffer(n,255)),n}};xa.NumericalBinaryCodec=im});var NI=v(zf=>{"use strict";c();Object.defineProperty(zf,"__esModule",{value:!0});zf.H256BinaryCodec=void 0;var FF=mc(),sm=class{decodeNested(e){let r=e.slice(0,32);return[new FF.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};zf.H256BinaryCodec=sm});var Yf=v($f=>{"use strict";c();Object.defineProperty($f,"__esModule",{value:!0});$f.BytesBinaryCodec=void 0;var DI=li(),Wf=kf(),om=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(Wf.SizeOfU32,Wf.SizeOfU32+r);return[new DI.BytesValue(n),Wf.SizeOfU32+r]}decodeTopLevel(e){return new DI.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(Wf.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};$f.BytesBinaryCodec=om});var PI=v(Jf=>{"use strict";c();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.TokenIdentifierCodec=void 0;var MF=li(),OI=Ia(),UF=Yf(),am=class{constructor(){this.bytesCodec=new UF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new OI.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new OI.TokenIdentifierValue(r.toString())}encodeNested(e){let r=MF.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Jf.TokenIdentifierCodec=am});var RI=v(Xf=>{"use strict";c();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.NothingCodec=void 0;var BI=Tt(),um=class{decodeNested(){return[new BI.NothingValue,0]}decodeTopLevel(){return new BI.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Xf.NothingCodec=um});var FI=v(Zf=>{"use strict";c();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.StringBinaryCodec=void 0;var LI=Tt(),qF=li(),VF=Yf(),cm=class{constructor(){this.bytesBinaryCodec=new VF.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new LI.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new LI.StringValue(e.toString())}encodeNested(e){let r=qF.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Zf.StringBinaryCodec=cm});var MI=v(th=>{"use strict";c();Object.defineProperty(th,"__esModule",{value:!0});th.PrimitiveBinaryCodec=void 0;var eh=Tt(),HF=AI(),jF=bI(),GF=xI(),QF=NI(),kF=Yf(),KF=PI(),zF=RI(),WF=FI(),lm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new jF.BooleanBinaryCodec,this.numericalCodec=new GF.NumericalBinaryCodec,this.addressCodec=new HF.AddressBinaryCodec,this.h256Codec=new QF.H256BinaryCodec,this.bytesCodec=new kF.BytesBinaryCodec,this.stringCodec=new WF.StringBinaryCodec,this.tokenIdentifierCodec=new KF.TokenIdentifierCodec,this.nothingCodec=new zF.NothingCodec}decodeNested(e,r){return eh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return eh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return eh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return eh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};th.PrimitiveBinaryCodec=lm});var VI=v(rh=>{"use strict";c();Object.defineProperty(rh,"__esModule",{value:!0});rh.ListBinaryCodec=void 0;var UI=Tt(),qI=kf(),fm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=qI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new UI.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(qI.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return h.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return h.Buffer.concat(r)}};rh.ListBinaryCodec=fm});var dm=v(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.FieldsBinaryCodec=void 0;var $F=Tt(),hm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new $F.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return h.Buffer.concat(r)}};nh.FieldsBinaryCodec=hm});var gm=v(ih=>{"use strict";c();Object.defineProperty(ih,"__esModule",{value:!0});ih.StructBinaryCodec=void 0;var YF=Tt(),JF=dm(),pm=class{constructor(e){this.fieldsCodec=new JF.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new YF.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};ih.StructBinaryCodec=pm});var HI=v(oh=>{"use strict";c();Object.defineProperty(oh,"__esModule",{value:!0});oh.EnumBinaryCodec=void 0;var sh=Tt(),XF=dm(),ym=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new XF.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new sh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new sh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new sh.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return h.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new sh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};oh.EnumBinaryCodec=ym});var jI=v(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.TupleBinaryCodec=void 0;var ZF=gm(),mm=class{constructor(e){this.structCodec=new ZF.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};ah.TupleBinaryCodec=mm});var GI=v(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.ArrayVecBinaryCodec=void 0;var e4=Tt(),wm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var t4=pr&&pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r4=pr&&pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n4=pr&&pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t4(e,t,r);return r4(e,t),e};Object.defineProperty(pr,"__esModule",{value:!0});pr.BinaryCodecConstraints=pr.BinaryCodec=void 0;var QI=n4(He()),ch=Tt(),kI=fr(),i4=vI(),s4=MI(),o4=VI(),a4=gm(),u4=HI(),c4=jI(),l4=GI(),Em=class{constructor(e=null){this.constraints=e||new lh,this.optionCodec=new i4.OptionValueBinaryCodec(this),this.listCodec=new o4.ListBinaryCodec(this),this.arrayCodec=new l4.ArrayVecBinaryCodec(this),this.primitiveCodec=new s4.PrimitiveBinaryCodec(this),this.structCodec=new a4.StructBinaryCodec(this),this.tupleCodec=new c4.TupleBinaryCodec(this),this.enumCodec=new u4.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),ch.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=ch.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return kI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),ch.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return kI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),ch.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};pr.BinaryCodec=Em;var lh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new QI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new QI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};pr.BinaryCodecConstraints=lh});var KI=v(gr=>{"use strict";c();var f4=gr&&gr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gr,"__esModule",{value:!0});gr.decodeBigNumber=gr.decodeString=gr.decodeBool=gr.decodeUnsignedNumber=void 0;var h4=f4(Wt()),fh=Tt(),d4=vm(),hh=new d4.BinaryCodec;function p4(t){let e=hh.decodeTopLevel(t,new fh.BigUIntType);return Number(e.valueOf())}gr.decodeUnsignedNumber=p4;function g4(t){return!!hh.decodeTopLevel(t,new fh.BooleanType).valueOf()}gr.decodeBool=g4;function y4(t){let e=hh.decodeTopLevel(t,new fh.BytesType);return String(e.valueOf())}gr.decodeString=y4;function m4(t){let e=hh.decodeTopLevel(t,new fh.BigUIntType);return new h4.default(e.valueOf())}gr.decodeBigNumber=m4});var WI=v(mi=>{"use strict";c();var w4=mi&&mi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zI=mi&&mi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&w4(e,t,r)};Object.defineProperty(mi,"__esModule",{value:!0});zI(vm(),mi);zI(KI(),mi)});var ph=v(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.ArgSerializer=void 0;var $I=Ro(),E4=WI(),Am=xf(),_m=Df(),bm=Mf(),v4={codec:new E4.BinaryCodec},Im=class{constructor(e){e=Object.assign(Object.assign({},v4),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split($I.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let f=0;f=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join($I.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let s of e)i(s);function i(s){if(s.hasExactClass(Am.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(bm.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(_m.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};dh.ArgSerializer=Im});var mh=v(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.Compatibility=void 0;var A4=Zt(),gh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==A4.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};yh.Compatibility=gh;gh.areWarningsEnabled=!0});var YI=v(nn=>{"use strict";c();var _4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_4(e,t,r);return b4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Hash=void 0;var S4=I4(He()),Ac=class{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new S4.ErrBadType("hash","buffer | string",e)}static empty(){return new Ac(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};nn.Hash=Ac});var XI=v(yr=>{"use strict";c();var C4=yr&&yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T4=yr&&yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x4=yr&&yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C4(e,t,r);return T4(e,t),e};Object.defineProperty(yr,"__esModule",{value:!0});yr.TransactionOptions=yr.TransactionVersion=void 0;var Or=Ro(),JI=x4(He()),Na=class{constructor(e){if(e=Number(e),e<1)throw new JI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Na(Or.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new Na(Or.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};yr.TransactionVersion=Na;var Da=class{constructor(e){if(e=Number(e),e<0)throw new JI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new Da(Or.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Or.TRANSACTION_OPTIONS_TX_GUARDED),new Da(r)}isWithHashSign(){return(this.value&Or.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Or.TRANSACTION_OPTIONS_TX_GUARDED)==Or.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Or.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Or.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};yr.TransactionOptions=Da});var eS=v((Uee,ZI)=>{"use strict";c();ZI.exports=N4;function N4(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var wh=nS;wh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Oa=new Array(64),rS=new Array(123);for(Pr=0;Pr<64;)rS[Oa[Pr]=Pr<26?Pr+65:Pr<52?Pr+71:Pr<62?Pr-4:Pr-59|43]=Pr++;var Pr;wh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Oa[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Oa[u|l>>6],s[o++]=Oa[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Oa[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var tS="invalid encoding";wh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=rS[u])===void 0)throw Error(tS);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(tS);return n-i};wh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var oS=v((jee,sS)=>{"use strict";c();sS.exports=Eh;function Eh(){this._listeners={}}Eh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Eh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();hS.exports=aS(aS);function aS(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,uS),t.writeFloatBE=e.bind(null,cS);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,lS),t.readFloatBE=r.bind(null,fS)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,uS,0,4),t.writeDoubleBE=e.bind(null,cS,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,y=4294967296*(l&1048575)+u;return d===2047?y?NaN:f*(1/0):d===0?f*5e-324*y:f*Math.pow(2,d-1075)*(y+4503599627370496)}t.readDoubleLE=r.bind(null,lS,0,4),t.readDoubleBE=r.bind(null,fS,4,0)}(),t}function uS(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function cS(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function lS(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function fS(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var pS=v((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var yS=v(gS=>{"use strict";c();var Sm=gS;Sm.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Sm.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var wS=v(($ee,mS)=>{"use strict";c();mS.exports=D4;function D4(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var vS=v((Jee,ES)=>{"use strict";c();ES.exports=xt;var _c=Ei();function xt(t,e){this.lo=t>>>0,this.hi=e>>>0}var js=xt.zero=new xt(0,0);js.toNumber=function(){return 0};js.zzEncode=js.zzDecode=function(){return this};js.length=function(){return 1};var O4=xt.zeroHash="\0\0\0\0\0\0\0\0";xt.fromNumber=function(e){if(e===0)return js;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new xt(n,i)};xt.from=function(e){if(typeof e=="number")return xt.fromNumber(e);if(_c.isString(e))if(_c.Long)e=_c.Long.fromString(e);else return xt.fromNumber(parseInt(e,10));return e.low||e.high?new xt(e.low>>>0,e.high>>>0):js};xt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};xt.prototype.toLong=function(e){return _c.Long?new _c.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var wi=String.prototype.charCodeAt;xt.fromHash=function(e){return e===O4?js:new xt((wi.call(e,0)|wi.call(e,1)<<8|wi.call(e,2)<<16|wi.call(e,3)<<24)>>>0,(wi.call(e,4)|wi.call(e,5)<<8|wi.call(e,6)<<16|wi.call(e,7)<<24)>>>0)};xt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};xt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};xt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};xt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Ei=v(Cm=>{"use strict";c();var me=Cm;me.asPromise=eS();me.base64=iS();me.EventEmitter=oS();me.float=dS();me.inquire=pS();me.utf8=yS();me.pool=wS();me.LongBits=vS();me.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Cm;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};me.Buffer=function(){try{var t=me.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,r){var n=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function AS(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};me.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();CS.exports=Le;var mr=Ei(),Tm,vh=mr.LongBits,bS=mr.base64,IS=mr.utf8;function bc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Nm(){}function P4(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Le(){this.len=0,this.head=new bc(Nm,0,0),this.tail=this.head,this.states=null}var SS=function(){return mr.Buffer?function(){return(Le.create=function(){return new Tm})()}:function(){return new Le}};Le.create=SS();Le.alloc=function(e){return new mr.Array(e)};mr.Array!==Array&&(Le.alloc=mr.pool(Le.alloc,mr.Array.prototype.subarray));Le.prototype._push=function(e,r,n){return this.tail=this.tail.next=new bc(e,r,n),this.len+=r,this};function Dm(t,e,r){e[r]=t&255}function B4(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Om(t,e){this.len=t,this.next=void 0,this.val=e}Om.prototype=Object.create(bc.prototype);Om.prototype.fn=B4;Le.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Om((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Le.prototype.int32=function(e){return e<0?this._push(Pm,10,vh.fromNumber(e)):this.uint32(e)};Le.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Pm(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Le.prototype.uint64=function(e){var r=vh.from(e);return this._push(Pm,r.length(),r)};Le.prototype.int64=Le.prototype.uint64;Le.prototype.sint64=function(e){var r=vh.from(e).zzEncode();return this._push(Pm,r.length(),r)};Le.prototype.bool=function(e){return this._push(Dm,1,e?1:0)};function xm(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Le.prototype.fixed32=function(e){return this._push(xm,4,e>>>0)};Le.prototype.sfixed32=Le.prototype.fixed32;Le.prototype.fixed64=function(e){var r=vh.from(e);return this._push(xm,4,r.lo)._push(xm,4,r.hi)};Le.prototype.sfixed64=Le.prototype.fixed64;Le.prototype.float=function(e){return this._push(mr.float.writeFloatLE,4,e)};Le.prototype.double=function(e){return this._push(mr.float.writeDoubleLE,8,e)};var R4=mr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Dm,1,0);if(mr.isString(e)){var n=Le.alloc(r=bS.length(e));bS.decode(e,n,0),e=n}return this.uint32(r)._push(R4,r,e)};Le.prototype.string=function(e){var r=IS.length(e);return r?this.uint32(r)._push(IS.write,r,e):this._push(Dm,1,0)};Le.prototype.fork=function(){return this.states=new P4(this),this.head=this.tail=new bc(Nm,0,0),this.len=0,this};Le.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new bc(Nm,0,0),this.len=0),this};Le.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Le.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Le._configure=function(t){Tm=t,Le.create=SS(),Tm._configure()}});var NS=v((nte,xS)=>{"use strict";c();xS.exports=sn;var TS=Bm();(sn.prototype=Object.create(TS.prototype)).constructor=sn;var vi=Ei();function sn(){TS.call(this)}sn._configure=function(){sn.alloc=vi._Buffer_allocUnsafe,sn.writeBytesBuffer=vi.Buffer&&vi.Buffer.prototype instanceof Uint8Array&&vi.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(sn.writeBytesBuffer,r,e),this};function L4(t,e,r){t.length<40?vi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}sn.prototype.string=function(e){var r=vi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(L4,r,e),this};sn._configure()});var Fm=v((ste,RS)=>{"use strict";c();RS.exports=dt;var on=Ei(),Lm,PS=on.LongBits,F4=on.utf8;function Br(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function dt(t){this.buf=t,this.pos=0,this.len=t.length}var DS=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new dt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new dt(e);throw Error("illegal buffer")},BS=function(){return on.Buffer?function(r){return(dt.create=function(i){return on.Buffer.isBuffer(i)?new Lm(i):DS(i)})(r)}:DS};dt.create=BS();dt.prototype._slice=on.Array.prototype.subarray||on.Array.prototype.slice;dt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Br(this,10);return e}}();dt.prototype.int32=function(){return this.uint32()|0};dt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Rm(){var t=new PS(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Br(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Br(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}dt.prototype.bool=function(){return this.uint32()!==0};function Ah(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}dt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return Ah(this.buf,this.pos+=4)};dt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Br(this,4);return Ah(this.buf,this.pos+=4)|0};function OS(){if(this.pos+8>this.len)throw Br(this,8);return new PS(Ah(this.buf,this.pos+=4),Ah(this.buf,this.pos+=4))}dt.prototype.float=function(){if(this.pos+4>this.len)throw Br(this,4);var e=on.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};dt.prototype.double=function(){if(this.pos+8>this.len)throw Br(this,4);var e=on.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};dt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Br(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};dt.prototype.string=function(){var e=this.bytes();return F4.read(e,0,e.length)};dt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Br(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Br(this);while(this.buf[this.pos++]&128);return this};dt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};dt._configure=function(t){Lm=t,dt.create=BS(),Lm._configure();var e=on.Long?"toLong":"toNumber";on.merge(dt.prototype,{int64:function(){return Rm.call(this)[e](!1)},uint64:function(){return Rm.call(this)[e](!0)},sint64:function(){return Rm.call(this).zzDecode()[e](!1)},fixed64:function(){return OS.call(this)[e](!0)},sfixed64:function(){return OS.call(this)[e](!1)}})}});var US=v((ate,MS)=>{"use strict";c();MS.exports=Gs;var FS=Fm();(Gs.prototype=Object.create(FS.prototype)).constructor=Gs;var LS=Ei();function Gs(t){FS.call(this,t)}Gs._configure=function(){LS.Buffer&&(Gs.prototype._slice=LS.Buffer.prototype.slice)};Gs.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Gs._configure()});var VS=v((cte,qS)=>{"use strict";c();qS.exports=Ic;var Mm=Ei();(Ic.prototype=Object.create(Mm.EventEmitter.prototype)).constructor=Ic;function Ic(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Mm.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Ic.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Mm.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Ic.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var jS=v(HS=>{"use strict";c();var M4=HS;M4.Service=VS()});var QS=v((dte,GS)=>{"use strict";c();GS.exports={}});var zS=v(KS=>{"use strict";c();var er=KS;er.build="minimal";er.Writer=Bm();er.BufferWriter=NS();er.Reader=Fm();er.BufferReader=US();er.util=Ei();er.rpc=jS();er.roots=QS();er.configure=kS;function kS(){er.util._configure(),er.Writer._configure(er.BufferWriter),er.Reader._configure(er.BufferReader)}kS()});var $S=v((mte,WS)=>{"use strict";c();WS.exports=zS()});var JS=v((Ete,YS)=>{"use strict";c();var Pa=$S(),_h=Pa.Reader,U4=Pa.Writer,J=Pa.util,Sc=Pa.roots.default||(Pa.roots.default={});Sc.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof _h||(n=new _h(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Sc.proto.Transaction)return n;var i=new Sc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Pa.util.toJSONOptions)},e}(),t}();YS.exports=Sc});var XS=v(wr=>{"use strict";c();var q4=wr&&wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V4=wr&&wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H4=wr&&wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q4(e,t,r);return V4(e,t),e},j4=wr&&wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wr,"__esModule",{value:!0});wr.ProtoSerializer=void 0;var G4=j4(Wt()),Um=Zt(),Q4=Ro(),k4=H4(He()),K4=Kf(),qm=class{serializeTransaction(e){let r=JS().proto,n=new Um.Address(e.getReceiver().bech32()).pubkey(),i=new Um.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==Q4.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Um.Address(u.bech32()).pubkey(),s.GuardSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return h.Buffer.from(o)}serializeTransactionValue(e){let r=new G4.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=K4.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new k4.ErrUnsupportedOperation("deserializeTransaction")}};wr.ProtoSerializer=qm});var ZS=v(Qs=>{"use strict";c();var z4=Qs&&Qs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W4=Qs&&Qs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&z4(e,t,r)};Object.defineProperty(Qs,"__esModule",{value:!0});W4(XS(),Qs)});var rC=v(an=>{"use strict";c();var $4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$4(e,t,r);return Y4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.Signature=void 0;var eC=J4(He()),tC=64,Rr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Rr.fromHex(e);if(e instanceof h.Buffer)return Rr.fromBuffer(e)}}static empty(){return new Rr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Rr.isValidHex(e))throw new eC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==tC}static fromValidHex(e){let r=new Rr;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=tC)throw new eC.ErrSignatureCannotCreate(e);return Rr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};an.Signature=Rr});var Cc=v(bh=>{"use strict";c();Object.defineProperty(bh,"__esModule",{value:!0});bh.TransactionPayload=void 0;var Ba=class{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ba("");let r=h.Buffer.from(e,"base64").toString();return new Ba(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>h.Buffer.from(e,"hex"))}length(){return h.Buffer.from(this.data).length}};bh.TransactionPayload=Ba});var Vm=v((Nte,nC)=>{c();Un.notEqual=Z4;Un.notOk=eM;Un.equal=X4;Un.ok=Un;nC.exports=Un;function X4(t,e,r){Un(t==e,r)}function Z4(t,e,r){Un(t!=e,r)}function eM(t,e){Un(!t,e)}function Un(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ua=v(Ma=>{"use strict";c();var Hm=q0(),La=H0(),iC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ma.Buffer=z;Ma.SlowBuffer=oM;Ma.INSPECT_MAX_BYTES=50;var Ih=2147483647;Ma.kMaxLength=Ih;z.TYPED_ARRAY_SUPPORT=tM();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function tM(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Ih)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return km(t)}return uC(t,e,r)}z.poolSize=8192;function uC(t,e,r){if(typeof t=="string")return nM(t,e);if(ArrayBuffer.isView(t))return iM(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(un(t,ArrayBuffer)||t&&un(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(un(t,SharedArrayBuffer)||t&&un(t.buffer,SharedArrayBuffer)))return Gm(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=sM(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return uC(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function cC(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function rM(t,e,r){return cC(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return rM(t,e,r)};function km(t){return cC(t),qn(t<0?0:Km(t)|0)}z.allocUnsafe=function(t){return km(t)};z.allocUnsafeSlow=function(t){return km(t)};function nM(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=lC(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function jm(t){let e=t.length<0?0:Km(t.length)|0,r=qn(e);for(let n=0;n=Ih)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ih.toString(16)+" bytes");return t|0}function oM(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),un(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function lC(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||un(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Qm(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return EC(t).length;default:if(i)return n?-1:Qm(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=lC;function aM(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return mM(this,e,r);case"utf8":case"utf-8":return hC(this,e,r);case"ascii":return gM(this,e,r);case"latin1":case"binary":return yM(this,e,r);case"base64":return dM(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wM(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function ks(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};iC&&(z.prototype[iC]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(un(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Wm(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:sC(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):sC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function sC(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return uM(this,e,r,n);case"utf8":case"utf-8":return cM(this,e,r,n);case"ascii":case"latin1":case"binary":return lM(this,e,r,n);case"base64":return fM(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hM(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dM(t,e,r){return e===0&&r===t.length?Hm.fromByteArray(t):Hm.fromByteArray(t.slice(e,r))}function hC(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return pM(n)}var oC=4096;function pM(t){let e=t.length;if(e<=oC)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=Ai(function(e){e=e>>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Fa(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Tc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Nt(e,4,this.length),La.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),La.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),La.read(this,e,!1,52,8)};function tr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;tr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function dC(t,e,r,n,i){wC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function pC(t,e,r,n,i){wC(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=Ai(function(e,r=0){return dC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=Ai(function(e,r=0){return pC(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);tr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||tr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=Ai(function(e,r=0){return dC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=Ai(function(e,r=0){return pC(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function gC(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function yC(t,e,r,n,i){return e=+e,r=r>>>0,i||gC(t,e,r,4,34028234663852886e22,-34028234663852886e22),La.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return yC(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return yC(this,e,r,!1,n)};function mC(t,e,r,n,i){return e=+e,r=r>>>0,i||gC(t,e,r,8,17976931348623157e292,-17976931348623157e292),La.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return mC(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return mC(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=aC(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=aC(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function aC(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function EM(t,e,r){Fa(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Tc(e,t.length-(r+1))}function wC(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Ra.ERR_OUT_OF_RANGE("value",a,t)}EM(n,i,s)}function Fa(t,e){if(typeof t!="number")throw new Ra.ERR_INVALID_ARG_TYPE(e,"number",t)}function Tc(t,e,r){throw Math.floor(t)!==t?(Fa(t,r),new Ra.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ra.ERR_BUFFER_OUT_OF_BOUNDS:new Ra.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var vM=/[^+/0-9A-Za-z-_]/g;function AM(t){if(t=t.split("=")[0],t=t.trim().replace(vM,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Qm(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function _M(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function EC(t){return Hm.toByteArray(AM(t))}function Sh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function un(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Wm(t){return t!==t}var IM=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ai(t){return typeof BigInt>"u"?SM:t}function SM(){throw new Error("BigInt not supported")}});var AC=v((Rte,vC)=>{c();vC.exports=$m;$m.supported=typeof WebAssembly<"u";function $m(t){if(!$m.supported)return null;var e=t&&t.imports,r=CM("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function CM(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(TM)):new(Ua()).Buffer(t,"base64")}function TM(t){return t.charCodeAt(0)}});var xC=v((Ute,ln)=>{c();var cn=Vm(),Ke=AC()(),Vn=64,Ch=[];ln.exports=Er;var _C=ln.exports.BYTES_MIN=16,bC=ln.exports.BYTES_MAX=64,Fte=ln.exports.BYTES=32,IC=ln.exports.KEYBYTES_MIN=16,SC=ln.exports.KEYBYTES_MAX=64,Mte=ln.exports.KEYBYTES=32,CC=ln.exports.SALTBYTES=16,TC=ln.exports.PERSONALBYTES=16;function Er(t,e,r,n,i){if(!(this instanceof Er))return new Er(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(cn(t>=_C,"digestLength must be at least "+_C+", was given "+t),cn(t<=bC,"digestLength must be at most "+bC+", was given "+t),e!=null&&cn(e.length>=IC,"key must be at least "+IC+", was given "+e.length),e!=null&&cn(e.length<=SC,"key must be at least "+SC+", was given "+e.length),r!=null&&cn(r.length===CC,"salt must be exactly "+CC+", was given "+r.length),n!=null&&cn(n.length===TC,"personal must be exactly "+TC+", was given "+n.length)),Ch.length||(Ch.push(Vn),Vn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Ch.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,Vn,Vn+e.length),Ke.memory[this.pointer+200]=128)}Er.prototype.update=function(t){return cn(this.finalized===!1,"Hash instance finalized"),cn(t,"input must be TypedArray or Buffer"),Vn+t.length>Ke.memory.length&&Ke.realloc(Vn+t.length),Ke.memory.set(t,Vn),Ke.exports.blake2b_update(this.pointer,Vn,Vn+t.length),this};Er.prototype.digest=function(t){if(cn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Ch.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return NM(Ke.memory,this.pointer+128,this.digestLength);cn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ii=Vm(),Nc=xC();function Th(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function NC(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function FC(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function _i(t,e,r,n,i,s){var o=xc[i],a=xc[i+1],u=xc[s],l=xc[s+1];Th(Ie,t,e),NC(Ie,t,o,a);var f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1];Ie[n]=d,Ie[n+1]=f,Th(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=f>>>24^d<<8,Ie[e+1]=d>>>24^f<<8,Th(Ie,t,e),NC(Ie,t,u,l),f=Ie[n]^Ie[t],d=Ie[n+1]^Ie[t+1],Ie[n]=f>>>16^d<<16,Ie[n+1]=d>>>16^f<<16,Th(Ie,r,n),f=Ie[e]^Ie[r],d=Ie[e+1]^Ie[r+1],Ie[e]=d>>>31^f<<1,Ie[e+1]=f>>>31^d<<1}var MC=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),OM=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Gt=new Uint8Array(OM.map(function(t){return t*2})),Ie=new Uint32Array(32),xc=new Uint32Array(32);function UC(t,e){var r=0;for(r=0;r<16;r++)Ie[r]=t.h[r],Ie[r+16]=MC[r];for(Ie[24]=Ie[24]^t.t,Ie[25]=Ie[25]^t.t/4294967296,e&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]),r=0;r<32;r++)xc[r]=FC(t.b,4*r);for(r=0;r<12;r++)_i(0,8,16,24,Gt[r*16+0],Gt[r*16+1]),_i(2,10,18,26,Gt[r*16+2],Gt[r*16+3]),_i(4,12,20,28,Gt[r*16+4],Gt[r*16+5]),_i(6,14,22,30,Gt[r*16+6],Gt[r*16+7]),_i(0,10,20,30,Gt[r*16+8],Gt[r*16+9]),_i(2,12,22,24,Gt[r*16+10],Gt[r*16+11]),_i(4,14,16,26,Gt[r*16+12],Gt[r*16+13]),_i(6,8,18,28,Gt[r*16+14],Gt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ie[r]^Ie[r+16]}var bi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function qa(t,e,r,n){bi.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,bi[0]=t,e&&(bi[1]=e.length),bi[2]=1,bi[3]=1,r&&bi.set(r,32),n&&bi.set(n,48);for(var i=0;i<16;i++)this.h[i]=MC[i]^FC(bi,i*4);e&&(qC(this,e),this.c=128)}qa.prototype.update=function(t){return Ii(t!=null,"input must be Uint8Array or Buffer"),qC(this,t),this};qa.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ii(e.length>=this.outlen,"out must have at least outlen bytes of space"),PM(this,e),t==="hex"?BM(e):e};qa.prototype.final=qa.prototype.digest;qa.ready=function(t){Nc.ready(function(){t()})};function qC(t,e){for(var r=0;r>2]>>8*(r&3);return e}function BM(t){for(var e="",r=0;r=DC,"outlen must be at least "+DC+", was given "+e),Ii(e<=OC,"outlen must be at most "+OC+", was given "+e),r!=null&&Ii(r.length>=PC,"key must be at least "+PC+", was given "+r.length),r!=null&&Ii(r.length<=BC,"key must be at most "+BC+", was given "+r.length),n!=null&&Ii(n.length===RC,"salt must be exactly "+RC+", was given "+n.length),i!=null&&Ii(i.length===LC,"personal must be exactly "+LC+", was given "+i.length)),new VC(e,r,n,i)};rr.exports.ready=function(t){Nc.ready(function(){t()})};rr.exports.WASM_SUPPORTED=Nc.SUPPORTED;rr.exports.WASM_LOADED=!1;var DC=rr.exports.BYTES_MIN=16,OC=rr.exports.BYTES_MAX=64,Vte=rr.exports.BYTES=32,PC=rr.exports.KEYBYTES_MIN=16,BC=rr.exports.KEYBYTES_MAX=64,Hte=rr.exports.KEYBYTES=32,RC=rr.exports.SALTBYTES=16,LC=rr.exports.PERSONALBYTES=16;Nc.ready(function(t){t||(rr.exports.WASM_LOADED=!0,VC=Nc)})});var Pc=v(vr=>{"use strict";c();var LM=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FM=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MM=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LM(e,t,r);return FM(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.TransactionHash=vr.Transaction=void 0;var Va=Wt(),Dc=Zt(),UM=mh(),qM=Ro(),VM=MM(He()),HM=YI(),Hn=XI(),jM=ZS(),jC=rC(),GC=Cc(),GM=fr(),QM=HC(),kM=32,Oc=class{constructor({nonce:e,value:r,receiver:n,sender:i,gasPrice:s,gasLimit:o,data:a,chainID:u,version:l,options:f,guardian:d}){this.nonce=e||0,this.value=r?new Va.BigNumber(r.toString()).toFixed(0):0,this.sender=i,this.receiver=n,this.gasPrice=s||qM.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new GC.TransactionPayload,this.chainID=u,this.version=l?new Hn.TransactionVersion(l.valueOf()):Hn.TransactionVersion.withDefaultVersion(),this.options=f?new Hn.TransactionOptions(f.valueOf()):Hn.TransactionOptions.withDefaultOptions(),this.guardian=d||Dc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Si.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new Hn.TransactionVersion(e.valueOf())}getOptions(){return new Hn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new Hn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return GM.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return UM.Compatibility.guardAddressIsSetAndNonZero(new Dc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new Oc({nonce:Number(e.nonce),value:new Va.BigNumber(e.value).toFixed(0),receiver:Dc.Address.fromString(e.receiver),sender:Dc.Address.fromString(e.sender),guardian:e.guardian==null?void 0:Dc.Address.fromString(e.guardian||""),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new GC.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Hn.TransactionVersion(e.version),options:e.options==null?void 0:new Hn.TransactionOptions(e.options)});return e.signature&&r.applySignature(new jC.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new jC.Signature(e.guardianSignature)),r}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}applyGuardianSignature(e){e instanceof h.Buffer?this.guardianSignature=e:this.guardianSignature=h.Buffer.from(e.hex(),"hex"),this.hash=Si.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new VM.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new Va.BigNumber(this.gasPrice.valueOf()),i=new Va.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new Va.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new Va.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};vr.Transaction=Oc;var Si=class extends HM.Hash{constructor(e){super(e)}static compute(e){let n=new jM.ProtoSerializer().serializeTransaction(e),i=QM(kM).update(n).digest("hex");return new Si(i)}};vr.TransactionHash=Si});var QC=v(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TransferTransactionsFactory=void 0;var Ym=ph(),Lr=Tt(),xh=Pc(),Jm=Cc(),Xm=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new xh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new Ym.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Jm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new xh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new Ym.ArgSerializer().valuesToString([Lr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Lr.U64Value(e.tokenTransfer.nonce),new Lr.BigUIntValue(e.tokenTransfer.valueOf()),new Lr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Jm.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new xh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new Lr.AddressValue(e.destination),new Lr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Lr.BytesValue.fromUTF8(u.tokenIdentifier),new Lr.U64Value(u.nonce),new Lr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Ym.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Jm.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new xh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Nh.TransferTransactionsFactory=Xm});var KC=v(Ks=>{"use strict";c();Object.defineProperty(Ks,"__esModule",{value:!0});Ks.GasEstimator=Ks.DefaultGasConfiguration=void 0;Ks.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var KM=1e5,kC=8e5,Zm=class{constructor(e){this.gasConfiguration=e||Ks.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+KM}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+kC}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+kC)*r+this.gasConfiguration.gasPerDataByte*e}};Ks.GasEstimator=Zm});var Oh=v(Dh=>{"use strict";c();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.Account=void 0;var zM=Zt(),ew=class{constructor(e){this.address=new zM.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};Dh.Account=ew});var tw=v(Ws=>{"use strict";c();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Logger=Ws.LogLevel=void 0;var zs;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(zs=Ws.LogLevel||(Ws.LogLevel={}));var Fr=class{static setLevel(e){Fr.logLevel=e}static trace(e,...r){Fr.logLevel>=zs.Debug||console.debug(e,r)}static debug(e,...r){Fr.logLevel>=zs.Debug||console.debug(e,r)}static info(e,...r){Fr.logLevel>=zs.Info||console.log(e,r)}static warn(e,...r){Fr.logLevel>=zs.Warn||console.warn(e,r)}static error(e,...r){Fr.logLevel>=zs.Error||console.error(e,r)}};Ws.Logger=Fr;Fr.logLevel=zs.Debug});var zC=v(fn=>{"use strict";c();var WM=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$M=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YM=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WM(e,t,r);return $M(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.AsyncTimer=void 0;var JM=YM(He()),XM=He(),rw=tw(),nw=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new JM.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,rw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){rw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new XM.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(rw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};fn.AsyncTimer=nw});var ow=v(ja=>{"use strict";c();var Ar=ja&&ja.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ja,"__esModule",{value:!0});ja.TransactionWatcher=void 0;var iw=zC(),Ha=He(),WC=tw(),_r=class{constructor(e,r={}){this.fetcher=new sw(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||_r.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||_r.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||_r.DefaultPatience}awaitPending(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ha.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Ar(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ha.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ha.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Ar(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ha.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Ar(this,void 0,void 0,function*(){let n=()=>Ar(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ha.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Ar(this,void 0,void 0,function*(){let i=new iw.AsyncTimer("watcher:periodic"),s=new iw.AsyncTimer("watcher:patience"),o=new iw.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(WC.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Ha.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};ja.TransactionWatcher=_r;_r.DefaultPollingInterval=6e3;_r.DefaultTimeout=_r.DefaultPollingInterval*15;_r.DefaultPatience=0;_r.NoopOnStatusReceived=t=>{};var sw=class{constructor(e){this.fetcher=e}getTransaction(e){return Ar(this,void 0,void 0,function*(){return WC.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var $C=v(Rh=>{"use strict";c();Object.defineProperty(Rh,"__esModule",{value:!0});Rh.CodeMetadata=void 0;var aw=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=Ph.Upgradeable),this.readable&&(e|=Ph.Readable),this.payable&&(r|=Bh.Payable),this.payableBySc&&(r|=Bh.PayableBySc),h.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};Rh.CodeMetadata=aw;var Ph;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(Ph||(Ph={}));var Bh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Bh||(Bh={}))});var Lh=v(hn=>{"use strict";c();var ZM=hn&&hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eU=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tU=hn&&hn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZM(e,t,r);return eU(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.ContractFunction=void 0;var rU=tU(He()),Bc=class{constructor(e){if(this.name=e,e==null)throw new rU.ErrInvalidFunctionName}static none(){return new Bc("untitled")}toString(){return this.name}valueOf(){return this.name}};hn.ContractFunction=Bc});var YC=v(br=>{"use strict";c();var nU=br&&br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iU=br&&br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sU=br&&br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nU(e,t,r);return iU(e,t),e},oU=br&&br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(br,"__esModule",{value:!0});br.InteractionChecker=void 0;var uw=sU(He()),aU=oU(Wt()),cw=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new aU.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new uw.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new uw.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(Fh,"__esModule",{value:!0});Fh.Query=void 0;var uU=Zt(),cU=ph(),lw=class{constructor(e){this.caller=e.caller||new uU.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new cU.ArgSerializer().valuesToStrings(this.args)}};Fh.Query=lw});var XC=v(Uh=>{"use strict";c();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.Interaction=void 0;var JC=Zt(),lU=mh(),fw=Ro(),hw=Lh(),fU=YC(),hU=Mh(),Ga=Tt(),dw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new JC.Address,this.sender=new JC.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new Qa([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){lU.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new hw.ContractFunction(fw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new hw.ContractFunction(fw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new hw.ContractFunction(fw.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new hU.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new Qa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new Qa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new Qa(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new fU.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Uh.Interaction=dw;var Qa=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new Ga.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Ga.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Ga.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Ga.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Ga.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Ga.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var ZC=v(qh=>{"use strict";c();Object.defineProperty(qh,"__esModule",{value:!0});qh.ArgumentErrorContext=void 0;var dU=He(),pw=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new dU.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) +Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};qh.ArgumentErrorContext=pw});var tT=v($s=>{"use strict";c();var pU=$s&&$s.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($s,"__esModule",{value:!0});$s.NativeSerializer=void 0;var gU=pU(Wt()),yU=Zt(),eT=He(),mU=tm(),wU=ZC(),_e=Tt(),EU;(function(t){function e(_,B){_=_||[],_=r(_,B);let x=B.input,O=[];for(let P=0;P0&&B[0].type.getCardinality().isComposite()&&(O=1/0,P=!0);for(let L of B){if(L.type.getCardinality().isSingular())break;x-=1}return{min:x,max:O,variadic:P}}function i(_,B,x){if(_&&_.belongsToTypesystem)return _;if(B instanceof _e.OptionType)return s(_,B,x);if(B instanceof _e.OptionalType)return o(_,B,x);if(B instanceof _e.VariadicType)return a(_,B,x);if(B instanceof _e.CompositeType)return l(_,B,x);if(B instanceof _e.TupleType)return f(_,B,x);if(B instanceof _e.StructType)return d(_,B,x);if(B instanceof _e.ListType)return u(_,B,x);if(B instanceof _e.PrimitiveType)return y(_,B,x);x.throwError(`convertToTypedValue: unhandled type ${B}`)}function s(_,B,x){if(_==null)return _e.OptionValue.newMissing();let O=i(_,B.getFirstTypeParameter(),x);return _e.OptionValue.newProvided(O)}function o(_,B,x){if(_==null)return new _e.OptionalValue(B);let O=i(_,B.getFirstTypeParameter(),x);return new _e.OptionalValue(B,O)}function a(_,B,x){_==null&&(_=[]),_.map===void 0&&x.convertError(_,"Variadic");let O=_.map(function(P){return i(P,B.getFirstTypeParameter(),x)});return new _e.VariadicValue(B,O)}function u(_,B,x){_.map===void 0&&x.convertError(_,"List");let O=_.map(function(P){return i(P,B.getFirstTypeParameter(),x)});return new _e.List(B,O)}function l(_,B,x){let O=[],P=B.getTypeParameters();x.guardSameLength(_,P);for(let L=0;L{"use strict";c();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.ContractCallPayloadBuilder=Mr.ContractUpgradePayloadBuilder=Mr.ContractDeployPayloadBuilder=Mr.ArwenVirtualMachine=void 0;var ww=Cc(),Ew=fr(),vU=ph();Mr.ArwenVirtualMachine="0500";var gw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Ew.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Mr.ArwenVirtualMachine}@${r}`;return n=vw(n,this.arguments),new ww.TransactionPayload(n)}};Mr.ContractDeployPayloadBuilder=gw;var yw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){Ew.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=vw(n,this.arguments),new ww.TransactionPayload(n)}};Mr.ContractUpgradePayloadBuilder=yw;var mw=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){Ew.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=vw(e,this.arguments),new ww.TransactionPayload(e)}};Mr.ContractCallPayloadBuilder=mw;function vw(t,e){let{argumentsString:r,count:n}=new vU.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var jn=v((vre,Aw)=>{"use strict";c();var ka=typeof Reflect=="object"?Reflect:null,nT=ka&&typeof ka.apply=="function"?ka.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Vh;ka&&typeof ka.ownKeys=="function"?Vh=ka.ownKeys:Object.getOwnPropertySymbols?Vh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Vh=function(e){return Object.getOwnPropertyNames(e)};function AU(t){console&&console.warn&&console.warn(t)}var sT=Number.isNaN||function(e){return e!==e};function je(){je.init.call(this)}Aw.exports=je;Aw.exports.once=SU;je.EventEmitter=je;je.prototype._events=void 0;je.prototype._eventsCount=0;je.prototype._maxListeners=void 0;var iT=10;function Hh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(je,"defaultMaxListeners",{enumerable:!0,get:function(){return iT},set:function(t){if(typeof t!="number"||t<0||sT(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");iT=t}});je.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};je.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||sT(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function oT(t){return t._maxListeners===void 0?je.defaultMaxListeners:t._maxListeners}je.prototype.getMaxListeners=function(){return oT(this)};je.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")nT(u,this,r);else for(var l=u.length,f=fT(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,AU(a)}return t}je.prototype.addListener=function(e,r){return aT(this,e,r,!1)};je.prototype.on=je.prototype.addListener;je.prototype.prependListener=function(e,r){return aT(this,e,r,!0)};function _U(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function uT(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=_U.bind(n);return i.listener=r,n.wrapFn=i,i}je.prototype.once=function(e,r){return Hh(r),this.on(e,uT(this,e,r)),this};je.prototype.prependOnceListener=function(e,r){return Hh(r),this.prependListener(e,uT(this,e,r)),this};je.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Hh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():bU(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};je.prototype.off=je.prototype.removeListener;je.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function cT(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?IU(i):fT(i,i.length)}je.prototype.listeners=function(e){return cT(this,e,!0)};je.prototype.rawListeners=function(e){return cT(this,e,!1)};je.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):lT.call(t,e)};je.prototype.listenerCount=lT;function lT(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}je.prototype.eventNames=function(){return this._eventsCount>0?Vh(this._events):[]};function fT(t,e){for(var r=new Array(e),n=0;n{c();dT.exports=jn().EventEmitter});var bw=v(()=>{c()});var ET=v((Tre,wT)=>{"use strict";c();function pT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function gT(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return jh.alloc(0);for(var n=jh.allocUnsafe(r>>>0),i=this.head,s=0;i;)RU(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=jh.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:BU,value:function(r,n){return Iw(this,gT(gT({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var Cw=v((Nre,AT)=>{"use strict";c();function LU(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(Sw,this,t)):p.default.nextTick(Sw,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(Gh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(vT,r,s)):p.default.nextTick(vT,r,s):e?(p.default.nextTick(Gh,r),e(s)):p.default.nextTick(Gh,r)}),this)}function vT(t,e){Sw(t,e),Gh(t)}function Gh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function FU(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Sw(t,e){t.emit("error",e)}function MU(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}AT.exports={destroy:LU,undestroy:FU,errorOrDestroy:MU}});var Ys=v((Ore,IT)=>{"use strict";c();function UU(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var bT={};function Ir(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){UU(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,bT[t]=i}function _T(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function qU(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function VU(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function HU(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Ir("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ir("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&qU(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(VU(t," argument"))i="The ".concat(t," ").concat(n," ").concat(_T(e,"type"));else{var s=HU(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(_T(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Ir("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ir("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ir("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ir("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ir("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ir("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ir("ERR_STREAM_WRITE_AFTER_END","write after end");Ir("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ir("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ir("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");IT.exports.codes=bT});var Tw=v((Bre,ST)=>{"use strict";c();var jU=Ys().codes.ERR_INVALID_OPT_VALUE;function GU(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function QU(t,e,r,n){var i=GU(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new jU(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}ST.exports={getHighWaterMark:QU}});var Ka=v((Lre,xw)=>{c();typeof Object.create=="function"?xw.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:xw.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var TT=v((Mre,CT)=>{c();CT.exports=kU;function kU(t,e){if(Nw("noDeprecation"))return t;var r=!1;function n(){if(!r){if(Nw("throwDeprecation"))throw new Error(e);Nw("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function Nw(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var Pw=v((qre,BT)=>{"use strict";c();BT.exports=ut;function NT(t){var e=this;this.next=null,this.entry=null,this.finish=function(){wq(e,t)}}var za;ut.WritableState=Lc;var KU={deprecate:TT()},DT=_w(),kh=Ua().Buffer,zU=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function WU(t){return kh.from(t)}function $U(t){return kh.isBuffer(t)||t instanceof zU}var Ow=Cw(),YU=Tw(),JU=YU.getHighWaterMark,Ci=Ys().codes,XU=Ci.ERR_INVALID_ARG_TYPE,ZU=Ci.ERR_METHOD_NOT_IMPLEMENTED,eq=Ci.ERR_MULTIPLE_CALLBACK,tq=Ci.ERR_STREAM_CANNOT_PIPE,rq=Ci.ERR_STREAM_DESTROYED,nq=Ci.ERR_STREAM_NULL_VALUES,iq=Ci.ERR_STREAM_WRITE_AFTER_END,sq=Ci.ERR_UNKNOWN_ENCODING,Wa=Ow.errorOrDestroy;Ka()(ut,DT);function oq(){}function Lc(t,e,r){za=za||Js(),t=t||{},typeof r!="boolean"&&(r=e instanceof za),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=JU(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){dq(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new NT(this)}Lc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Lc.prototype,"buffer",{get:KU.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Qh;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Qh=Function.prototype[Symbol.hasInstance],Object.defineProperty(ut,Symbol.hasInstance,{value:function(e){return Qh.call(this,e)?!0:this!==ut?!1:e&&e._writableState instanceof Lc}})):Qh=function(e){return e instanceof this};function ut(t){za=za||Js();var e=this instanceof za;if(!e&&!Qh.call(ut,this))return new ut(t);this._writableState=new Lc(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),DT.call(this)}ut.prototype.pipe=function(){Wa(this,new tq)};function aq(t,e){var r=new iq;Wa(t,r),p.default.nextTick(e,r)}function uq(t,e,r,n){var i;return r===null?i=new nq:typeof r!="string"&&!e.objectMode&&(i=new XU("chunk",["string","Buffer"],r)),i?(Wa(t,i),p.default.nextTick(n,i),!1):!0}ut.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&$U(t);return s&&!kh.isBuffer(t)&&(t=WU(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=oq),n.ending?aq(this,r):(s||uq(this,n,t,r))&&(n.pendingcb++,i=lq(this,n,s,t,e,r)),i};ut.prototype.cork=function(){this._writableState.corked++};ut.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&OT(this,t))};ut.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new sq(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ut.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function cq(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=kh.from(e,r)),e}Object.defineProperty(ut.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function lq(t,e,r,n,i,s){if(!r){var o=cq(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var Eq=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};LT.exports=dn;var RT=Lw(),Rw=Pw();Ka()(dn,RT);for(Bw=Eq(Rw.prototype),Kh=0;Kh{c();var Wh=Ua(),pn=Wh.Buffer;function FT(t,e){for(var r in t)e[r]=t[r]}pn.from&&pn.alloc&&pn.allocUnsafe&&pn.allocUnsafeSlow?MT.exports=Wh:(FT(Wh,Fw),Fw.Buffer=Xs);function Xs(t,e,r){return pn(t,e,r)}Xs.prototype=Object.create(pn.prototype);FT(pn,Xs);Xs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return pn(t,e,r)};Xs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=pn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Xs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return pn(t)};Xs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Wh.SlowBuffer(t)}});var qw=v(VT=>{"use strict";c();var Uw=UT().Buffer,qT=Uw.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _q(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function bq(t){var e=_q(t);if(typeof e!="string"&&(Uw.isEncoding===qT||!qT(t)))throw new Error("Unknown encoding: "+t);return e||t}VT.StringDecoder=Fc;function Fc(t){this.encoding=bq(t);var e;switch(this.encoding){case"utf16le":this.text=Nq,this.end=Dq,e=4;break;case"utf8":this.fillLast=Cq,e=4;break;case"base64":this.text=Oq,this.end=Pq,e=3;break;default:this.write=Bq,this.end=Rq;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Uw.allocUnsafe(e)}Fc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Iq(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Sq(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Cq(t){var e=this.lastTotal-this.lastNeed,r=Sq(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Tq(t,e){var r=Iq(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function xq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Nq(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Dq(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Oq(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Pq(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Bq(t){return t.toString(this.encoding)}function Rq(t){return t&&t.length?this.write(t):""}});var $h=v((Kre,GT)=>{"use strict";c();var HT=Ys().codes.ERR_STREAM_PREMATURE_CLOSE;function Lq(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var Yh;function Ti(t,e,r){return e=Uq(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Uq(t){var e=qq(t,"string");return typeof e=="symbol"?e:String(e)}function qq(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vq=$h(),xi=Symbol("lastResolve"),Zs=Symbol("lastReject"),Mc=Symbol("error"),Jh=Symbol("ended"),eo=Symbol("lastPromise"),Vw=Symbol("handlePromise"),to=Symbol("stream");function Ni(t,e){return{value:t,done:e}}function Hq(t){var e=t[xi];if(e!==null){var r=t[to].read();r!==null&&(t[eo]=null,t[xi]=null,t[Zs]=null,e(Ni(r,!1)))}}function jq(t){p.default.nextTick(Hq,t)}function Gq(t,e){return function(r,n){t.then(function(){if(e[Jh]){r(Ni(void 0,!0));return}e[Vw](r,n)},n)}}var Qq=Object.getPrototypeOf(function(){}),kq=Object.setPrototypeOf((Yh={get stream(){return this[to]},next:function(){var e=this,r=this[Mc];if(r!==null)return Promise.reject(r);if(this[Jh])return Promise.resolve(Ni(void 0,!0));if(this[to].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Mc]?a(e[Mc]):o(Ni(void 0,!0))})});var n=this[eo],i;if(n)i=new Promise(Gq(n,this));else{var s=this[to].read();if(s!==null)return Promise.resolve(Ni(s,!1));i=new Promise(this[Vw])}return this[eo]=i,i}},Ti(Yh,Symbol.asyncIterator,function(){return this}),Ti(Yh,"return",function(){var e=this;return new Promise(function(r,n){e[to].destroy(null,function(i){if(i){n(i);return}r(Ni(void 0,!0))})})}),Yh),Qq),Kq=function(e){var r,n=Object.create(kq,(r={},Ti(r,to,{value:e,writable:!0}),Ti(r,xi,{value:null,writable:!0}),Ti(r,Zs,{value:null,writable:!0}),Ti(r,Mc,{value:null,writable:!0}),Ti(r,Jh,{value:e._readableState.endEmitted,writable:!0}),Ti(r,Vw,{value:function(s,o){var a=n[to].read();a?(n[eo]=null,n[xi]=null,n[Zs]=null,s(Ni(a,!1))):(n[xi]=s,n[Zs]=o)},writable:!0}),r));return n[eo]=null,Vq(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Zs];s!==null&&(n[eo]=null,n[xi]=null,n[Zs]=null,s(i)),n[Mc]=i;return}var o=n[xi];o!==null&&(n[eo]=null,n[xi]=null,n[Zs]=null,o(Ni(void 0,!0))),n[Jh]=!0}),e.on("readable",jq.bind(null,n)),n};QT.exports=Kq});var zT=v((Yre,KT)=>{c();KT.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Lw=v((Zre,nx)=>{"use strict";c();nx.exports=Fe;var $a;Fe.ReadableState=JT;var Xre=jn().EventEmitter,YT=function(e,r){return e.listeners(r).length},qc=_w(),Xh=Ua().Buffer,zq=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Wq(t){return Xh.from(t)}function $q(t){return Xh.isBuffer(t)||t instanceof zq}var Hw=bw(),xe;Hw&&Hw.debuglog?xe=Hw.debuglog("stream"):xe=function(){};var Yq=ET(),Ww=Cw(),Jq=Tw(),Xq=Jq.getHighWaterMark,Zh=Ys().codes,Zq=Zh.ERR_INVALID_ARG_TYPE,eV=Zh.ERR_STREAM_PUSH_AFTER_EOF,tV=Zh.ERR_METHOD_NOT_IMPLEMENTED,rV=Zh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ya,jw,Gw;Ka()(Fe,qc);var Uc=Ww.errorOrDestroy,Qw=["error","close","destroy","pause","resume"];function nV(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function JT(t,e,r){$a=$a||Js(),t=t||{},typeof r!="boolean"&&(r=e instanceof $a),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Xq(this,t,"readableHighWaterMark",r),this.buffer=new Yq,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Ya||(Ya=qw().StringDecoder),this.decoder=new Ya(t.encoding),this.encoding=t.encoding)}function Fe(t){if($a=$a||Js(),!(this instanceof Fe))return new Fe(t);var e=this instanceof $a;this._readableState=new JT(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),qc.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=Ww.destroy;Fe.prototype._undestroy=Ww.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Xh.from(t,e),e=""),n=!0),XT(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return XT(this,t,null,!0,!1)};function XT(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,oV(t,s);else{var o;if(i||(o=iV(s,e)),o)Uc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Xh.prototype&&(e=Wq(e)),n)s.endEmitted?Uc(t,new rV):kw(t,s,e,!0);else if(s.ended)Uc(t,new eV);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?kw(t,s,e,!1):zw(t,s)):kw(t,s,e,!1)}else n||(s.reading=!1,zw(t,s))}return!s.ended&&(s.length=WT?t=WT:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function $T(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=sV(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Kw(this):ed(this),null;if(t=$T(t,e),t===0&&e.ended)return e.length===0&&Kw(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=tx(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Kw(this)),i!==null&&this.emit("data",i),i};function oV(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ed(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,ZT(t)))}}function ed(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(ZT,t))}function ZT(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,$w(t)}function zw(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(aV,t,e))}function aV(t,e){for(;!e.reading&&!e.ended&&(e.length1&&rx(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function y(R){xe("onerror",R),T(),t.removeListener("error",y),YT(t,"error")===0&&Uc(t,R)}nV(t,"error",y);function w(){t.removeListener("finish",E),T()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),T()}t.once("finish",E);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function uV(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&YT(t,"data")&&(r.flowing=!0,$w(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?ed(this):n.reading||p.default.nextTick(cV,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=qc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(ex,this),r};Fe.prototype.removeAllListeners=function(t){var e=qc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(ex,this),e};function ex(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function cV(t){xe("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,lV(this,t)),t.paused=!1,this};function lV(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(fV,t,e))}function fV(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),$w(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function $w(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Kw(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(hV,e,t))}function hV(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return Gw===void 0&&(Gw=zT()),Gw(Fe,t,e)});function rx(t,e){for(var r=0,n=t.length;r{"use strict";c();sx.exports=Gn;var td=Ys().codes,dV=td.ERR_METHOD_NOT_IMPLEMENTED,pV=td.ERR_MULTIPLE_CALLBACK,gV=td.ERR_TRANSFORM_ALREADY_TRANSFORMING,yV=td.ERR_TRANSFORM_WITH_LENGTH_0,rd=Js();Ka()(Gn,rd);function mV(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new pV);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();ax.exports=Vc;var ox=Yw();Ka()(Vc,ox);function Vc(t){if(!(this instanceof Vc))return new Vc(t);ox.call(this,t)}Vc.prototype._transform=function(t,e,r){r(null,t)}});var dx=v((sne,hx)=>{"use strict";c();var Jw;function EV(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var fx=Ys().codes,vV=fx.ERR_MISSING_ARGS,AV=fx.ERR_STREAM_DESTROYED;function cx(t){if(t)throw t}function _V(t){return t.setHeader&&typeof t.abort=="function"}function bV(t,e,r,n){n=EV(n);var i=!1;t.on("close",function(){i=!0}),Jw===void 0&&(Jw=$h()),Jw(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,_V(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new AV("pipe"))}}}function lx(t){t()}function IV(t,e){return t.pipe(e)}function SV(t){return!t.length||typeof t[t.length-1]!="function"?cx:t.pop()}function CV(){for(var t=arguments.length,e=new Array(t),r=0;r0;return bV(o,u,l,function(f){i||(i=f),f&&s.forEach(lx),!u&&(s.forEach(lx),n(i))})});return e.reduce(IV)}hx.exports=CV});var Xw=v((Sr,px)=>{c();Sr=px.exports=Lw();Sr.Stream=Sr;Sr.Readable=Sr;Sr.Writable=Pw();Sr.Duplex=Js();Sr.Transform=Yw();Sr.PassThrough=ux();Sr.finished=$h();Sr.pipeline=dx()});var mx=v((une,yx)=>{c();var{Transform:TV}=Xw();yx.exports=t=>class gx extends TV{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new gx(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var vx=v((lne,Ex)=>{c();var{Transform:xV}=Xw();Ex.exports=t=>class wx extends xV{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new wx(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _x=v((hne,Ax)=>{c();var NV=mx(),DV=vx();Ax.exports=function(t){let e=NV(t),r=DV(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var Sx=v(Ix=>{c();var bx=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Ix.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],y=f^(i<<1|s>>>31),w=d^(s<<1|i>>>31),E=t[0]^y,T=t[1]^w,R=t[10]^y,_=t[11]^w,B=t[20]^y,x=t[21]^w,O=t[30]^y,P=t[31]^w,L=t[40]^y,b=t[41]^w;y=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let C=t[2]^y,M=t[3]^w,Z=t[12]^y,K=t[13]^w,j=t[22]^y,G=t[23]^w,$=t[32]^y,de=t[33]^w,ae=t[42]^y,re=t[43]^w;y=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^y,ie=t[5]^w,te=t[14]^y,ne=t[15]^w,q=t[24]^y,ce=t[25]^w,oe=t[34]^y,le=t[35]^w,se=t[44]^y,ue=t[45]^w;y=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let g=t[6]^y,m=t[7]^w,A=t[16]^y,D=t[17]^w,I=t[26]^y,N=t[27]^w,F=t[36]^y,S=t[37]^w,U=t[46]^y,H=t[47]^w;y=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let V=t[8]^y,X=t[9]^w,ye=t[18]^y,we=t[19]^w,Pe=t[28]^y,$e=t[29]^w,ot=t[38]^y,De=t[39]^w,Me=t[48]^y,vt=t[49]^w,ni=E,us=T,cs=_<<4|R>>>28,Yt=R<<4|_>>>28,Dn=B<<3|x>>>29,qt=x<<3|B>>>29,At=P<<9|O>>>23,Qe=O<<9|P>>>23,Yg=L<<18|b>>>14,Jg=b<<18|L>>>14,Xg=C<<1|M>>>31,Zg=M<<1|C>>>31,e0=K<<12|Z>>>20,t0=Z<<12|K>>>20,r0=j<<10|G>>>22,n0=G<<10|j>>>22,i0=de<<13|$>>>19,s0=$<<13|de>>>19,o0=ae<<2|re>>>30,a0=re<<2|ae>>>30,u0=ie<<30|Y>>>2,c0=Y<<30|ie>>>2,l0=te<<6|ne>>>26,f0=ne<<6|te>>>26,h0=ce<<11|q>>>21,d0=q<<11|ce>>>21,p0=oe<<15|le>>>17,g0=le<<15|oe>>>17,y0=ue<<29|se>>>3,m0=se<<29|ue>>>3,w0=g<<28|m>>>4,E0=m<<28|g>>>4,v0=D<<23|A>>>9,A0=A<<23|D>>>9,_0=I<<25|N>>>7,b0=N<<25|I>>>7,I0=F<<21|S>>>11,S0=S<<21|F>>>11,C0=H<<24|U>>>8,T0=U<<24|H>>>8,x0=V<<27|X>>>5,N0=X<<27|V>>>5,D0=ye<<20|we>>>12,O0=we<<20|ye>>>12,P0=$e<<7|Pe>>>25,B0=Pe<<7|$e>>>25,R0=ot<<8|De>>>24,L0=De<<8|ot>>>24,F0=Me<<14|vt>>>18,M0=vt<<14|Me>>>18;t[0]=ni^~e0&h0,t[1]=us^~t0&d0,t[10]=w0^~D0&Dn,t[11]=E0^~O0&qt,t[20]=Xg^~l0&_0,t[21]=Zg^~f0&b0,t[30]=x0^~cs&r0,t[31]=N0^~Yt&n0,t[40]=u0^~v0&P0,t[41]=c0^~A0&B0,t[2]=e0^~h0&I0,t[3]=t0^~d0&S0,t[12]=D0^~Dn&i0,t[13]=O0^~qt&s0,t[22]=l0^~_0&R0,t[23]=f0^~b0&L0,t[32]=cs^~r0&p0,t[33]=Yt^~n0&g0,t[42]=v0^~P0&At,t[43]=A0^~B0&Qe,t[4]=h0^~I0&F0,t[5]=d0^~S0&M0,t[14]=Dn^~i0&y0,t[15]=qt^~s0&m0,t[24]=_0^~R0&Yg,t[25]=b0^~L0&Jg,t[34]=r0^~p0&C0,t[35]=n0^~g0&T0,t[44]=P0^~At&o0,t[45]=B0^~Qe&a0,t[6]=I0^~F0&ni,t[7]=S0^~M0&us,t[16]=i0^~y0&w0,t[17]=s0^~m0&E0,t[26]=R0^~Yg&Xg,t[27]=L0^~Jg&Zg,t[36]=p0^~C0&x0,t[37]=g0^~T0&N0,t[46]=At^~o0&u0,t[47]=Qe^~a0&c0,t[8]=F0^~ni&e0,t[9]=M0^~us&t0,t[18]=y0^~w0&D0,t[19]=m0^~E0&O0,t[28]=Yg^~Xg&l0,t[29]=Jg^~Zg&f0,t[38]=C0^~x0&cs,t[39]=T0^~N0&Yt,t[48]=o0^~u0&v0,t[49]=a0^~c0&A0,t[0]^=bx[e*2],t[1]^=bx[e*2+1]}}});var Tx=v((yne,Cx)=>{c();var nd=Sx();function Ja(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Ja.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};Ja.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(nd.p1600(this.state),this.count=0);return e};Ja.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};Cx.exports=Ja});var Nx=v((wne,xx)=>{c();xx.exports=_x()(Tx())});var Bx=v(Xa=>{"use strict";c();var OV=Xa&&Xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xa,"__esModule",{value:!0});Xa.SmartContract=void 0;var PV=OV(Wt()),Hc=Zt(),Zw=mh(),BV=He(),eE=Pc(),RV=fr(),LV=Kf(),Dx=$C(),Ox=Lh(),Px=XC(),FV=tT(),MV=Mh(),id=rT(),UV=Nx(),tE=class{constructor(e={}){this.address=new Hc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Hc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new Ox.ContractFunction(i);return new Px.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new Ox.ContractFunction(i),a=FV.NativeSerializer.nativeToTypedValues(s||[],n);return new Px.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return RV.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){Zw.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new Dx.CodeMetadata,i=i||[],s=s||0;let l=new id.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new eE.Transaction({receiver:Hc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){Zw.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new Dx.CodeMetadata,i=i||[],s=s||0;let l=new id.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new eE.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){Zw.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new id.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new eE.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new MV.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new BV.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Hc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new PV.default(r.valueOf().toString(10)),u=LV.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=UV("keccak256").update(l).digest(),d=h.Buffer.from(id.ArwenVirtualMachine,"hex"),y=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Hc.Address(y)}};Xa.SmartContract=tE});var Rx=v(Za=>{"use strict";c();Object.defineProperty(Za,"__esModule",{value:!0});Za.Signature=Za.Address=void 0;var rE=class{constructor(e){this.value=e}bech32(){return this.value}};Za.Address=rE;var nE=class{constructor(e){this.value=e}hex(){return this.value}};Za.Signature=nE});var Lx=v(jc=>{"use strict";c();Object.defineProperty(jc,"__esModule",{value:!0});jc.Operation=void 0;var qV;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(qV=jc.Operation||(jc.Operation={}))});var Fx=v(Di=>{"use strict";c();Object.defineProperty(Di,"__esModule",{value:!0});Di.ErrAccountNotConnected=Di.ErrCannotSignSingleTransaction=Di.Err=void 0;var Gc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Di.Err=Gc;var iE=class extends Gc{constructor(){super("Cannot sign single transaction.")}};Di.ErrCannotSignSingleTransaction=iE;var sE=class extends Gc{constructor(){super("Account is not connected.")}};Di.ErrAccountNotConnected=sE});var oE=v(eu=>{"use strict";c();var Oi=eu&&eu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(eu,"__esModule",{value:!0});eu.ExtensionProvider=void 0;var sd=Rx(),Qc=Lx(),Mx=Fx(),gn=class{constructor(){if(this.account={address:""},this.initialized=!1,gn._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");gn._instance=this}static getInstance(){return gn._instance}setAddress(e){return this.account.address=e,gn._instance}init(){return Oi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Qc.Operation.Connect,n),this.account.address})}logout(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Qc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Oi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new Mx.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new Mx.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Qc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{for(let n=0;n{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};eu.ExtensionProvider=gn;gn._instance=new gn});var Gx=v((qne,jx)=>{"use strict";c();function VV(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}jx.exports=HV;function HV(t,e,r){var n=r&&r.stringify||VV,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var Qx=Gx();zx.exports=mn;var kc=JV().console||{},jV={mapHttpRequest:ld,mapHttpResponse:ld,wrapRequestSerializer:aE,wrapResponseSerializer:aE,wrapErrorSerializer:aE,req:ld,res:ld,err:zV};function GV(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function mn(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||kc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=GV(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=Kc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:y});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:WV(t)};u.levels=mn.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Kc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=uE());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function y(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,tu(l,u,"error","log"),tu(l,u,"fatal","error"),tu(l,u,"warn","error"),tu(l,u,"info","log"),tu(l,u,"debug","log"),tu(l,u,"trace","log")}function w(E,T){if(!E)throw new Error("missing bindings for child Pino");T=T||{},i&&E.serializers&&(T.serializers=E.serializers);let R=T.serializers;if(i&&R){var _=Object.assign({},n,R),B=t.browser.serialize===!0?Object.keys(_):i;delete E.serializers,fd([E],B,_,this._stdErrSerialize)}function x(O){this._childLevel=(O._childLevel|0)+1,this.error=ru(O,E,"error"),this.fatal=ru(O,E,"fatal"),this.warn=ru(O,E,"warn"),this.info=ru(O,E,"info"),this.debug=ru(O,E,"debug"),this.trace=ru(O,E,"trace"),_&&(this.serializers=_,this._serialize=B),e&&(this._logEvent=uE([].concat(O._logEvent.bindings,E)))}return x.prototype=this,new x(this)}return u}mn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};mn.stdSerializers=jV;mn.stdTimeFunctions=Object.assign({},{nullTime:kx,epochTime:Kx,unixTime:$V,isoTime:YV});function tu(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Kc:i[r]?i[r]:kc[r]||kc[n]||Kc,QV(t,e,r)}function QV(t,e,r){!t.transmit&&e[r]===Kc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===kc?kc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ru(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;ilE,__asyncDelegator:()=>lH,__asyncGenerator:()=>cH,__asyncValues:()=>fH,__await:()=>zc,__awaiter:()=>nH,__classPrivateFieldGet:()=>gH,__classPrivateFieldSet:()=>yH,__createBinding:()=>sH,__decorate:()=>eH,__exportStar:()=>oH,__extends:()=>XV,__generator:()=>iH,__importDefault:()=>pH,__importStar:()=>dH,__makeTemplateObject:()=>hH,__metadata:()=>rH,__param:()=>tH,__read:()=>Wx,__rest:()=>ZV,__spread:()=>aH,__spreadArrays:()=>uH,__values:()=>fE});function XV(t,e){cE(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function ZV(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function tH(t,e){return function(r,n){e(r,n,t)}}function rH(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function nH(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function iH(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Wx(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function aH(){for(var t=[],e=0;e1||a(y,w)})})}function a(y,w){try{u(n[y](w))}catch(E){d(s[0][3],E)}}function u(y){y.value instanceof zc?Promise.resolve(y.value.v).then(l,f):d(s[0][2],y)}function l(y){a("next",y)}function f(y){a("throw",y)}function d(y,w){y(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function lH(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:zc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function fH(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof fE=="function"?fE(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function hH(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function dH(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function pH(t){return t&&t.__esModule?t:{default:t}}function gH(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function yH(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var cE,lE,ar=ge(()=>{c();cE=function(t,e){return cE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},cE(t,e)};lE=function(){return lE=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(dd,"__esModule",{value:!0});function mH(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}dd.safeJsonParse=mH;function wH(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}dd.safeJsonStringify=wH});var $x=v((Kne,pd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?pd.exports=global.localStorage:typeof window<"u"&&window.localStorage?pd.exports=window.localStorage:pd.exports=new e})()});var Yx=v(gd=>{"use strict";c();Object.defineProperty(gd,"__esModule",{value:!0});gd.IKeyValueStorage=void 0;var dE=class{};gd.IKeyValueStorage=dE});var Jx=v(yd=>{"use strict";c();Object.defineProperty(yd,"__esModule",{value:!0});yd.parseEntry=void 0;var EH=hE();function vH(t){var e;return[t[0],EH.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}yd.parseEntry=vH});var Zx=v(md=>{"use strict";c();Object.defineProperty(md,"__esModule",{value:!0});var Xx=(ar(),nt(or));Xx.__exportStar(Yx(),md);Xx.__exportStar(Jx(),md)});var t2=v(Wc=>{"use strict";c();Object.defineProperty(Wc,"__esModule",{value:!0});Wc.KeyValueStorage=void 0;var nu=(ar(),nt(or)),e2=hE(),AH=nu.__importDefault($x()),_H=Zx(),wd=class{constructor(){this.localStorage=AH.default}getKeys(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return nu.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_H.parseEntry)})}getItem(e){return nu.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return e2.safeJsonParse(r)})}setItem(e,r){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,e2.safeJsonStringify(r))})}removeItem(e){return nu.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Wc.KeyValueStorage=wd;Wc.default=wd});var r2=v(Ed=>{"use strict";c();Object.defineProperty(Ed,"__esModule",{value:!0});Ed.delay=void 0;function bH(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ed.delay=bH});var n2=v(iu=>{"use strict";c();Object.defineProperty(iu,"__esModule",{value:!0});iu.ONE_THOUSAND=iu.ONE_HUNDRED=void 0;iu.ONE_HUNDRED=100;iu.ONE_THOUSAND=1e3});var i2=v(fe=>{"use strict";c();Object.defineProperty(fe,"__esModule",{value:!0});fe.ONE_YEAR=fe.FOUR_WEEKS=fe.THREE_WEEKS=fe.TWO_WEEKS=fe.ONE_WEEK=fe.THIRTY_DAYS=fe.SEVEN_DAYS=fe.FIVE_DAYS=fe.THREE_DAYS=fe.ONE_DAY=fe.TWENTY_FOUR_HOURS=fe.TWELVE_HOURS=fe.SIX_HOURS=fe.THREE_HOURS=fe.ONE_HOUR=fe.SIXTY_MINUTES=fe.THIRTY_MINUTES=fe.TEN_MINUTES=fe.FIVE_MINUTES=fe.ONE_MINUTE=fe.SIXTY_SECONDS=fe.THIRTY_SECONDS=fe.TEN_SECONDS=fe.FIVE_SECONDS=fe.ONE_SECOND=void 0;fe.ONE_SECOND=1;fe.FIVE_SECONDS=5;fe.TEN_SECONDS=10;fe.THIRTY_SECONDS=30;fe.SIXTY_SECONDS=60;fe.ONE_MINUTE=fe.SIXTY_SECONDS;fe.FIVE_MINUTES=fe.ONE_MINUTE*5;fe.TEN_MINUTES=fe.ONE_MINUTE*10;fe.THIRTY_MINUTES=fe.ONE_MINUTE*30;fe.SIXTY_MINUTES=fe.ONE_MINUTE*60;fe.ONE_HOUR=fe.SIXTY_MINUTES;fe.THREE_HOURS=fe.ONE_HOUR*3;fe.SIX_HOURS=fe.ONE_HOUR*6;fe.TWELVE_HOURS=fe.ONE_HOUR*12;fe.TWENTY_FOUR_HOURS=fe.ONE_HOUR*24;fe.ONE_DAY=fe.TWENTY_FOUR_HOURS;fe.THREE_DAYS=fe.ONE_DAY*3;fe.FIVE_DAYS=fe.ONE_DAY*5;fe.SEVEN_DAYS=fe.ONE_DAY*7;fe.THIRTY_DAYS=fe.ONE_DAY*30;fe.ONE_WEEK=fe.SEVEN_DAYS;fe.TWO_WEEKS=fe.ONE_WEEK*2;fe.THREE_WEEKS=fe.ONE_WEEK*3;fe.FOUR_WEEKS=fe.ONE_WEEK*4;fe.ONE_YEAR=fe.ONE_DAY*365});var pE=v(vd=>{"use strict";c();Object.defineProperty(vd,"__esModule",{value:!0});var s2=(ar(),nt(or));s2.__exportStar(n2(),vd);s2.__exportStar(i2(),vd)});var a2=v(su=>{"use strict";c();Object.defineProperty(su,"__esModule",{value:!0});su.fromMiliseconds=su.toMiliseconds=void 0;var o2=pE();function IH(t){return t*o2.ONE_THOUSAND}su.toMiliseconds=IH;function SH(t){return Math.floor(t/o2.ONE_THOUSAND)}su.fromMiliseconds=SH});var c2=v(Ad=>{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});var u2=(ar(),nt(or));u2.__exportStar(r2(),Ad);u2.__exportStar(a2(),Ad)});var l2=v($c=>{"use strict";c();Object.defineProperty($c,"__esModule",{value:!0});$c.Watch=void 0;var _d=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};$c.Watch=_d;$c.default=_d});var f2=v(bd=>{"use strict";c();Object.defineProperty(bd,"__esModule",{value:!0});bd.IWatch=void 0;var gE=class{};bd.IWatch=gE});var h2=v(yE=>{"use strict";c();Object.defineProperty(yE,"__esModule",{value:!0});var CH=(ar(),nt(or));CH.__exportStar(f2(),yE)});var ro=v(ou=>{"use strict";c();Object.defineProperty(ou,"__esModule",{value:!0});var Id=(ar(),nt(or));Id.__exportStar(c2(),ou);Id.__exportStar(l2(),ou);Id.__exportStar(h2(),ou);Id.__exportStar(pE(),ou)});var mE,d2=ge(()=>{c();mE=class{}});var wE={};at(wE,{IEvents:()=>mE});var EE=ge(()=>{c();d2()});var p2=v(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.IHeartBeat=void 0;var TH=(EE(),nt(wE)),vE=class extends TH.IEvents{constructor(e){super()}};Sd.IHeartBeat=vE});var _E=v(AE=>{"use strict";c();Object.defineProperty(AE,"__esModule",{value:!0});var xH=(ar(),nt(or));xH.__exportStar(p2(),AE)});var g2=v(au=>{"use strict";c();Object.defineProperty(au,"__esModule",{value:!0});au.HEARTBEAT_EVENTS=au.HEARTBEAT_INTERVAL=void 0;var NH=ro();au.HEARTBEAT_INTERVAL=NH.FIVE_SECONDS;au.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var IE=v(bE=>{"use strict";c();Object.defineProperty(bE,"__esModule",{value:!0});var DH=(ar(),nt(or));DH.__exportStar(g2(),bE)});var y2=v(Cd=>{"use strict";c();Object.defineProperty(Cd,"__esModule",{value:!0});Cd.HeartBeat=void 0;var SE=(ar(),nt(or)),OH=jn(),PH=ro(),BH=_E(),CE=IE(),Yc=class extends BH.IHeartBeat{constructor(e){super(e),this.events=new OH.EventEmitter,this.interval=CE.HEARTBEAT_INTERVAL,this.interval=e?.interval||CE.HEARTBEAT_INTERVAL}static init(e){return SE.__awaiter(this,void 0,void 0,function*(){let r=new Yc(e);return yield r.init(),r})}init(){return SE.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return SE.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),PH.toMiliseconds(this.interval))})}pulse(){this.events.emit(CE.HEARTBEAT_EVENTS.pulse)}};Cd.HeartBeat=Yc});var m2=v(Jc=>{"use strict";c();Object.defineProperty(Jc,"__esModule",{value:!0});var TE=(ar(),nt(or));TE.__exportStar(y2(),Jc);TE.__exportStar(_E(),Jc);TE.__exportStar(IE(),Jc)});var xE=v(uu=>{"use strict";c();Object.defineProperty(uu,"__esModule",{value:!0});uu.PINO_CUSTOM_CONTEXT_KEY=uu.PINO_LOGGER_DEFAULTS=void 0;uu.PINO_LOGGER_DEFAULTS={level:"info"};uu.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var _2=v(nr=>{"use strict";c();Object.defineProperty(nr,"__esModule",{value:!0});nr.generateChildLogger=nr.formatChildLoggerContext=nr.getLoggerContext=nr.setBrowserLoggerContext=nr.getBrowserLoggerContext=nr.getDefaultLoggerOptions=void 0;var cu=xE();function RH(t){return Object.assign(Object.assign({},t),{level:t?.level||cu.PINO_LOGGER_DEFAULTS.level})}nr.getDefaultLoggerOptions=RH;function w2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}nr.getBrowserLoggerContext=w2;function E2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}nr.setBrowserLoggerContext=E2;function v2(t,e=cu.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=w2(t,e):r=t.bindings().context||"",r}nr.getLoggerContext=v2;function A2(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=v2(t,r);return n.trim()?`${n}/${e}`:e}nr.formatChildLoggerContext=A2;function LH(t,e,r=cu.PINO_CUSTOM_CONTEXT_KEY){let n=A2(t,e,r),i=t.child({context:n});return E2(i,n,r)}nr.generateChildLogger=LH});var DE=v(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.pino=void 0;var NE=(ar(),nt(or)),FH=NE.__importDefault(hd());Object.defineProperty(lu,"pino",{enumerable:!0,get:function(){return FH.default}});NE.__exportStar(xE(),lu);NE.__exportStar(_2(),lu)});var zE=v(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var fu=(EE(),nt(wE)),b2=jn();function MH(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var UH=MH(b2),OE=class extends fu.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},PE=class{constructor(e,r,n){this.core=e,this.logger=r}},BE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},RE=class{constructor(e,r){this.logger=e,this.core=r}},LE=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},FE=class extends fu.IEvents{constructor(e){super()}},ME=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},UE=class{constructor(){this.map=new Map}},qE=class extends fu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},VE=class{constructor(e,r){this.core=e,this.logger=r}},HE=class extends fu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},jE=class{constructor(e,r){this.logger=e,this.core=r}},GE=class extends UH.default{constructor(){super()}},QE=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},kE=class extends b2.EventEmitter{constructor(){super()}},KE=class{constructor(e){this.client=e}};Dt.ICore=OE,Dt.ICrypto=PE,Dt.IEngine=KE,Dt.IEngineEvents=kE,Dt.IExpirer=HE,Dt.IJsonRpcHistory=BE,Dt.IKeyChain=VE,Dt.IMessageTracker=RE,Dt.IPairing=jE,Dt.IPublisher=LE,Dt.IRelayer=FE,Dt.ISignClient=QE,Dt.ISignClientEvents=GE,Dt.IStore=ME,Dt.ISubscriber=qE,Dt.ISubscriberTopicMap=UE});var I2={};at(I2,{safeJsonParse:()=>Xc,safeJsonStringify:()=>Zc});function Xc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return VH(t)}catch{return t}}function Zc(t){return typeof t=="string"?t:qH(t)||""}var qH,VH,Td=ge(()=>{c();qH=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),VH=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var C2=v(xd=>{"use strict";c();Object.defineProperty(xd,"__esModule",{value:!0});xd.BrowserRandomSource=void 0;var S2=65536,WE=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty($E,"__esModule",{value:!0});function HH(t){for(var e=0;e{c()});var x2=v(Nd=>{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});Nd.NodeRandomSource=void 0;var jH=Cr(),YE=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof F_<"u"){let e=T2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.SystemRandomSource=void 0;var GH=C2(),QH=x2(),JE=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new GH.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new QH.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};Dd.SystemRandomSource=JE});var D2=v(ur=>{"use strict";c();Object.defineProperty(ur,"__esModule",{value:!0});function kH(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}ur.mul=Math.imul||kH;function KH(t,e){return t+e|0}ur.add=KH;function zH(t,e){return t-e|0}ur.sub=zH;function WH(t,e){return t<>>32-e}ur.rotl=WH;function $H(t,e){return t<<32-e|t>>>e}ur.rotr=$H;function YH(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}ur.isInteger=Number.isInteger||YH;ur.MAX_SAFE_INTEGER=9007199254740991;ur.isSafeInteger=function(t){return ur.isInteger(t)&&t>=-ur.MAX_SAFE_INTEGER&&t<=ur.MAX_SAFE_INTEGER}});var hu=v(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var O2=D2();function JH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=JH;function XH(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=XH;function ZH(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=ZH;function ej(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=ej;function P2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=P2;Ne.writeInt16BE=P2;function B2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=B2;Ne.writeInt16LE=B2;function XE(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=XE;function ZE(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=ZE;function e1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=e1;function t1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=t1;function Od(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Od;Ne.writeInt32BE=Od;function Pd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Pd;Ne.writeInt32LE=Pd;function tj(t,e){e===void 0&&(e=0);var r=XE(t,e),n=XE(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=tj;function rj(t,e){e===void 0&&(e=0);var r=ZE(t,e),n=ZE(t,e+4);return r*4294967296+n}Ne.readUint64BE=rj;function nj(t,e){e===void 0&&(e=0);var r=e1(t,e),n=e1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=nj;function ij(t,e){e===void 0&&(e=0);var r=t1(t,e),n=t1(t,e+4);return n*4294967296+r}Ne.readUint64LE=ij;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Od(t/4294967296>>>0,e,r),Od(t>>>0,e,r+4),e}Ne.writeUint64BE=R2;Ne.writeInt64BE=R2;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Pd(t>>>0,e,r),Pd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=L2;Ne.writeInt64LE=L2;function sj(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=sj;function oj(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=aj;function uj(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!O2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.randomStringForEntropy=Qt.randomString=Qt.randomUint32=Qt.randomBytes=Qt.defaultRandomSource=void 0;var mj=N2(),wj=hu(),F2=Cr();Qt.defaultRandomSource=new mj.SystemRandomSource;function r1(t,e=Qt.defaultRandomSource){return e.randomBytes(t)}Qt.randomBytes=r1;function Ej(t=Qt.defaultRandomSource){let e=r1(4,t),r=(0,wj.readUint32LE)(e);return(0,F2.wipe)(e),r}Qt.randomUint32=Ej;var M2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function U2(t,e=M2,r=Qt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=r1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Qn,"__esModule",{value:!0});var pu=hu(),du=Cr();Qn.DIGEST_LENGTH=64;Qn.BLOCK_SIZE=128;var V2=function(){function t(){this.digestLength=Qn.DIGEST_LENGTH,this.blockSize=Qn.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){du.wipe(this._buffer),du.wipe(this._tempHi),du.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(n1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=n1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){du.wipe(e.stateHi),du.wipe(e.stateLo),e.buffer&&du.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Qn.SHA512=V2;var q2=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function n1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],y=r[5],w=r[6],E=r[7],T=n[0],R=n[1],_=n[2],B=n[3],x=n[4],O=n[5],P=n[6],L=n[7],b,C,M,Z,K,j,G,$;o>=128;){for(var de=0;de<16;de++){var ae=8*de+s;t[de]=pu.readUint32BE(i,ae),e[de]=pu.readUint32BE(i,ae+4)}for(var de=0;de<80;de++){var re=a,Y=u,ie=l,te=f,ne=d,q=y,ce=w,oe=E,le=T,se=R,ue=_,g=B,m=x,A=O,D=P,I=L;if(b=E,C=L,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=(d>>>14|x<<32-14)^(d>>>18|x<<32-18)^(x>>>41-32|d<<32-(41-32)),C=(x>>>14|d<<32-14)^(x>>>18|d<<32-18)^(d>>>41-32|x<<32-(41-32)),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=d&y^~d&w,C=x&O^~x&P,K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=q2[de*2],C=q2[de*2+1],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=t[de%16],C=e[de%16],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,M=G&65535|$<<16,Z=K&65535|j<<16,b=M,C=Z,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),C=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,b=a&u^a&l^u&l,C=T&R^T&_^R&_,K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,oe=G&65535|$<<16,I=K&65535|j<<16,b=te,C=g,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=M,C=Z,K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,te=G&65535|$<<16,g=K&65535|j<<16,u=re,l=Y,f=ie,d=te,y=ne,w=q,E=ce,a=oe,R=le,_=se,B=ue,x=g,O=m,P=A,L=D,T=I,de%16===15)for(var ae=0;ae<16;ae++)b=t[ae],C=e[ae],K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=t[(ae+9)%16],C=e[(ae+9)%16],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,M=t[(ae+1)%16],Z=e[(ae+1)%16],b=(M>>>1|Z<<32-1)^(M>>>8|Z<<32-8)^M>>>7,C=(Z>>>1|M<<32-1)^(Z>>>8|M<<32-8)^(Z>>>7|M<<32-7),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,M=t[(ae+14)%16],Z=e[(ae+14)%16],b=(M>>>19|Z<<32-19)^(Z>>>61-32|M<<32-(61-32))^M>>>6,C=(Z>>>19|M<<32-19)^(M>>>61-32|Z<<32-(61-32))^(Z>>>6|M<<32-6),K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,t[ae]=G&65535|$<<16,e[ae]=K&65535|j<<16}b=a,C=T,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[0],C=n[0],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[0]=a=G&65535|$<<16,n[0]=T=K&65535|j<<16,b=u,C=R,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[1],C=n[1],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[1]=u=G&65535|$<<16,n[1]=R=K&65535|j<<16,b=l,C=_,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[2],C=n[2],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[2]=l=G&65535|$<<16,n[2]=_=K&65535|j<<16,b=f,C=B,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[3],C=n[3],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[3]=f=G&65535|$<<16,n[3]=B=K&65535|j<<16,b=d,C=x,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[4],C=n[4],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[4]=d=G&65535|$<<16,n[4]=x=K&65535|j<<16,b=y,C=O,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[5],C=n[5],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[5]=y=G&65535|$<<16,n[5]=O=K&65535|j<<16,b=w,C=P,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[6],C=n[6],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[6]=w=G&65535|$<<16,n[6]=P=K&65535|j<<16,b=E,C=L,K=C&65535,j=C>>>16,G=b&65535,$=b>>>16,b=r[7],C=n[7],K+=C&65535,j+=C>>>16,G+=b&65535,$+=b>>>16,j+=K>>>16,G+=j>>>16,$+=G>>>16,r[7]=E=G&65535|$<<16,n[7]=L=K&65535|j<<16,s+=128,o-=128}return s}function Aj(t){var e=new V2;e.update(t);var r=e.digest();return e.clean(),r}Qn.hash=Aj});var tN=v(qe=>{"use strict";c();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var _j=el(),tl=H2(),K2=Cr();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function Ee(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,z2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function W2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function Q2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return rl(r,t),rl(n,e),W2(r,n)}function $2(t){let e=new Uint8Array(32);return rl(e,t),e[0]&1}function Tj(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function no(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function so(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Ge(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,T=0,R=0,_=0,B=0,x=0,O=0,P=0,L=0,b=0,C=0,M=0,Z=0,K=0,j=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],D=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,T+=n*A,R+=n*D,_+=n*I,B+=n*N,x+=n*F,O+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,T+=n*m,R+=n*A,_+=n*D,B+=n*I,x+=n*N,O+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,T+=n*g,R+=n*m,_+=n*A,B+=n*D,x+=n*I,O+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,T+=n*ue,R+=n*g,_+=n*m,B+=n*A,x+=n*D,O+=n*I,P+=n*N,L+=n*F,b+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,T+=n*se,R+=n*ue,_+=n*g,B+=n*m,x+=n*A,O+=n*D,P+=n*I,L+=n*N,b+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,T+=n*le,R+=n*se,_+=n*ue,B+=n*g,x+=n*m,O+=n*A,P+=n*D,L+=n*I,b+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,T+=n*oe,R+=n*le,_+=n*se,B+=n*ue,x+=n*g,O+=n*m,P+=n*A,L+=n*D,b+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,w+=n*ne,E+=n*q,T+=n*ce,R+=n*oe,_+=n*le,B+=n*se,x+=n*ue,O+=n*g,P+=n*m,L+=n*A,b+=n*D,C+=n*I,M+=n*N,Z+=n*F,K+=n*S,n=e[8],w+=n*te,E+=n*ne,T+=n*q,R+=n*ce,_+=n*oe,B+=n*le,x+=n*se,O+=n*ue,P+=n*g,L+=n*m,b+=n*A,C+=n*D,M+=n*I,Z+=n*N,K+=n*F,j+=n*S,n=e[9],E+=n*te,T+=n*ne,R+=n*q,_+=n*ce,B+=n*oe,x+=n*le,O+=n*se,P+=n*ue,L+=n*g,b+=n*m,C+=n*A,M+=n*D,Z+=n*I,K+=n*N,j+=n*F,G+=n*S,n=e[10],T+=n*te,R+=n*ne,_+=n*q,B+=n*ce,x+=n*oe,O+=n*le,P+=n*se,L+=n*ue,b+=n*g,C+=n*m,M+=n*A,Z+=n*D,K+=n*I,j+=n*N,G+=n*F,$+=n*S,n=e[11],R+=n*te,_+=n*ne,B+=n*q,x+=n*ce,O+=n*oe,P+=n*le,L+=n*se,b+=n*ue,C+=n*g,M+=n*m,Z+=n*A,K+=n*D,j+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],_+=n*te,B+=n*ne,x+=n*q,O+=n*ce,P+=n*oe,L+=n*le,b+=n*se,C+=n*ue,M+=n*g,Z+=n*m,K+=n*A,j+=n*D,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],B+=n*te,x+=n*ne,O+=n*q,P+=n*ce,L+=n*oe,b+=n*le,C+=n*se,M+=n*ue,Z+=n*g,K+=n*m,j+=n*A,G+=n*D,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,O+=n*ne,P+=n*q,L+=n*ce,b+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,K+=n*g,j+=n*m,G+=n*A,$+=n*D,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],O+=n*te,P+=n*ne,L+=n*q,b+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,K+=n*ue,j+=n*g,G+=n*m,$+=n*A,de+=n*D,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*b,u+=38*C,l+=38*M,f+=38*Z,d+=38*K,y+=38*j,w+=38*G,E+=38*$,T+=38*de,R+=38*ae,_+=38*re,B+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=T,t[11]=R,t[12]=_,t[13]=B,t[14]=x,t[15]=O}function io(t,e){Ge(t,e,e)}function Y2(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)io(r,r),n!==2&&n!==4&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function xj(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)io(r,r),n!==1&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function a1(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee(),l=Ee(),f=Ee();so(r,t[1],t[0]),so(f,e[1],e[0]),Ge(r,r,f),no(n,t[0],t[1]),no(f,e[0],e[1]),Ge(n,n,f),Ge(i,t[3],e[3]),Ge(i,i,Sj),Ge(s,t[2],e[2]),no(s,s,s),so(o,n,r),so(a,s,i),no(u,s,i),no(l,n,r),Ge(t[0],o,a),Ge(t[1],l,u),Ge(t[2],u,a),Ge(t[3],o,l)}function k2(t,e,r){for(let n=0;n<4;n++)z2(t[n],e[n],r)}function c1(t,e){let r=Ee(),n=Ee(),i=Ee();Y2(i,e[2]),Ge(r,e[0],i),Ge(n,e[1],i),rl(t,n),t[31]^=$2(r)<<7}function J2(t,e,r){Pi(t[0],o1),Pi(t[1],gu),Pi(t[2],gu),Pi(t[3],o1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;k2(t,e,i),a1(e,t),a1(t,t),k2(t,e,i)}}function l1(t,e){let r=[Ee(),Ee(),Ee(),Ee()];Pi(r[0],j2),Pi(r[1],G2),Pi(r[2],gu),Ge(r[3],j2,G2),J2(t,r,e)}function X2(t){if(t.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,tl.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ee(),Ee(),Ee(),Ee()];l1(n,e),c1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}qe.generateKeyPairFromSeed=X2;function Nj(t){let e=(0,_j.randomBytes)(32,t),r=X2(e);return(0,K2.wipe)(e),r}qe.generateKeyPair=Nj;function Dj(t){if(t.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}qe.extractPublicKeyFromSecretKey=Dj;var s1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Z2(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*s1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*s1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function u1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;Z2(t,e)}function Oj(t,e){let r=new Float64Array(64),n=[Ee(),Ee(),Ee(),Ee()],i=(0,tl.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new tl.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),u1(a),l1(n,a),c1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();u1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return Z2(s.subarray(32),r),s}qe.sign=Oj;function eN(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee();return Pi(t[2],gu),Tj(t[1],e),io(i,t[1]),Ge(s,i,Ij),so(i,i,t[2]),no(s,t[2],s),io(o,s),io(a,o),Ge(u,a,o),Ge(r,u,i),Ge(r,r,s),xj(r,r),Ge(r,r,i),Ge(r,r,s),Ge(r,r,s),Ge(t[0],r,s),io(n,t[0]),Ge(n,n,s),Q2(n,i)&&Ge(t[0],t[0],Cj),io(n,t[0]),Ge(n,n,s),Q2(n,i)?-1:($2(t[0])===e[31]>>7&&so(t[0],o1,t[0]),Ge(t[3],t[0],t[1]),0)}function Pj(t,e,r){let n=new Uint8Array(32),i=[Ee(),Ee(),Ee(),Ee()],s=[Ee(),Ee(),Ee(),Ee()];if(r.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(eN(s,t))return!1;let o=new tl.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return u1(a),J2(i,s,a),l1(s,r.subarray(32)),a1(i,s),c1(n,i),!W2(r,n)}qe.verify=Pj;function Bj(t){let e=[Ee(),Ee(),Ee(),Ee()];if(eN(e,t))throw new Error("Ed25519: invalid public key");let r=Ee(),n=Ee(),i=e[1];no(r,gu,i),so(n,gu,i),Y2(n,n),Ge(r,r,n);let s=new Uint8Array(32);return rl(s,r),s}qe.convertPublicKeyToX25519=Bj;function Rj(t){let e=(0,tl.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,K2.wipe)(e),r}qe.convertSecretKeyToX25519=Rj});var Bd,Rd,oo,yu,Ld,nl,Fd,Md,Ud,mu,qd,Vd,rN,nN,Hd=ge(()=>{c();Bd="EdDSA",Rd="JWT",oo=".",yu="base64url",Ld="utf8",nl="utf8",Fd=":",Md="did",Ud="key",mu="base58btc",qd="z",Vd="K36",rN=32,nN=32});function Bi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var il=ge(()=>{c()});function wu(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Bi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var jd=ge(()=>{c();il()});function Gd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=wu(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Bi(r)}var f1=ge(()=>{c();jd();il()});function Lj(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,O=new Uint8Array(x);_!==B;){for(var P=E[_],L=0,b=x-1;(P!==0||L>>0,O[b]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=L,_++}for(var C=x-R;C!==x&&O[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(B);E[T];){var O=r[E.charCodeAt(T)];if(O===255)return;for(var P=0,L=B-1;(O!==0||P<_)&&L!==-1;L--,P++)O+=a*x[L]>>>0,x[L]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");_=P,T++}if(E[T]!==" "){for(var b=B-_;b!==B&&x[b]===0;)b++;for(var C=new Uint8Array(R+(B-b)),M=R;b!==B;)C[M++]=x[b++];return C}}}function w(E){var T=y(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var Fj,Mj,iN,sN=ge(()=>{c();Fj=Lj,Mj=Fj,iN=Mj});var xse,oN,kn,aN,uN,Ri=ge(()=>{c();xse=new Uint8Array(0),oN=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aN=t=>new TextEncoder().encode(t),uN=t=>new TextDecoder().decode(t)});var h1,d1,p1,lN,g1,Eu,Li,Uj,qj,ct,Ur=ge(()=>{c();sN();Ri();h1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},d1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return lN(this,e)}},p1=class{constructor(e){this.decoders=e}or(e){return lN(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},lN=(t,e)=>new p1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),g1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new h1(e,r,n),this.decoder=new d1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Eu=({name:t,prefix:e,encode:r,decode:n})=>new g1(t,e,r,n),Li=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=iN(r,e);return Eu({prefix:t,name:e,encode:n,decode:s=>kn(i(s))})},Uj=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},qj=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Eu({prefix:e,name:t,encode(i){return qj(i,n,r)},decode(i){return Uj(i,n,r,t)}})});var y1={};at(y1,{identity:()=>Vj});var Vj,fN=ge(()=>{c();Ur();Ri();Vj=Eu({prefix:"\0",name:"identity",encode:t=>uN(t),decode:t=>aN(t)})});var m1={};at(m1,{base2:()=>Hj});var Hj,hN=ge(()=>{c();Ur();Hj=ct({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var w1={};at(w1,{base8:()=>jj});var jj,dN=ge(()=>{c();Ur();jj=ct({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var E1={};at(E1,{base10:()=>Gj});var Gj,pN=ge(()=>{c();Ur();Gj=Li({prefix:"9",name:"base10",alphabet:"0123456789"})});var v1={};at(v1,{base16:()=>Qj,base16upper:()=>kj});var Qj,kj,gN=ge(()=>{c();Ur();Qj=ct({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),kj=ct({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var A1={};at(A1,{base32:()=>vu,base32hex:()=>$j,base32hexpad:()=>Jj,base32hexpadupper:()=>Xj,base32hexupper:()=>Yj,base32pad:()=>zj,base32padupper:()=>Wj,base32upper:()=>Kj,base32z:()=>Zj});var vu,Kj,zj,Wj,$j,Yj,Jj,Xj,Zj,_1=ge(()=>{c();Ur();vu=ct({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kj=ct({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zj=ct({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wj=ct({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$j=ct({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yj=ct({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Jj=ct({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xj=ct({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Zj=ct({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var b1={};at(b1,{base36:()=>e7,base36upper:()=>t7});var e7,t7,yN=ge(()=>{c();Ur();e7=Li({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),t7=Li({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var I1={};at(I1,{base58btc:()=>wn,base58flickr:()=>r7});var wn,r7,S1=ge(()=>{c();Ur();wn=Li({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),r7=Li({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var C1={};at(C1,{base64:()=>n7,base64pad:()=>i7,base64url:()=>s7,base64urlpad:()=>o7});var n7,i7,s7,o7,mN=ge(()=>{c();Ur();n7=ct({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),i7=ct({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),s7=ct({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),o7=ct({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var T1={};at(T1,{base256emoji:()=>f7});function c7(t){return t.reduce((e,r)=>(e+=a7[r],e),"")}function l7(t){let e=[];for(let r of t){let n=u7[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var wN,a7,u7,f7,EN=ge(()=>{c();Ur();wN=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),a7=wN.reduce((t,e,r)=>(t[r]=e,t),[]),u7=wN.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);f7=Eu({prefix:"\u{1F680}",name:"base256emoji",encode:c7,decode:l7})});function _N(t,e,r){e=e||[],r=r||0;for(var n=r;t>=g7;)e[r++]=t&255|vN,t/=128;for(;t&p7;)e[r++]=t&255|vN,t>>>=7;return e[r]=t|0,_N.bytes=r-n+1,e}function x1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw x1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&AN)<=m7);return x1.bytes=s-n,r}var h7,vN,d7,p7,g7,y7,m7,AN,w7,E7,v7,A7,_7,b7,I7,S7,C7,T7,x7,N7,sl,bN=ge(()=>{c();h7=_N,vN=128,d7=127,p7=~d7,g7=Math.pow(2,31);y7=x1,m7=128,AN=127;w7=Math.pow(2,7),E7=Math.pow(2,14),v7=Math.pow(2,21),A7=Math.pow(2,28),_7=Math.pow(2,35),b7=Math.pow(2,42),I7=Math.pow(2,49),S7=Math.pow(2,56),C7=Math.pow(2,63),T7=function(t){return t{c();bN();ol=(t,e=0)=>[sl.decode(t,e),sl.decode.bytes],Au=(t,e,r=0)=>(sl.encode(t,e,r),e),_u=t=>sl.encodingLength(t)});var ao,IN,SN,bu,ul=ge(()=>{c();Ri();kd();ao=(t,e)=>{let r=e.byteLength,n=_u(t),i=n+_u(r),s=new Uint8Array(i+r);return Au(t,s,0),Au(r,s,n),s.set(e,i),new bu(t,r,e,s)},IN=t=>{let e=kn(t),[r,n]=ol(e),[i,s]=ol(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new bu(r,i,o,e)},SN=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&oN(t.bytes,e.bytes),bu=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var D1,N1,O1=ge(()=>{c();ul();D1=({name:t,code:e,encode:r})=>new N1(t,e,r),N1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ao(this.code,r):r.then(n=>ao(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var P1={};at(P1,{sha256:()=>D7,sha512:()=>O7});var TN,D7,O7,xN=ge(()=>{c();O1();TN=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),D7=D1({name:"sha2-256",code:18,encode:TN("SHA-256")}),O7=D1({name:"sha2-512",code:19,encode:TN("SHA-512")})});var B1={};at(B1,{identity:()=>R7});var NN,P7,DN,B7,R7,ON=ge(()=>{c();Ri();ul();NN=0,P7="identity",DN=kn,B7=t=>ao(NN,DN(t)),R7={code:NN,name:P7,encode:DN,digest:B7}});var PN=ge(()=>{c();Ri()});var poe,goe,BN=ge(()=>{c();poe=new TextEncoder,goe=new TextDecoder});var bt,M7,U7,q7,cl,V7,RN,LN,Kd,zd,H7,j7,G7,FN=ge(()=>{c();kd();ul();S1();_1();Ri();bt=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:zd,byteLength:zd,code:Kd,version:Kd,multihash:Kd,bytes:Kd,_baseCache:zd,asCID:zd})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==cl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==V7)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return bt.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ao(e,r);return bt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&SN(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return U7(r,i,e||wn.encoder);default:return q7(r,i,e||vu.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return j7(/^0\.0/,G7),!!(e&&(e[LN]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof bt)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new bt(r,n,i,s||RN(r,n,i.bytes))}else if(e!=null&&e[LN]===!0){let{version:r,multihash:n,code:i}=e,s=IN(n);return bt.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==cl)throw new Error(`Version 0 CID must use dag-pb (code: ${cl}) block encoding`);return new bt(e,r,n,n.bytes)}case 1:{let i=RN(e,r,n.bytes);return new bt(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return bt.create(0,cl,e)}static createV1(e,r){return bt.create(1,e,r)}static decode(e){let[r,n]=bt.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=bt.inspectBytes(e),n=r.size-r.multihashSize,i=kn(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new bu(r.multihashCode,r.digestSize,s,i);return[r.version===0?bt.createV0(o):bt.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,y]=ol(e.subarray(r));return r+=y,d},i=n(),s=cl;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=M7(e,r),s=bt.decode(i);return s._baseCache.set(n,e),s}},M7=(t,e)=>{switch(t[0]){case"Q":{let r=e||wn;return[wn.prefix,r.decode(`${wn.prefix}${t}`)]}case wn.prefix:{let r=e||wn;return[wn.prefix,r.decode(t)]}case vu.prefix:{let r=e||vu;return[vu.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},U7=(t,e,r)=>{let{prefix:n}=r;if(n!==wn.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},q7=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},cl=112,V7=18,RN=(t,e,r)=>{let n=_u(t),i=n+_u(e),s=new Uint8Array(i+r.byteLength);return Au(t,s,0),Au(e,s,n),s.set(r,i),s},LN=Symbol.for("@ipld/js-cid/CID"),Kd={writable:!1,configurable:!1,enumerable:!0},zd={writable:!1,enumerable:!1,configurable:!1},H7="0.0.0-dev",j7=(t,e)=>{if(t.test(H7))console.warn(e);else throw new Error(e)},G7=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -21,26 +17,26 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var qN=ge(()=>{c();UN();zd();Ri();B1();ul()});var F1,Doe,VN=ge(()=>{c();dN();pN();gN();yN();mN();I1();wN();T1();EN();AN();DN();BN();RN();LN();qN();F1={...w1,...E1,...v1,...A1,..._1,...b1,...S1,...C1,...x1,...N1},Doe={...R1,...L1}});function HN(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var jN,M1,W7,Yd,U1=ge(()=>{c();VN();Qd();jN=HN("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),M1=HN("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=wu(t.length);for(let r=0;r{c();U1()});function En(t,e="utf8"){let r=Yd[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Bi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var V1=ge(()=>{c();U1();il()});function ll(t){return Xc(Kn(En(t,yu),Md))}function fl(t){return Kn(En(Zc(t),Md),yu)}function j1(t){let e=En(Hd,mu),r=jd+Kn(kd([e,t]),mu);return[qd,Vd,r].join(Ud)}function H1(t){let[e,r,n]=t.split(Ud);if(e!==qd||r!==Vd)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==jd)throw new Error("Issuer must be a key in mulicodec format");let s=En(n.slice(1),mu);if(Kn(s.slice(0,2),mu)!==Hd)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function GN(t){return Kn(t,yu)}function QN(t){return En(t,yu)}function G1(t){return En([fl(t.header),fl(t.payload)].join(so),nl)}function $7(t){let e=Kn(t,nl).split(so),r=ll(e[0]),n=ll(e[1]);return{header:r,payload:n}}function Q1(t){return[fl(t.header),fl(t.payload),GN(t.signature)].join(so)}function k1(t){let e=t.split(so),r=ll(e[0]),n=ll(e[1]),i=QN(e[2]),s=En(e.slice(0,2).join(so),nl);return{header:r,payload:n,signature:i,data:s}}var K1=ge(()=>{c();d1();q1();V1();Nd();Gd()});function Y7(t=(0,kN.randomBytes)(32)){return Iu.generateKeyPairFromSeed(t)}async function J7(t,e,r,n,i=(0,KN.fromMiliseconds)(Date.now())){let s={alg:Ld,typ:Fd},o=j1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=G1({header:s,payload:u}),f=Iu.sign(n.secretKey,l);return Q1({header:s,payload:u,signature:f})}async function X7(t){let{header:e,payload:r,data:n,signature:i}=k1(t);if(e.alg!==Ld||e.typ!==Fd)throw new Error("JWT must use EdDSA algorithm");let s=H1(r.iss);return Iu.verify(s,n,i)}var Iu,kN,KN,zN=ge(()=>{c();Iu=_e(nN()),kN=_e(el()),KN=_e(to());Gd();K1()});var WN=ge(()=>{c()});var $N={};ot($N,{DATA_ENCODING:()=>nl,DID_DELIMITER:()=>Ud,DID_METHOD:()=>Vd,DID_PREFIX:()=>qd,JSON_ENCODING:()=>Md,JWT_DELIMITER:()=>so,JWT_ENCODING:()=>yu,JWT_IRIDIUM_ALG:()=>Ld,JWT_IRIDIUM_TYP:()=>Fd,KEY_PAIR_SEED_LENGTH:()=>sN,MULTICODEC_ED25519_BASE:()=>jd,MULTICODEC_ED25519_ENCODING:()=>mu,MULTICODEC_ED25519_HEADER:()=>Hd,MULTICODEC_ED25519_LENGTH:()=>iN,decodeData:()=>$7,decodeIss:()=>H1,decodeJSON:()=>ll,decodeJWT:()=>k1,decodeSig:()=>QN,encodeData:()=>G1,encodeIss:()=>j1,encodeJSON:()=>fl,encodeJWT:()=>Q1,encodeSig:()=>GN,generateKeyPair:()=>Y7,signJWT:()=>J7,verifyJWT:()=>X7});var YN=ge(()=>{c();zN();Gd();WN();K1()});var XN=v(Jd=>{"use strict";c();Object.defineProperty(Jd,"__esModule",{value:!0});var kt=hu(),z1=Cr(),Z7=20;function eG(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],M=e[11]<<24|e[10]<<16|e[9]<<8|e[8],x=e[15]<<24|e[14]<<16|e[13]<<8|e[12],b=n,T=i,P=s,B=o,_=a,S=u,F=l,Z=f,K=d,H=y,G=w,$=E,pe=N,ae=R,re=M,Y=x,ie=0;ie>>32-16|pe<<16,K=K+pe|0,_^=K,_=_>>>32-12|_<<12,T=T+S|0,ae^=T,ae=ae>>>32-16|ae<<16,H=H+ae|0,S^=H,S=S>>>32-12|S<<12,P=P+F|0,re^=P,re=re>>>32-16|re<<16,G=G+re|0,F^=G,F=F>>>32-12|F<<12,B=B+Z|0,Y^=B,Y=Y>>>32-16|Y<<16,$=$+Y|0,Z^=$,Z=Z>>>32-12|Z<<12,P=P+F|0,re^=P,re=re>>>32-8|re<<8,G=G+re|0,F^=G,F=F>>>32-7|F<<7,B=B+Z|0,Y^=B,Y=Y>>>32-8|Y<<8,$=$+Y|0,Z^=$,Z=Z>>>32-7|Z<<7,T=T+S|0,ae^=T,ae=ae>>>32-8|ae<<8,H=H+ae|0,S^=H,S=S>>>32-7|S<<7,b=b+_|0,pe^=b,pe=pe>>>32-8|pe<<8,K=K+pe|0,_^=K,_=_>>>32-7|_<<7,b=b+S|0,Y^=b,Y=Y>>>32-16|Y<<16,G=G+Y|0,S^=G,S=S>>>32-12|S<<12,T=T+F|0,pe^=T,pe=pe>>>32-16|pe<<16,$=$+pe|0,F^=$,F=F>>>32-12|F<<12,P=P+Z|0,ae^=P,ae=ae>>>32-16|ae<<16,K=K+ae|0,Z^=K,Z=Z>>>32-12|Z<<12,B=B+_|0,re^=B,re=re>>>32-16|re<<16,H=H+re|0,_^=H,_=_>>>32-12|_<<12,P=P+Z|0,ae^=P,ae=ae>>>32-8|ae<<8,K=K+ae|0,Z^=K,Z=Z>>>32-7|Z<<7,B=B+_|0,re^=B,re=re>>>32-8|re<<8,H=H+re|0,_^=H,_=_>>>32-7|_<<7,T=T+F|0,pe^=T,pe=pe>>>32-8|pe<<8,$=$+pe|0,F^=$,F=F>>>32-7|F<<7,b=b+S|0,Y^=b,Y=Y>>>32-8|Y<<8,G=G+Y|0,S^=G,S=S>>>32-7|S<<7;kt.writeUint32LE(b+n|0,t,0),kt.writeUint32LE(T+i|0,t,4),kt.writeUint32LE(P+s|0,t,8),kt.writeUint32LE(B+o|0,t,12),kt.writeUint32LE(_+a|0,t,16),kt.writeUint32LE(S+u|0,t,20),kt.writeUint32LE(F+l|0,t,24),kt.writeUint32LE(Z+f|0,t,28),kt.writeUint32LE(K+d|0,t,32),kt.writeUint32LE(H+y|0,t,36),kt.writeUint32LE(G+w|0,t,40),kt.writeUint32LE($+E|0,t,44),kt.writeUint32LE(pe+N|0,t,48),kt.writeUint32LE(ae+R|0,t,52),kt.writeUint32LE(re+M|0,t,56),kt.writeUint32LE(Y+x|0,t,60)}function JN(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var Xd=v(Su=>{"use strict";c();Object.defineProperty(Su,"__esModule",{value:!0});function nG(t,e,r){return~(t-1)&e|t-1&r}Su.select=nG;function iG(t,e){return(t|0)-(e|0)-1>>>31&1}Su.lessOrEqual=iG;function ZN(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Su.compare=ZN;function sG(t,e){return t.length===0||e.length===0?!1:ZN(t,e)!==0}Su.equal=sG});var tD=v(zn=>{"use strict";c();Object.defineProperty(zn,"__esModule",{value:!0});var oG=Xd(),Zd=Cr();zn.DIGEST_LENGTH=16;var eD=function(){function t(e){this.digestLength=zn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],y=this._h[7],w=this._h[8],E=this._h[9],N=this._r[0],R=this._r[1],M=this._r[2],x=this._r[3],b=this._r[4],T=this._r[5],P=this._r[6],B=this._r[7],_=this._r[8],S=this._r[9];n>=16;){var F=e[r+0]|e[r+1]<<8;s+=F&8191;var Z=e[r+2]|e[r+3]<<8;o+=(F>>>13|Z<<3)&8191;var K=e[r+4]|e[r+5]<<8;a+=(Z>>>10|K<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(K>>>7|H<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(H>>>4|G<<12)&8191,f+=G>>>1&8191;var $=e[r+10]|e[r+11]<<8;d+=(G>>>14|$<<2)&8191;var pe=e[r+12]|e[r+13]<<8;y+=($>>>11|pe<<5)&8191;var ae=e[r+14]|e[r+15]<<8;w+=(pe>>>8|ae<<8)&8191,E+=ae>>>5|i;var re=0,Y=re;Y+=s*N,Y+=o*(5*S),Y+=a*(5*_),Y+=u*(5*B),Y+=l*(5*P),re=Y>>>13,Y&=8191,Y+=f*(5*T),Y+=d*(5*b),Y+=y*(5*x),Y+=w*(5*M),Y+=E*(5*R),re+=Y>>>13,Y&=8191;var ie=re;ie+=s*R,ie+=o*N,ie+=a*(5*S),ie+=u*(5*_),ie+=l*(5*B),re=ie>>>13,ie&=8191,ie+=f*(5*P),ie+=d*(5*T),ie+=y*(5*b),ie+=w*(5*x),ie+=E*(5*M),re+=ie>>>13,ie&=8191;var te=re;te+=s*M,te+=o*R,te+=a*N,te+=u*(5*S),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*B),te+=d*(5*P),te+=y*(5*T),te+=w*(5*b),te+=E*(5*x),re+=te>>>13,te&=8191;var ne=re;ne+=s*x,ne+=o*M,ne+=a*R,ne+=u*N,ne+=l*(5*S),re=ne>>>13,ne&=8191,ne+=f*(5*_),ne+=d*(5*B),ne+=y*(5*P),ne+=w*(5*T),ne+=E*(5*b),re+=ne>>>13,ne&=8191;var q=re;q+=s*b,q+=o*x,q+=a*M,q+=u*R,q+=l*N,re=q>>>13,q&=8191,q+=f*(5*S),q+=d*(5*_),q+=y*(5*B),q+=w*(5*P),q+=E*(5*T),re+=q>>>13,q&=8191;var ce=re;ce+=s*T,ce+=o*b,ce+=a*x,ce+=u*M,ce+=l*R,re=ce>>>13,ce&=8191,ce+=f*N,ce+=d*(5*S),ce+=y*(5*_),ce+=w*(5*B),ce+=E*(5*P),re+=ce>>>13,ce&=8191;var oe=re;oe+=s*P,oe+=o*T,oe+=a*b,oe+=u*x,oe+=l*M,re=oe>>>13,oe&=8191,oe+=f*R,oe+=d*N,oe+=y*(5*S),oe+=w*(5*_),oe+=E*(5*B),re+=oe>>>13,oe&=8191;var le=re;le+=s*B,le+=o*P,le+=a*T,le+=u*b,le+=l*x,re=le>>>13,le&=8191,le+=f*M,le+=d*R,le+=y*N,le+=w*(5*S),le+=E*(5*_),re+=le>>>13,le&=8191;var se=re;se+=s*_,se+=o*B,se+=a*P,se+=u*T,se+=l*b,re=se>>>13,se&=8191,se+=f*x,se+=d*M,se+=y*R,se+=w*N,se+=E*(5*S),re+=se>>>13,se&=8191;var ue=re;ue+=s*S,ue+=o*_,ue+=a*B,ue+=u*P,ue+=l*T,re=ue>>>13,ue&=8191,ue+=f*b,ue+=d*x,ue+=y*M,ue+=w*R,ue+=E*N,re+=ue>>>13,ue&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,ie+=re,s=Y,o=ie,a=te,u=ne,l=q,f=ce,d=oe,y=le,w=se,E=ue,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=y,this._h[8]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=1<<13,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Wn,"__esModule",{value:!0});var ep=XN(),cG=tD(),hl=Cr(),rD=hu(),lG=Xd();Wn.KEY_LENGTH=32;Wn.NONCE_LENGTH=12;Wn.TAG_LENGTH=16;var nD=new Uint8Array(16),fG=function(){function t(e){if(this.nonceLength=Wn.NONCE_LENGTH,this.tagLength=Wn.TAG_LENGTH,e.length!==Wn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);ep.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return ep.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),hl.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(nD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(nD.subarray(n.length%16));var o=new Uint8Array(8);i&&rD.writeUint64LE(i.length,o),s.update(o),rD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(W1,"__esModule",{value:!0});function hG(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}W1.isSerializableHash=hG});var aD=v(dl=>{"use strict";c();Object.defineProperty(dl,"__esModule",{value:!0});var vn=sD(),dG=Xd(),pG=Cr(),oD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty($1,"__esModule",{value:!0});var uD=aD(),cD=Cr(),yG=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=uD.hmac(this._hash,n,r);this._hmac=new uD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});var rp=hu(),tp=Cr();Fi.DIGEST_LENGTH=32;Fi.BLOCK_SIZE=64;var fD=function(){function t(){this.digestLength=Fi.DIGEST_LENGTH,this.blockSize=Fi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){tp.wipe(this._buffer),tp.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(Y1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=Y1(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){tp.wipe(e.state),e.buffer&&tp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Fi.SHA256=fD;var mG=new Int32Array([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]);function Y1(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],y=e[7],w=0;w<16;w++){var E=n+w*4;t[w]=rp.readUint32BE(r,E)}for(var w=16;w<64;w++){var N=t[w-2],R=(N>>>17|N<<32-17)^(N>>>19|N<<32-19)^N>>>10;N=t[w-15];var M=(N>>>7|N<<32-7)^(N>>>18|N<<32-18)^N>>>3;t[w]=(R+t[w-7]|0)+(M+t[w-16]|0)}for(var w=0;w<64;w++){var R=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(y+(mG[w]+t[w]|0)|0)|0,M=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;y=d,d=f,f=l,l=u+R|0,u=a,a=o,o=s,s=R+M|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=y,n+=64,i-=64}return n}function wG(t){var e=new fD;e.update(t);var r=e.digest();return e.clean(),r}Fi.hash=wG});var yD=v(ct=>{"use strict";c();Object.defineProperty(ct,"__esModule",{value:!0});ct.sharedKey=ct.generateKeyPair=ct.generateKeyPairFromSeed=ct.scalarMultBase=ct.scalarMult=ct.SHARED_KEY_LENGTH=ct.SECRET_KEY_LENGTH=ct.PUBLIC_KEY_LENGTH=void 0;var EG=el(),vG=Cr();ct.PUBLIC_KEY_LENGTH=32;ct.SECRET_KEY_LENGTH=32;ct.SHARED_KEY_LENGTH=32;function An(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,pl(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function bG(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function np(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ip(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $n(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,N=0,R=0,M=0,x=0,b=0,T=0,P=0,B=0,_=0,S=0,F=0,Z=0,K=0,H=0,G=0,$=0,pe=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],O=r[11],I=r[12],D=r[13],L=r[14],C=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,N+=n*A,R+=n*O,M+=n*I,x+=n*D,b+=n*L,T+=n*C,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,N+=n*m,R+=n*A,M+=n*O,x+=n*I,b+=n*D,T+=n*L,P+=n*C,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,N+=n*g,R+=n*m,M+=n*A,x+=n*O,b+=n*I,T+=n*D,P+=n*L,B+=n*C,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,N+=n*ue,R+=n*g,M+=n*m,x+=n*A,b+=n*O,T+=n*I,P+=n*D,B+=n*L,_+=n*C,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,N+=n*se,R+=n*ue,M+=n*g,x+=n*m,b+=n*A,T+=n*O,P+=n*I,B+=n*D,_+=n*L,S+=n*C,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,N+=n*le,R+=n*se,M+=n*ue,x+=n*g,b+=n*m,T+=n*A,P+=n*O,B+=n*I,_+=n*D,S+=n*L,F+=n*C,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,N+=n*oe,R+=n*le,M+=n*se,x+=n*ue,b+=n*g,T+=n*m,P+=n*A,B+=n*O,_+=n*I,S+=n*D,F+=n*L,Z+=n*C,n=e[7],y+=n*te,w+=n*ne,E+=n*q,N+=n*ce,R+=n*oe,M+=n*le,x+=n*se,b+=n*ue,T+=n*g,P+=n*m,B+=n*A,_+=n*O,S+=n*I,F+=n*D,Z+=n*L,K+=n*C,n=e[8],w+=n*te,E+=n*ne,N+=n*q,R+=n*ce,M+=n*oe,x+=n*le,b+=n*se,T+=n*ue,P+=n*g,B+=n*m,_+=n*A,S+=n*O,F+=n*I,Z+=n*D,K+=n*L,H+=n*C,n=e[9],E+=n*te,N+=n*ne,R+=n*q,M+=n*ce,x+=n*oe,b+=n*le,T+=n*se,P+=n*ue,B+=n*g,_+=n*m,S+=n*A,F+=n*O,Z+=n*I,K+=n*D,H+=n*L,G+=n*C,n=e[10],N+=n*te,R+=n*ne,M+=n*q,x+=n*ce,b+=n*oe,T+=n*le,P+=n*se,B+=n*ue,_+=n*g,S+=n*m,F+=n*A,Z+=n*O,K+=n*I,H+=n*D,G+=n*L,$+=n*C,n=e[11],R+=n*te,M+=n*ne,x+=n*q,b+=n*ce,T+=n*oe,P+=n*le,B+=n*se,_+=n*ue,S+=n*g,F+=n*m,Z+=n*A,K+=n*O,H+=n*I,G+=n*D,$+=n*L,pe+=n*C,n=e[12],M+=n*te,x+=n*ne,b+=n*q,T+=n*ce,P+=n*oe,B+=n*le,_+=n*se,S+=n*ue,F+=n*g,Z+=n*m,K+=n*A,H+=n*O,G+=n*I,$+=n*D,pe+=n*L,ae+=n*C,n=e[13],x+=n*te,b+=n*ne,T+=n*q,P+=n*ce,B+=n*oe,_+=n*le,S+=n*se,F+=n*ue,Z+=n*g,K+=n*m,H+=n*A,G+=n*O,$+=n*I,pe+=n*D,ae+=n*L,re+=n*C,n=e[14],b+=n*te,T+=n*ne,P+=n*q,B+=n*ce,_+=n*oe,S+=n*le,F+=n*se,Z+=n*ue,K+=n*g,H+=n*m,G+=n*A,$+=n*O,pe+=n*I,ae+=n*D,re+=n*L,Y+=n*C,n=e[15],T+=n*te,P+=n*ne,B+=n*q,_+=n*ce,S+=n*oe,F+=n*le,Z+=n*se,K+=n*ue,H+=n*g,G+=n*m,$+=n*A,pe+=n*O,ae+=n*I,re+=n*D,Y+=n*L,ie+=n*C,s+=38*P,o+=38*B,a+=38*_,u+=38*S,l+=38*F,f+=38*Z,d+=38*K,y+=38*H,w+=38*G,E+=38*$,N+=38*pe,R+=38*ae,M+=38*re,x+=38*Y,b+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=N,t[11]=R,t[12]=M,t[13]=x,t[14]=b,t[15]=T}function gl(t,e){$n(t,e,e)}function IG(t,e){let r=An();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)gl(r,r),n!==2&&n!==4&&$n(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function X1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=An(),s=An(),o=An(),a=An(),u=An(),l=An();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,bG(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;pl(i,s,E),pl(o,a,E),np(u,i,o),ip(i,i,o),np(o,s,a),ip(s,s,a),gl(a,u),gl(l,i),$n(i,o,i),$n(o,s,u),np(u,i,o),ip(i,i,o),gl(s,i),ip(o,a,l),$n(i,o,AG),np(i,i,a),$n(o,o,i),$n(i,a,l),$n(a,s,n),gl(s,u),pl(i,s,E),pl(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);IG(f,f),$n(d,d,f);let y=new Uint8Array(32);return _G(y,d),y}ct.scalarMult=X1;function pD(t){return X1(t,dD)}ct.scalarMultBase=pD;function gD(t){if(t.length!==ct.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${ct.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:pD(e),secretKey:e}}ct.generateKeyPairFromSeed=gD;function SG(t){let e=(0,EG.randomBytes)(32,t),r=gD(e);return(0,vG.wipe)(e),r}ct.generateKeyPair=SG;function CG(t,e,r=!1){if(t.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=X1(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function ED(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function AD(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=wu(t.length);for(let n=0;n{c();Qd();il()});var Z1={};ot(Z1,{compare:()=>mD,concat:()=>kd,equals:()=>ED,fromString:()=>En,toString:()=>Kn,xor:()=>AD});var ev=ge(()=>{c();wD();d1();vD();V1();q1();_D()});var RD=v(Ze=>{"use strict";c();var bD=Ze&&Ze.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new DD:typeof navigator<"u"?tv(navigator.userAgent):BD()}Ze.detect=DG;function OD(t){return t!==""&&NG.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function OG(t){var e=OD(t);return e?e[0]:null}Ze.browserName=OG;function tv(t){var e=OD(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new ND;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.getLocalStorage=ze.getLocalStorageOrThrow=ze.getCrypto=ze.getCryptoOrThrow=ze.getLocation=ze.getLocationOrThrow=ze.getNavigator=ze.getNavigatorOrThrow=ze.getDocument=ze.getDocumentOrThrow=ze.getFromWindowOrThrow=ze.getFromWindow=void 0;function ao(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ze.getFromWindow=ao;function Cu(t){let e=ao(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ze.getFromWindowOrThrow=Cu;function BG(){return Cu("document")}ze.getDocumentOrThrow=BG;function RG(){return ao("document")}ze.getDocument=RG;function LG(){return Cu("navigator")}ze.getNavigatorOrThrow=LG;function FG(){return ao("navigator")}ze.getNavigator=FG;function MG(){return Cu("location")}ze.getLocationOrThrow=MG;function UG(){return ao("location")}ze.getLocation=UG;function qG(){return Cu("crypto")}ze.getCryptoOrThrow=qG;function VG(){return ao("crypto")}ze.getCrypto=VG;function jG(){return Cu("localStorage")}ze.getLocalStorageOrThrow=jG;function HG(){return ao("localStorage")}ze.getLocalStorage=HG});var FD=v(sp=>{"use strict";c();Object.defineProperty(sp,"__esModule",{value:!0});sp.getWindowMetadata=void 0;var LD=rv();function GG(){let t,e;try{t=LD.getDocumentOrThrow(),e=LD.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),y=[];for(let w=0;w-1){let R=E.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let M=e.protocol+"//"+e.host;if(R.indexOf("/")===0)M+=R;else{let x=e.pathname.split("/");x.pop();let b=x.join("/");M+=b+"/"+R}y.push(M)}else if(R.indexOf("//")===0){let M=e.protocol+R;y.push(M)}else y.push(R)}}return y}function n(...d){let y=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(R)).filter(R=>R?d.includes(R):!1);if(N.length&&N){let R=E.getAttribute("content");if(R)return R}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}sp.getWindowMetadata=GG});var UD=v((Kae,MD)=>{"use strict";c();MD.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var GD=v((Wae,HD)=>{"use strict";c();var jD="%[a-f0-9]{2}",qD=new RegExp("("+jD+")|([^%]+?)","gi"),VD=new RegExp("("+jD+")+","gi");function nv(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],nv(r),nv(n))}function QG(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(qD)||[],r=1;r{"use strict";c();QD.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var zD=v((Xae,KD)=>{"use strict";c();KD.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var KG=UD(),zG=GD(),$D=kD(),WG=zD(),$G=t=>t==null,iv=Symbol("encodeFragmentIdentifier");function YG(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[",i,"]"].join("")]:[...r,[pt(e,t),"[",pt(i,t),"]=",pt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[]"].join("")]:[...r,[pt(e,t),"[]=",pt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),":list="].join("")]:[...r,[pt(e,t),":list=",pt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[pt(r,t),e,pt(i,t)].join("")]:[[n,pt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,pt(e,t)]:[...r,[pt(e,t),"=",pt(n,t)].join("")]}}function JG(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&Yn(n,t).includes(t.arrayFormatSeparator);n=o?Yn(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>Yn(u,t)):n===null?n:Yn(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Yn(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>Yn(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function YD(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function pt(t,e){return e.encode?e.strict?KG(t):encodeURIComponent(t):t}function Yn(t,e){return e.decode?zG(t):t}function JD(t){return Array.isArray(t)?t.sort():typeof t=="object"?JD(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function XD(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function XG(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function ZD(t){t=XD(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function WD(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function eO(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),YD(e.arrayFormatSeparator);let r=JG(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=$D(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Yn(o,e),r(Yn(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=WD(s[o],e);else n[i]=WD(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=JD(o):i[s]=o,i},Object.create(null))}ir.extract=ZD;ir.parse=eO;ir.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),YD(e.arrayFormatSeparator);let r=o=>e.skipNull&&$G(t[o])||e.skipEmptyString&&t[o]==="",n=YG(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?pt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?pt(o,e)+"[]":a.reduce(n(o),[]).join("&"):pt(o,e)+"="+pt(a,e)}).filter(o=>o.length>0).join("&")};ir.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=$D(t,"#");return Object.assign({url:r.split("?")[0]||"",query:eO(ZD(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Yn(n,e)}:{})};ir.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[iv]:!0},e);let r=XD(t.url).split("?")[0]||"",n=ir.extract(t.url),i=ir.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=ir.stringify(s,e);o&&(o=`?${o}`);let a=XG(t.url);return t.fragmentIdentifier&&(a=`#${e[iv]?pt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};ir.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[iv]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=ir.parseUrl(t,r);return ir.stringifyUrl({url:n,query:WG(i,e),fragmentIdentifier:s},r)};ir.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return ir.pick(t,n,r)}});var rO=ge(()=>{c()});function Mi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function ZG(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function e9(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function t9(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function yl(t,e,r){return(!r.length?e9(t,e.length):t9(t,e.length))?ZG(t,e):!1}function ml(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var sv=ge(()=>{c()});function r9(t){return op(t.method)&&ap(t.params)}function op(t){return ml(t,"subscribe")}function ap(t){return yl(t,["topic"],[])}function n9(t){return up(t.method)&&cp(t.params)}function up(t){return ml(t,"publish")}function cp(t){return yl(t,["message","topic","ttl"],["prompt","tag"])}function i9(t){return lp(t.method)&&fp(t.params)}function lp(t){return ml(t,"unsubscribe")}function fp(t){return yl(t,["id","topic"],[])}function s9(t){return hp(t.method)&&dp(t.params)}function hp(t){return ml(t,"subscription")}function dp(t){return yl(t,["id","data"],[])}var ov=ge(()=>{c();sv()});function o9(t){if(!op(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!ap(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Mi(e,"topic"),e}function a9(t){if(!up(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!cp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Mi(e,"topic"),Mi(e,"message"),Mi(e,"ttl","number"),e}function u9(t){if(!lp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!fp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Mi(e,"id"),e}function c9(t){if(!hp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!dp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Mi(e,"id"),Mi(e,"data"),e}var nO=ge(()=>{c();sv();ov()});var l9,iO=ge(()=>{c();l9={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var sO={};ot(sO,{RELAY_JSONRPC:()=>l9,isPublishMethod:()=>up,isPublishParams:()=>cp,isPublishRequest:()=>n9,isSubscribeMethod:()=>op,isSubscribeParams:()=>ap,isSubscribeRequest:()=>r9,isSubscriptionMethod:()=>hp,isSubscriptionParams:()=>dp,isSubscriptionRequest:()=>s9,isUnsubscribeMethod:()=>lp,isUnsubscribeParams:()=>fp,isUnsubscribeRequest:()=>i9,parsePublishRequest:()=>a9,parseSubscribeRequest:()=>o9,parseSubscriptionRequest:()=>c9,parseUnsubscribeRequest:()=>u9});var oO=ge(()=>{c();rO();nO();iO();ov()});var Ip=v(Q=>{"use strict";c();Object.defineProperty(Q,"__esModule",{value:!0});var yO=iD(),f9=lD(),mO=el(),lv=hD(),h9=yD(),et=(ev(),rt(Z1)),d9=RD(),xu=to(),wl=rv(),p9=FD(),g9=tO(),y9=(oO(),rt(sO));function wO(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var EO=wO(h9),pp=wO(g9),mp=":";function vO(t){let[e,r]=t.split(mp);return{namespace:e,reference:r}}function AO(t){let{namespace:e,reference:r}=t;return[e,r].join(mp)}function fv(t){let[e,r,n]=t.split(mp);return{namespace:e,reference:r,address:n}}function _O(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(mp)}function hv(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function bO(t){let{address:e}=fv(t);return e}function IO(t){let{namespace:e,reference:r}=fv(t);return AO({namespace:e,reference:r})}function m9(t,e){let{namespace:r,reference:n}=vO(e);return _O({namespace:r,reference:n,address:t})}function w9(t){return hv(t,bO)}function SO(t){return hv(t,IO)}function E9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function v9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...SO(i.accounts))}),r}function A9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...wp(n,i))}),r}function wp(t,e){return t.includes(":")?[t]:e.chains||[]}var Ep=t=>t?.split(":"),CO=t=>{let e=t&&Ep(t);if(e)return e[3]},_9=t=>{let e=t&&Ep(t);if(e)return e[2]+":"+e[3]},TO=t=>{let e=t&&Ep(t);if(e)return e.pop()},b9=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=TO(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${CO(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var MN=ge(()=>{c();FN();kd();Ri();O1();ul()});var R1,Coe,UN=ge(()=>{c();fN();hN();dN();pN();gN();_1();yN();S1();mN();EN();xN();ON();PN();BN();MN();R1={...y1,...m1,...w1,...E1,...v1,...A1,...b1,...I1,...C1,...T1},Coe={...P1,...B1}});function VN(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var qN,L1,Q7,Wd,F1=ge(()=>{c();UN();jd();qN=VN("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),L1=VN("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=wu(t.length);for(let r=0;r{c();F1()});function En(t,e="utf8"){let r=Wd[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Bi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var U1=ge(()=>{c();F1();il()});function ll(t){return Xc(Kn(En(t,yu),Ld))}function fl(t){return Kn(En(Zc(t),Ld),yu)}function q1(t){let e=En(Vd,mu),r=qd+Kn(Gd([e,t]),mu);return[Md,Ud,r].join(Fd)}function V1(t){let[e,r,n]=t.split(Fd);if(e!==Md||r!==Ud)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==qd)throw new Error("Issuer must be a key in mulicodec format");let s=En(n.slice(1),mu);if(Kn(s.slice(0,2),mu)!==Vd)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function HN(t){return Kn(t,yu)}function jN(t){return En(t,yu)}function H1(t){return En([fl(t.header),fl(t.payload)].join(oo),nl)}function k7(t){let e=Kn(t,nl).split(oo),r=ll(e[0]),n=ll(e[1]);return{header:r,payload:n}}function j1(t){return[fl(t.header),fl(t.payload),HN(t.signature)].join(oo)}function G1(t){let e=t.split(oo),r=ll(e[0]),n=ll(e[1]),i=jN(e[2]),s=En(e.slice(0,2).join(oo),nl);return{header:r,payload:n,signature:i,data:s}}var Q1=ge(()=>{c();f1();M1();U1();Td();Hd()});function K7(t=(0,GN.randomBytes)(32)){return Iu.generateKeyPairFromSeed(t)}async function z7(t,e,r,n,i=(0,QN.fromMiliseconds)(Date.now())){let s={alg:Bd,typ:Rd},o=q1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=H1({header:s,payload:u}),f=Iu.sign(n.secretKey,l);return j1({header:s,payload:u,signature:f})}async function W7(t){let{header:e,payload:r,data:n,signature:i}=G1(t);if(e.alg!==Bd||e.typ!==Rd)throw new Error("JWT must use EdDSA algorithm");let s=V1(r.iss);return Iu.verify(s,n,i)}var Iu,GN,QN,kN=ge(()=>{c();Iu=be(tN()),GN=be(el()),QN=be(ro());Hd();Q1()});var KN=ge(()=>{c()});var zN={};at(zN,{DATA_ENCODING:()=>nl,DID_DELIMITER:()=>Fd,DID_METHOD:()=>Ud,DID_PREFIX:()=>Md,JSON_ENCODING:()=>Ld,JWT_DELIMITER:()=>oo,JWT_ENCODING:()=>yu,JWT_IRIDIUM_ALG:()=>Bd,JWT_IRIDIUM_TYP:()=>Rd,KEY_PAIR_SEED_LENGTH:()=>nN,MULTICODEC_ED25519_BASE:()=>qd,MULTICODEC_ED25519_ENCODING:()=>mu,MULTICODEC_ED25519_HEADER:()=>Vd,MULTICODEC_ED25519_LENGTH:()=>rN,decodeData:()=>k7,decodeIss:()=>V1,decodeJSON:()=>ll,decodeJWT:()=>G1,decodeSig:()=>jN,encodeData:()=>H1,encodeIss:()=>q1,encodeJSON:()=>fl,encodeJWT:()=>j1,encodeSig:()=>HN,generateKeyPair:()=>K7,signJWT:()=>z7,verifyJWT:()=>W7});var WN=ge(()=>{c();kN();Hd();KN();Q1()});var YN=v($d=>{"use strict";c();Object.defineProperty($d,"__esModule",{value:!0});var kt=hu(),k1=Cr(),$7=20;function Y7(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],_=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],x=n,O=i,P=s,L=o,b=a,C=u,M=l,Z=f,K=d,j=y,G=w,$=E,de=T,ae=R,re=_,Y=B,ie=0;ie<$7;ie+=2)x=x+b|0,de^=x,de=de>>>32-16|de<<16,K=K+de|0,b^=K,b=b>>>32-12|b<<12,O=O+C|0,ae^=O,ae=ae>>>32-16|ae<<16,j=j+ae|0,C^=j,C=C>>>32-12|C<<12,P=P+M|0,re^=P,re=re>>>32-16|re<<16,G=G+re|0,M^=G,M=M>>>32-12|M<<12,L=L+Z|0,Y^=L,Y=Y>>>32-16|Y<<16,$=$+Y|0,Z^=$,Z=Z>>>32-12|Z<<12,P=P+M|0,re^=P,re=re>>>32-8|re<<8,G=G+re|0,M^=G,M=M>>>32-7|M<<7,L=L+Z|0,Y^=L,Y=Y>>>32-8|Y<<8,$=$+Y|0,Z^=$,Z=Z>>>32-7|Z<<7,O=O+C|0,ae^=O,ae=ae>>>32-8|ae<<8,j=j+ae|0,C^=j,C=C>>>32-7|C<<7,x=x+b|0,de^=x,de=de>>>32-8|de<<8,K=K+de|0,b^=K,b=b>>>32-7|b<<7,x=x+C|0,Y^=x,Y=Y>>>32-16|Y<<16,G=G+Y|0,C^=G,C=C>>>32-12|C<<12,O=O+M|0,de^=O,de=de>>>32-16|de<<16,$=$+de|0,M^=$,M=M>>>32-12|M<<12,P=P+Z|0,ae^=P,ae=ae>>>32-16|ae<<16,K=K+ae|0,Z^=K,Z=Z>>>32-12|Z<<12,L=L+b|0,re^=L,re=re>>>32-16|re<<16,j=j+re|0,b^=j,b=b>>>32-12|b<<12,P=P+Z|0,ae^=P,ae=ae>>>32-8|ae<<8,K=K+ae|0,Z^=K,Z=Z>>>32-7|Z<<7,L=L+b|0,re^=L,re=re>>>32-8|re<<8,j=j+re|0,b^=j,b=b>>>32-7|b<<7,O=O+M|0,de^=O,de=de>>>32-8|de<<8,$=$+de|0,M^=$,M=M>>>32-7|M<<7,x=x+C|0,Y^=x,Y=Y>>>32-8|Y<<8,G=G+Y|0,C^=G,C=C>>>32-7|C<<7;kt.writeUint32LE(x+n|0,t,0),kt.writeUint32LE(O+i|0,t,4),kt.writeUint32LE(P+s|0,t,8),kt.writeUint32LE(L+o|0,t,12),kt.writeUint32LE(b+a|0,t,16),kt.writeUint32LE(C+u|0,t,20),kt.writeUint32LE(M+l|0,t,24),kt.writeUint32LE(Z+f|0,t,28),kt.writeUint32LE(K+d|0,t,32),kt.writeUint32LE(j+y|0,t,36),kt.writeUint32LE(G+w|0,t,40),kt.writeUint32LE($+E|0,t,44),kt.writeUint32LE(de+T|0,t,48),kt.writeUint32LE(ae+R|0,t,52),kt.writeUint32LE(re+_|0,t,56),kt.writeUint32LE(Y+B|0,t,60)}function $N(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var Yd=v(Su=>{"use strict";c();Object.defineProperty(Su,"__esModule",{value:!0});function Z7(t,e,r){return~(t-1)&e|t-1&r}Su.select=Z7;function eG(t,e){return(t|0)-(e|0)-1>>>31&1}Su.lessOrEqual=eG;function JN(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Su.compare=JN;function tG(t,e){return t.length===0||e.length===0?!1:JN(t,e)!==0}Su.equal=tG});var ZN=v(zn=>{"use strict";c();Object.defineProperty(zn,"__esModule",{value:!0});var rG=Yd(),Jd=Cr();zn.DIGEST_LENGTH=16;var XN=function(){function t(e){this.digestLength=zn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],y=this._h[7],w=this._h[8],E=this._h[9],T=this._r[0],R=this._r[1],_=this._r[2],B=this._r[3],x=this._r[4],O=this._r[5],P=this._r[6],L=this._r[7],b=this._r[8],C=this._r[9];n>=16;){var M=e[r+0]|e[r+1]<<8;s+=M&8191;var Z=e[r+2]|e[r+3]<<8;o+=(M>>>13|Z<<3)&8191;var K=e[r+4]|e[r+5]<<8;a+=(Z>>>10|K<<6)&8191;var j=e[r+6]|e[r+7]<<8;u+=(K>>>7|j<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(j>>>4|G<<12)&8191,f+=G>>>1&8191;var $=e[r+10]|e[r+11]<<8;d+=(G>>>14|$<<2)&8191;var de=e[r+12]|e[r+13]<<8;y+=($>>>11|de<<5)&8191;var ae=e[r+14]|e[r+15]<<8;w+=(de>>>8|ae<<8)&8191,E+=ae>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*C),Y+=a*(5*b),Y+=u*(5*L),Y+=l*(5*P),re=Y>>>13,Y&=8191,Y+=f*(5*O),Y+=d*(5*x),Y+=y*(5*B),Y+=w*(5*_),Y+=E*(5*R),re+=Y>>>13,Y&=8191;var ie=re;ie+=s*R,ie+=o*T,ie+=a*(5*C),ie+=u*(5*b),ie+=l*(5*L),re=ie>>>13,ie&=8191,ie+=f*(5*P),ie+=d*(5*O),ie+=y*(5*x),ie+=w*(5*B),ie+=E*(5*_),re+=ie>>>13,ie&=8191;var te=re;te+=s*_,te+=o*R,te+=a*T,te+=u*(5*C),te+=l*(5*b),re=te>>>13,te&=8191,te+=f*(5*L),te+=d*(5*P),te+=y*(5*O),te+=w*(5*x),te+=E*(5*B),re+=te>>>13,te&=8191;var ne=re;ne+=s*B,ne+=o*_,ne+=a*R,ne+=u*T,ne+=l*(5*C),re=ne>>>13,ne&=8191,ne+=f*(5*b),ne+=d*(5*L),ne+=y*(5*P),ne+=w*(5*O),ne+=E*(5*x),re+=ne>>>13,ne&=8191;var q=re;q+=s*x,q+=o*B,q+=a*_,q+=u*R,q+=l*T,re=q>>>13,q&=8191,q+=f*(5*C),q+=d*(5*b),q+=y*(5*L),q+=w*(5*P),q+=E*(5*O),re+=q>>>13,q&=8191;var ce=re;ce+=s*O,ce+=o*x,ce+=a*B,ce+=u*_,ce+=l*R,re=ce>>>13,ce&=8191,ce+=f*T,ce+=d*(5*C),ce+=y*(5*b),ce+=w*(5*L),ce+=E*(5*P),re+=ce>>>13,ce&=8191;var oe=re;oe+=s*P,oe+=o*O,oe+=a*x,oe+=u*B,oe+=l*_,re=oe>>>13,oe&=8191,oe+=f*R,oe+=d*T,oe+=y*(5*C),oe+=w*(5*b),oe+=E*(5*L),re+=oe>>>13,oe&=8191;var le=re;le+=s*L,le+=o*P,le+=a*O,le+=u*x,le+=l*B,re=le>>>13,le&=8191,le+=f*_,le+=d*R,le+=y*T,le+=w*(5*C),le+=E*(5*b),re+=le>>>13,le&=8191;var se=re;se+=s*b,se+=o*L,se+=a*P,se+=u*O,se+=l*x,re=se>>>13,se&=8191,se+=f*B,se+=d*_,se+=y*R,se+=w*T,se+=E*(5*C),re+=se>>>13,se&=8191;var ue=re;ue+=s*C,ue+=o*b,ue+=a*L,ue+=u*P,ue+=l*O,re=ue>>>13,ue&=8191,ue+=f*x,ue+=d*B,ue+=y*_,ue+=w*R,ue+=E*T,re+=ue>>>13,ue&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,ie+=re,s=Y,o=ie,a=te,u=ne,l=q,f=ce,d=oe,y=le,w=se,E=ue,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=y,this._h[8]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Wn,"__esModule",{value:!0});var Xd=YN(),sG=ZN(),hl=Cr(),eD=hu(),oG=Yd();Wn.KEY_LENGTH=32;Wn.NONCE_LENGTH=12;Wn.TAG_LENGTH=16;var tD=new Uint8Array(16),aG=function(){function t(e){if(this.nonceLength=Wn.NONCE_LENGTH,this.tagLength=Wn.TAG_LENGTH,e.length!==Wn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);Xd.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return Xd.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),hl.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(tD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(tD.subarray(n.length%16));var o=new Uint8Array(8);i&&eD.writeUint64LE(i.length,o),s.update(o),eD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(K1,"__esModule",{value:!0});function uG(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}K1.isSerializableHash=uG});var sD=v(dl=>{"use strict";c();Object.defineProperty(dl,"__esModule",{value:!0});var vn=nD(),cG=Yd(),lG=Cr(),iD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(z1,"__esModule",{value:!0});var oD=sD(),aD=Cr(),hG=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=oD.hmac(this._hash,n,r);this._hmac=new oD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});var ep=hu(),Zd=Cr();Fi.DIGEST_LENGTH=32;Fi.BLOCK_SIZE=64;var cD=function(){function t(){this.digestLength=Fi.DIGEST_LENGTH,this.blockSize=Fi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Zd.wipe(this._buffer),Zd.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(W1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=W1(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Zd.wipe(e.state),e.buffer&&Zd.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Fi.SHA256=cD;var dG=new Int32Array([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]);function W1(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],y=e[7],w=0;w<16;w++){var E=n+w*4;t[w]=ep.readUint32BE(r,E)}for(var w=16;w<64;w++){var T=t[w-2],R=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[w-15];var _=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[w]=(R+t[w-7]|0)+(_+t[w-16]|0)}for(var w=0;w<64;w++){var R=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(y+(dG[w]+t[w]|0)|0)|0,_=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;y=d,d=f,f=l,l=u+R|0,u=a,a=o,o=s,s=R+_|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=y,n+=64,i-=64}return n}function pG(t){var e=new cD;e.update(t);var r=e.digest();return e.clean(),r}Fi.hash=pG});var pD=v(lt=>{"use strict";c();Object.defineProperty(lt,"__esModule",{value:!0});lt.sharedKey=lt.generateKeyPair=lt.generateKeyPairFromSeed=lt.scalarMultBase=lt.scalarMult=lt.SHARED_KEY_LENGTH=lt.SECRET_KEY_LENGTH=lt.PUBLIC_KEY_LENGTH=void 0;var gG=el(),yG=Cr();lt.PUBLIC_KEY_LENGTH=32;lt.SECRET_KEY_LENGTH=32;lt.SHARED_KEY_LENGTH=32;function An(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,pl(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function EG(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function tp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function rp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $n(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,w=0,E=0,T=0,R=0,_=0,B=0,x=0,O=0,P=0,L=0,b=0,C=0,M=0,Z=0,K=0,j=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],m=r[9],A=r[10],D=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,w+=n*g,E+=n*m,T+=n*A,R+=n*D,_+=n*I,B+=n*N,x+=n*F,O+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,w+=n*ue,E+=n*g,T+=n*m,R+=n*A,_+=n*D,B+=n*I,x+=n*N,O+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,w+=n*se,E+=n*ue,T+=n*g,R+=n*m,_+=n*A,B+=n*D,x+=n*I,O+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,w+=n*le,E+=n*se,T+=n*ue,R+=n*g,_+=n*m,B+=n*A,x+=n*D,O+=n*I,P+=n*N,L+=n*F,b+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,w+=n*oe,E+=n*le,T+=n*se,R+=n*ue,_+=n*g,B+=n*m,x+=n*A,O+=n*D,P+=n*I,L+=n*N,b+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,w+=n*ce,E+=n*oe,T+=n*le,R+=n*se,_+=n*ue,B+=n*g,x+=n*m,O+=n*A,P+=n*D,L+=n*I,b+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,w+=n*q,E+=n*ce,T+=n*oe,R+=n*le,_+=n*se,B+=n*ue,x+=n*g,O+=n*m,P+=n*A,L+=n*D,b+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,w+=n*ne,E+=n*q,T+=n*ce,R+=n*oe,_+=n*le,B+=n*se,x+=n*ue,O+=n*g,P+=n*m,L+=n*A,b+=n*D,C+=n*I,M+=n*N,Z+=n*F,K+=n*S,n=e[8],w+=n*te,E+=n*ne,T+=n*q,R+=n*ce,_+=n*oe,B+=n*le,x+=n*se,O+=n*ue,P+=n*g,L+=n*m,b+=n*A,C+=n*D,M+=n*I,Z+=n*N,K+=n*F,j+=n*S,n=e[9],E+=n*te,T+=n*ne,R+=n*q,_+=n*ce,B+=n*oe,x+=n*le,O+=n*se,P+=n*ue,L+=n*g,b+=n*m,C+=n*A,M+=n*D,Z+=n*I,K+=n*N,j+=n*F,G+=n*S,n=e[10],T+=n*te,R+=n*ne,_+=n*q,B+=n*ce,x+=n*oe,O+=n*le,P+=n*se,L+=n*ue,b+=n*g,C+=n*m,M+=n*A,Z+=n*D,K+=n*I,j+=n*N,G+=n*F,$+=n*S,n=e[11],R+=n*te,_+=n*ne,B+=n*q,x+=n*ce,O+=n*oe,P+=n*le,L+=n*se,b+=n*ue,C+=n*g,M+=n*m,Z+=n*A,K+=n*D,j+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],_+=n*te,B+=n*ne,x+=n*q,O+=n*ce,P+=n*oe,L+=n*le,b+=n*se,C+=n*ue,M+=n*g,Z+=n*m,K+=n*A,j+=n*D,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],B+=n*te,x+=n*ne,O+=n*q,P+=n*ce,L+=n*oe,b+=n*le,C+=n*se,M+=n*ue,Z+=n*g,K+=n*m,j+=n*A,G+=n*D,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,O+=n*ne,P+=n*q,L+=n*ce,b+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,K+=n*g,j+=n*m,G+=n*A,$+=n*D,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],O+=n*te,P+=n*ne,L+=n*q,b+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,K+=n*ue,j+=n*g,G+=n*m,$+=n*A,de+=n*D,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*b,u+=38*C,l+=38*M,f+=38*Z,d+=38*K,y+=38*j,w+=38*G,E+=38*$,T+=38*de,R+=38*ae,_+=38*re,B+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=w,t[9]=E,t[10]=T,t[11]=R,t[12]=_,t[13]=B,t[14]=x,t[15]=O}function gl(t,e){$n(t,e,e)}function vG(t,e){let r=An();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)gl(r,r),n!==2&&n!==4&&$n(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function Y1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=An(),s=An(),o=An(),a=An(),u=An(),l=An();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,EG(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;pl(i,s,E),pl(o,a,E),tp(u,i,o),rp(i,i,o),tp(o,s,a),rp(s,s,a),gl(a,u),gl(l,i),$n(i,o,i),$n(o,s,u),tp(u,i,o),rp(i,i,o),gl(s,i),rp(o,a,l),$n(i,o,mG),tp(i,i,a),$n(o,o,i),$n(i,a,l),$n(a,s,n),gl(s,u),pl(i,s,E),pl(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);vG(f,f),$n(d,d,f);let y=new Uint8Array(32);return wG(y,d),y}lt.scalarMult=Y1;function hD(t){return Y1(t,fD)}lt.scalarMultBase=hD;function dD(t){if(t.length!==lt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${lt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:hD(e),secretKey:e}}lt.generateKeyPairFromSeed=dD;function AG(t){let e=(0,gG.randomBytes)(32,t),r=dD(e);return(0,yG.wipe)(e),r}lt.generateKeyPair=AG;function _G(t,e,r=!1){if(t.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=Y1(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function mD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function ED(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=wu(t.length);for(let n=0;n{c();jd();il()});var J1={};at(J1,{compare:()=>gD,concat:()=>Gd,equals:()=>mD,fromString:()=>En,toString:()=>Kn,xor:()=>ED});var X1=ge(()=>{c();yD();f1();wD();U1();M1();vD()});var PD=v(Ze=>{"use strict";c();var AD=Ze&&Ze.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new xD:typeof navigator<"u"?Z1(navigator.userAgent):OD()}Ze.detect=CG;function ND(t){return t!==""&&SG.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function TG(t){var e=ND(t);return e?e[0]:null}Ze.browserName=TG;function Z1(t){var e=ND(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new TD;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_D&&(i=AD(AD([],i,!0),xG(_D-i.length),!0)):i=[];var s=i.join("."),o=DD(t),a=IG.exec(t);return a&&a[1]?new CD(r,s,o,a[1]):new ID(r,s,o)}Ze.parseUserAgent=Z1;function DD(t){for(var e=0,r=bD.length;e{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.getLocalStorage=ze.getLocalStorageOrThrow=ze.getCrypto=ze.getCryptoOrThrow=ze.getLocation=ze.getLocationOrThrow=ze.getNavigator=ze.getNavigatorOrThrow=ze.getDocument=ze.getDocumentOrThrow=ze.getFromWindowOrThrow=ze.getFromWindow=void 0;function uo(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ze.getFromWindow=uo;function Cu(t){let e=uo(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ze.getFromWindowOrThrow=Cu;function NG(){return Cu("document")}ze.getDocumentOrThrow=NG;function DG(){return uo("document")}ze.getDocument=DG;function OG(){return Cu("navigator")}ze.getNavigatorOrThrow=OG;function PG(){return uo("navigator")}ze.getNavigator=PG;function BG(){return Cu("location")}ze.getLocationOrThrow=BG;function RG(){return uo("location")}ze.getLocation=RG;function LG(){return Cu("crypto")}ze.getCryptoOrThrow=LG;function FG(){return uo("crypto")}ze.getCrypto=FG;function MG(){return Cu("localStorage")}ze.getLocalStorageOrThrow=MG;function UG(){return uo("localStorage")}ze.getLocalStorage=UG});var RD=v(np=>{"use strict";c();Object.defineProperty(np,"__esModule",{value:!0});np.getWindowMetadata=void 0;var BD=ev();function qG(){let t,e;try{t=BD.getDocumentOrThrow(),e=BD.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),y=[];for(let w=0;w-1){let R=E.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let _=e.protocol+"//"+e.host;if(R.indexOf("/")===0)_+=R;else{let B=e.pathname.split("/");B.pop();let x=B.join("/");_+=x+"/"+R}y.push(_)}else if(R.indexOf("//")===0){let _=e.protocol+R;y.push(_)}else y.push(R)}}return y}function n(...d){let y=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(R)).filter(R=>R?d.includes(R):!1);if(T.length&&T){let R=E.getAttribute("content");if(R)return R}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}np.getWindowMetadata=qG});var FD=v((jae,LD)=>{"use strict";c();LD.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var HD=v((Qae,VD)=>{"use strict";c();var qD="%[a-f0-9]{2}",MD=new RegExp("("+qD+")|([^%]+?)","gi"),UD=new RegExp("("+qD+")+","gi");function tv(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],tv(r),tv(n))}function VG(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(MD)||[],r=1;r{"use strict";c();jD.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var kD=v((Wae,QD)=>{"use strict";c();QD.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var jG=FD(),GG=HD(),zD=GD(),QG=kD(),kG=t=>t==null,rv=Symbol("encodeFragmentIdentifier");function KG(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[",i,"]"].join("")]:[...r,[pt(e,t),"[",pt(i,t),"]=",pt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[]"].join("")]:[...r,[pt(e,t),"[]=",pt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),":list="].join("")]:[...r,[pt(e,t),":list=",pt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[pt(r,t),e,pt(i,t)].join("")]:[[n,pt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,pt(e,t)]:[...r,[pt(e,t),"=",pt(n,t)].join("")]}}function zG(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&Yn(n,t).includes(t.arrayFormatSeparator);n=o?Yn(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>Yn(u,t)):n===null?n:Yn(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Yn(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>Yn(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function WD(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function pt(t,e){return e.encode?e.strict?jG(t):encodeURIComponent(t):t}function Yn(t,e){return e.decode?GG(t):t}function $D(t){return Array.isArray(t)?t.sort():typeof t=="object"?$D(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function YD(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function WG(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function JD(t){t=YD(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function KD(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function XD(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),WD(e.arrayFormatSeparator);let r=zG(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=zD(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Yn(o,e),r(Yn(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=KD(s[o],e);else n[i]=KD(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=$D(o):i[s]=o,i},Object.create(null))}ir.extract=JD;ir.parse=XD;ir.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),WD(e.arrayFormatSeparator);let r=o=>e.skipNull&&kG(t[o])||e.skipEmptyString&&t[o]==="",n=KG(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?pt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?pt(o,e)+"[]":a.reduce(n(o),[]).join("&"):pt(o,e)+"="+pt(a,e)}).filter(o=>o.length>0).join("&")};ir.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=zD(t,"#");return Object.assign({url:r.split("?")[0]||"",query:XD(JD(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Yn(n,e)}:{})};ir.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[rv]:!0},e);let r=YD(t.url).split("?")[0]||"",n=ir.extract(t.url),i=ir.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=ir.stringify(s,e);o&&(o=`?${o}`);let a=WG(t.url);return t.fragmentIdentifier&&(a=`#${e[rv]?pt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};ir.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[rv]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=ir.parseUrl(t,r);return ir.stringifyUrl({url:n,query:QG(i,e),fragmentIdentifier:s},r)};ir.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return ir.pick(t,n,r)}});var eO=ge(()=>{c()});function Mi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function $G(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function YG(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function JG(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function yl(t,e,r){return(!r.length?YG(t,e.length):JG(t,e.length))?$G(t,e):!1}function ml(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var nv=ge(()=>{c()});function XG(t){return ip(t.method)&&sp(t.params)}function ip(t){return ml(t,"subscribe")}function sp(t){return yl(t,["topic"],[])}function ZG(t){return op(t.method)&&ap(t.params)}function op(t){return ml(t,"publish")}function ap(t){return yl(t,["message","topic","ttl"],["prompt","tag"])}function e9(t){return up(t.method)&&cp(t.params)}function up(t){return ml(t,"unsubscribe")}function cp(t){return yl(t,["id","topic"],[])}function t9(t){return lp(t.method)&&fp(t.params)}function lp(t){return ml(t,"subscription")}function fp(t){return yl(t,["id","data"],[])}var iv=ge(()=>{c();nv()});function r9(t){if(!ip(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!sp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Mi(e,"topic"),e}function n9(t){if(!op(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!ap(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Mi(e,"topic"),Mi(e,"message"),Mi(e,"ttl","number"),e}function i9(t){if(!up(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!cp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Mi(e,"id"),e}function s9(t){if(!lp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!fp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Mi(e,"id"),Mi(e,"data"),e}var tO=ge(()=>{c();nv();iv()});var o9,rO=ge(()=>{c();o9={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var nO={};at(nO,{RELAY_JSONRPC:()=>o9,isPublishMethod:()=>op,isPublishParams:()=>ap,isPublishRequest:()=>ZG,isSubscribeMethod:()=>ip,isSubscribeParams:()=>sp,isSubscribeRequest:()=>XG,isSubscriptionMethod:()=>lp,isSubscriptionParams:()=>fp,isSubscriptionRequest:()=>t9,isUnsubscribeMethod:()=>up,isUnsubscribeParams:()=>cp,isUnsubscribeRequest:()=>e9,parsePublishRequest:()=>n9,parseSubscribeRequest:()=>r9,parseSubscriptionRequest:()=>s9,parseUnsubscribeRequest:()=>i9});var iO=ge(()=>{c();eO();tO();rO();iv()});var _p=v(Q=>{"use strict";c();Object.defineProperty(Q,"__esModule",{value:!0});var pO=rD(),a9=uD(),gO=el(),uv=lD(),u9=pD(),et=(X1(),nt(J1)),c9=PD(),xu=ro(),wl=ev(),l9=RD(),f9=ZD(),h9=(iO(),nt(nO));function yO(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var mO=yO(u9),hp=yO(f9),gp=":";function wO(t){let[e,r]=t.split(gp);return{namespace:e,reference:r}}function EO(t){let{namespace:e,reference:r}=t;return[e,r].join(gp)}function cv(t){let[e,r,n]=t.split(gp);return{namespace:e,reference:r,address:n}}function vO(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(gp)}function lv(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function AO(t){let{address:e}=cv(t);return e}function _O(t){let{namespace:e,reference:r}=cv(t);return EO({namespace:e,reference:r})}function d9(t,e){let{namespace:r,reference:n}=wO(e);return vO({namespace:r,reference:n,address:t})}function p9(t){return lv(t,AO)}function bO(t){return lv(t,_O)}function g9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function y9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...bO(i.accounts))}),r}function m9(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...yp(n,i))}),r}function yp(t,e){return t.includes(":")?[t]:e.chains||[]}var mp=t=>t?.split(":"),IO=t=>{let e=t&&mp(t);if(e)return e[3]},w9=t=>{let e=t&&mp(t);if(e)return e[2]+":"+e[3]},SO=t=>{let e=t&&mp(t);if(e)return e.pop()},E9=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=SO(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${IO(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: ${t.resources.map(d=>`- ${d}`).join(` `)}`:void 0;return[r,n,"",i,"",s,o,a,u,l,f].filter(d=>d!=null).join(` -`)},dv="base10",$t="base16",gp="base64pad",vp="utf8",pv=0,Nu=1,I9=0,aO=1,av=12,gv=32;function S9(){let t=EO.generateKeyPair();return{privateKey:et.toString(t.secretKey,$t),publicKey:et.toString(t.publicKey,$t)}}function C9(){let t=mO.randomBytes(gv);return et.toString(t,$t)}function T9(t,e){let r=EO.sharedKey(et.fromString(t,$t),et.fromString(e,$t)),n=new f9.HKDF(lv.SHA256,r).expand(gv);return et.toString(n,$t)}function x9(t){let e=lv.hash(et.fromString(t,$t));return et.toString(e,$t)}function N9(t){let e=lv.hash(et.fromString(t,vp));return et.toString(e,$t)}function xO(t){return et.fromString(`${t}`,dv)}function El(t){return Number(et.toString(t,dv))}function D9(t){let e=xO(typeof t.type<"u"?t.type:pv);if(El(e)===Nu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?et.fromString(t.senderPublicKey,$t):void 0,n=typeof t.iv<"u"?et.fromString(t.iv,$t):mO.randomBytes(av),i=new yO.ChaCha20Poly1305(et.fromString(t.symKey,$t)).seal(n,et.fromString(t.message,vp));return NO({type:e,sealed:i,iv:n,senderPublicKey:r})}function O9(t){let e=new yO.ChaCha20Poly1305(et.fromString(t.symKey,$t)),{sealed:r,iv:n}=yv(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return et.toString(i,vp)}function NO(t){if(El(t.type)===Nu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return et.toString(et.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),gp)}return et.toString(et.concat([t.type,t.iv,t.sealed]),gp)}function yv(t){let e=et.fromString(t,gp),r=e.slice(I9,aO),n=aO;if(El(r)===Nu){let a=n+gv,u=a+av,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+av,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function P9(t,e){let r=yv(t);return DO({type:El(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?et.toString(r.senderPublicKey,$t):void 0,receiverPublicKey:e?.receiverPublicKey})}function DO(t){let e=t?.type||pv;if(e===Nu){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function B9(t){return t.type===Nu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var R9=Object.defineProperty,uO=Object.getOwnPropertySymbols,L9=Object.prototype.hasOwnProperty,F9=Object.prototype.propertyIsEnumerable,cO=(t,e,r)=>e in t?R9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lO=(t,e)=>{for(var r in e||(e={}))L9.call(e,r)&&cO(t,r,e[r]);if(uO)for(var r of uO(e))F9.call(e,r)&&cO(t,r,e[r]);return t},OO="ReactNative",Tu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},yp=" ",M9=":",PO="/",mv=2,U9=1e3,BO="js";function wv(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function RO(){return!wl.getDocument()&&!!wl.getNavigator()&&navigator.product===OO}function LO(){return!wv()&&!!wl.getNavigator()}function Ev(){return RO()?Tu.reactNative:wv()?Tu.node:LO()?Tu.browser:Tu.unknown}function FO(t,e){let r=pp.parse(t);return r=lO(lO({},r),e),t=pp.stringify(r),t}function q9(){return p9.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function V9(t,e){var r;let n=Ev(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=wl.getLocation())==null?void 0:r.host)||"unknown"),i}function MO(){let t=d9.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function UO(){var t;let e=Ev();return e===Tu.browser?[e,((t=wl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function qO(t,e,r){let n=MO(),i=UO();return[[t,e].join("-"),[BO,r].join("-"),n,i].join("/")}function j9({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=qO(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=FO(a[1]||"",l);return a[0]+"?"+f}function H9(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function G9(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function VO(t,e=mv){return jO(t.split(PO),e)}function Q9(t){return VO(t).join(yp)}function Ui(t,e){return t.filter(r=>e.includes(r)).length===t.length}function jO(t,e=mv){return t.slice(Math.max(t.length-e,0))}function k9(t){return Object.fromEntries(t.entries())}function K9(t){return new Map(Object.entries(t))}function z9(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var W9=t=>t;function HO(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function $9(t){return t.split(yp).map(e=>HO(e)).join(yp)}function Y9(t=xu.FIVE_MINUTES,e){let r=xu.toMiliseconds(t||xu.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function J9(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function vv(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function X9(t){return vv("topic",t)}function Z9(t){return vv("id",t)}function eQ(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function tQ(t,e){return xu.fromMiliseconds((e||Date.now())+xu.toMiliseconds(t))}function rQ(t){return Date.now()>=xu.toMiliseconds(t)}function nQ(t,e){return`${t}${e?`:${e}`:""}`}function qi(t=[],e=[]){return[...new Set([...t,...e])]}var GO="irn";function iQ(t){return t?.relay||{protocol:GO}}function sQ(t){let e=y9.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var oQ=Object.defineProperty,fO=Object.getOwnPropertySymbols,aQ=Object.prototype.hasOwnProperty,uQ=Object.prototype.propertyIsEnumerable,hO=(t,e,r)=>e in t?oQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cQ=(t,e)=>{for(var r in e||(e={}))aQ.call(e,r)&&hO(t,r,e[r]);if(fO)for(var r of fO(e))uQ.call(e,r)&&hO(t,r,e[r]);return t};function QO(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function lQ(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=pp.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:QO(o)}}function kO(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function fQ(t){return`${t.protocol}:${t.topic}@${t.version}?`+pp.stringify(cQ({symKey:t.symKey},kO(t.relay)))}var hQ=Object.defineProperty,dQ=Object.defineProperties,pQ=Object.getOwnPropertyDescriptors,dO=Object.getOwnPropertySymbols,gQ=Object.prototype.hasOwnProperty,yQ=Object.prototype.propertyIsEnumerable,pO=(t,e,r)=>e in t?hQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mQ=(t,e)=>{for(var r in e||(e={}))gQ.call(e,r)&&pO(t,r,e[r]);if(dO)for(var r of dO(e))yQ.call(e,r)&&pO(t,r,e[r]);return t},wQ=(t,e)=>dQ(t,pQ(e));function co(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function KO(t){let e=[];return Object.values(t).forEach(r=>{e.push(...co(r.accounts))}),e}function zO(t,e){let r=[];return Object.values(t).forEach(n=>{co(n.accounts).includes(e)&&r.push(...n.methods)}),r}function WO(t,e){let r=[];return Object.values(t).forEach(n=>{co(n.accounts).includes(e)&&r.push(...n.events)}),r}function EQ(t,e){let r=r3(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function vQ(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=uv(e),s=uv(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,y=n[l].events,w=n[l].accounts;o[l]={chains:f,methods:d,events:y,accounts:w}});let a=i3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var N,R;return(R=(N=i[l])==null?void 0:N.chains)==null?void 0:R.includes(E)}),d=n[l].methods.filter(E=>{var N,R;return(R=(N=i[l])==null?void 0:N.methods)==null?void 0:R.includes(E)}),y=n[l].events.filter(E=>{var N,R;return(R=(N=i[l])==null?void 0:N.events)==null?void 0:R.includes(E)}),w=f.map(E=>n[l].accounts.filter(N=>N.includes(E))).flat();u[l]={chains:f,methods:d,events:y,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,y,w,E,N;if(!n[l])return;let R=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(T=>n[l].chains.includes(T)),M=n[l].methods.filter(T=>{var P,B;return(B=(P=s[l])==null?void 0:P.methods)==null?void 0:B.includes(T)}),x=n[l].events.filter(T=>{var P,B;return(B=(P=s[l])==null?void 0:P.events)==null?void 0:B.includes(T)}),b=R?.map(T=>n[l].accounts.filter(P=>P.includes(T))).flat();u[l]={chains:qi((y=u[l])==null?void 0:y.chains,R),methods:qi((w=u[l])==null?void 0:w.methods,M),events:qi((E=u[l])==null?void 0:E.events,x),accounts:qi((N=u[l])==null?void 0:N.accounts,b)}}),u}function Av(t){return t.includes(":")}function $O(t){return Av(t)?t.split(":")[0]:t}function uv(t){var e,r,n;let i={};if(!Ap(t))return i;for(let[s,o]of Object.entries(t)){let a=Av(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=$O(s);i[f]=wQ(mQ({},i[f]),{chains:qi(a,(e=i[f])==null?void 0:e.chains),methods:qi(u,(r=i[f])==null?void 0:r.methods),events:qi(l,(n=i[f])==null?void 0:n.events)})}return i}var AQ={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},_Q={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Jn(t,e){let{message:r,code:n}=_Q[t];return{message:e?`${r} ${e}`:r,code:n}}function uo(t,e){let{message:r,code:n}=AQ[t];return{message:e?`${r} ${e}`:r,code:n}}function vl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Ap(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Vi(t){return typeof t>"u"}function cr(t,e){return e&&Vi(t)?!0:typeof t=="string"&&!!t.trim().length}function _p(t,e){return e&&Vi(t)?!0:typeof t=="number"&&!isNaN(t)}function bQ(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ui(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=co(a),d=r[o];(!Ui(wp(o,d),f)||!Ui(d.methods,u)||!Ui(d.events,l))&&(s=!1)}),s):!1}function bp(t){return cr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function YO(t){if(cr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&bp(r)}}return!1}function IQ(t){if(cr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function SQ(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function CQ(t){return t?.topic}function TQ(t,e){let r=null;return cr(t?.publicKey,!1)||(r=Jn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function cv(t){let e=!0;return vl(t)?t.length&&(e=t.every(r=>cr(r,!1))):e=!1,e}function JO(t,e,r){let n=null;return vl(e)?e.forEach(i=>{n||(!bp(i)||!i.includes(t))&&(n=uo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=uo("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function XO(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;let s=JO(n,wp(n,i),`${e} requiredNamespace`);s&&(r=s)}),r}function ZO(t,e){let r=null;return vl(t)?t.forEach(n=>{r||YO(n)||(r=uo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=uo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function e3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=ZO(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function t3(t,e){let r=null;return cv(t?.methods)?cv(t?.events)||(r=uo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=uo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function _v(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=t3(n,`${e}, namespace`);i&&(r=i)}),r}function xQ(t,e,r){let n=null;if(t&&Ap(t)){let i=_v(t,e);i&&(n=i);let s=XO(t,e);s&&(n=s)}else n=Jn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function r3(t,e){let r=null;if(t&&Ap(t)){let n=_v(t,e);n&&(r=n);let i=e3(t,e);i&&(r=i)}else r=Jn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function n3(t){return cr(t.protocol,!0)}function NQ(t,e){let r=!1;return e&&!t?r=!0:t&&vl(t)&&t.length&&t.forEach(n=>{r=n3(n)}),r}function DQ(t){return typeof t=="number"}function OQ(t){return typeof t<"u"&&typeof t!==null}function PQ(t){return!(!t||typeof t!="object"||!t.code||!_p(t.code,!1)||!t.message||!cr(t.message,!1))}function BQ(t){return!(Vi(t)||!cr(t.method,!1))}function RQ(t){return!(Vi(t)||Vi(t.result)&&Vi(t.error)||!_p(t.id,!1)||!cr(t.jsonrpc,!1))}function LQ(t){return!(Vi(t)||!cr(t.name,!1))}function FQ(t,e){return!(!bp(e)||!KO(t).includes(e))}function MQ(t,e,r){return cr(r,!1)?zO(t,e).includes(r):!1}function UQ(t,e,r){return cr(r,!1)?WO(t,e).includes(r):!1}function i3(t,e,r){let n=null,i=qQ(t),s=VQ(e),o=Object.keys(i),a=Object.keys(s),u=gO(Object.keys(t)),l=gO(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)},fv="base10",$t="base16",dp="base64pad",wp="utf8",hv=0,Nu=1,v9=0,sO=1,sv=12,dv=32;function A9(){let t=mO.generateKeyPair();return{privateKey:et.toString(t.secretKey,$t),publicKey:et.toString(t.publicKey,$t)}}function _9(){let t=gO.randomBytes(dv);return et.toString(t,$t)}function b9(t,e){let r=mO.sharedKey(et.fromString(t,$t),et.fromString(e,$t)),n=new a9.HKDF(uv.SHA256,r).expand(dv);return et.toString(n,$t)}function I9(t){let e=uv.hash(et.fromString(t,$t));return et.toString(e,$t)}function S9(t){let e=uv.hash(et.fromString(t,wp));return et.toString(e,$t)}function CO(t){return et.fromString(`${t}`,fv)}function El(t){return Number(et.toString(t,fv))}function C9(t){let e=CO(typeof t.type<"u"?t.type:hv);if(El(e)===Nu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?et.fromString(t.senderPublicKey,$t):void 0,n=typeof t.iv<"u"?et.fromString(t.iv,$t):gO.randomBytes(sv),i=new pO.ChaCha20Poly1305(et.fromString(t.symKey,$t)).seal(n,et.fromString(t.message,wp));return TO({type:e,sealed:i,iv:n,senderPublicKey:r})}function T9(t){let e=new pO.ChaCha20Poly1305(et.fromString(t.symKey,$t)),{sealed:r,iv:n}=pv(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return et.toString(i,wp)}function TO(t){if(El(t.type)===Nu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return et.toString(et.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),dp)}return et.toString(et.concat([t.type,t.iv,t.sealed]),dp)}function pv(t){let e=et.fromString(t,dp),r=e.slice(v9,sO),n=sO;if(El(r)===Nu){let a=n+dv,u=a+sv,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+sv,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function x9(t,e){let r=pv(t);return xO({type:El(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?et.toString(r.senderPublicKey,$t):void 0,receiverPublicKey:e?.receiverPublicKey})}function xO(t){let e=t?.type||hv;if(e===Nu){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function N9(t){return t.type===Nu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var D9=Object.defineProperty,oO=Object.getOwnPropertySymbols,O9=Object.prototype.hasOwnProperty,P9=Object.prototype.propertyIsEnumerable,aO=(t,e,r)=>e in t?D9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uO=(t,e)=>{for(var r in e||(e={}))O9.call(e,r)&&aO(t,r,e[r]);if(oO)for(var r of oO(e))P9.call(e,r)&&aO(t,r,e[r]);return t},NO="ReactNative",Tu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pp=" ",B9=":",DO="/",gv=2,R9=1e3,OO="js";function yv(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function PO(){return!wl.getDocument()&&!!wl.getNavigator()&&navigator.product===NO}function BO(){return!yv()&&!!wl.getNavigator()}function mv(){return PO()?Tu.reactNative:yv()?Tu.node:BO()?Tu.browser:Tu.unknown}function RO(t,e){let r=hp.parse(t);return r=uO(uO({},r),e),t=hp.stringify(r),t}function L9(){return l9.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function F9(t,e){var r;let n=mv(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=wl.getLocation())==null?void 0:r.host)||"unknown"),i}function LO(){let t=c9.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function FO(){var t;let e=mv();return e===Tu.browser?[e,((t=wl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function MO(t,e,r){let n=LO(),i=FO();return[[t,e].join("-"),[OO,r].join("-"),n,i].join("/")}function M9({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=MO(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=RO(a[1]||"",l);return a[0]+"?"+f}function U9(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function q9(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function UO(t,e=gv){return qO(t.split(DO),e)}function V9(t){return UO(t).join(pp)}function Ui(t,e){return t.filter(r=>e.includes(r)).length===t.length}function qO(t,e=gv){return t.slice(Math.max(t.length-e,0))}function H9(t){return Object.fromEntries(t.entries())}function j9(t){return new Map(Object.entries(t))}function G9(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Q9=t=>t;function VO(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function k9(t){return t.split(pp).map(e=>VO(e)).join(pp)}function K9(t=xu.FIVE_MINUTES,e){let r=xu.toMiliseconds(t||xu.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function z9(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function wv(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function W9(t){return wv("topic",t)}function $9(t){return wv("id",t)}function Y9(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function J9(t,e){return xu.fromMiliseconds((e||Date.now())+xu.toMiliseconds(t))}function X9(t){return Date.now()>=xu.toMiliseconds(t)}function Z9(t,e){return`${t}${e?`:${e}`:""}`}function qi(t=[],e=[]){return[...new Set([...t,...e])]}var HO="irn";function eQ(t){return t?.relay||{protocol:HO}}function tQ(t){let e=h9.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var rQ=Object.defineProperty,cO=Object.getOwnPropertySymbols,nQ=Object.prototype.hasOwnProperty,iQ=Object.prototype.propertyIsEnumerable,lO=(t,e,r)=>e in t?rQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sQ=(t,e)=>{for(var r in e||(e={}))nQ.call(e,r)&&lO(t,r,e[r]);if(cO)for(var r of cO(e))iQ.call(e,r)&&lO(t,r,e[r]);return t};function jO(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function oQ(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=hp.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:jO(o)}}function GO(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function aQ(t){return`${t.protocol}:${t.topic}@${t.version}?`+hp.stringify(sQ({symKey:t.symKey},GO(t.relay)))}var uQ=Object.defineProperty,cQ=Object.defineProperties,lQ=Object.getOwnPropertyDescriptors,fO=Object.getOwnPropertySymbols,fQ=Object.prototype.hasOwnProperty,hQ=Object.prototype.propertyIsEnumerable,hO=(t,e,r)=>e in t?uQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dQ=(t,e)=>{for(var r in e||(e={}))fQ.call(e,r)&&hO(t,r,e[r]);if(fO)for(var r of fO(e))hQ.call(e,r)&&hO(t,r,e[r]);return t},pQ=(t,e)=>cQ(t,lQ(e));function lo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function QO(t){let e=[];return Object.values(t).forEach(r=>{e.push(...lo(r.accounts))}),e}function kO(t,e){let r=[];return Object.values(t).forEach(n=>{lo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function KO(t,e){let r=[];return Object.values(t).forEach(n=>{lo(n.accounts).includes(e)&&r.push(...n.events)}),r}function gQ(t,e){let r=e3(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function yQ(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=ov(e),s=ov(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,y=n[l].events,w=n[l].accounts;o[l]={chains:f,methods:d,events:y,accounts:w}});let a=r3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var T,R;return(R=(T=i[l])==null?void 0:T.chains)==null?void 0:R.includes(E)}),d=n[l].methods.filter(E=>{var T,R;return(R=(T=i[l])==null?void 0:T.methods)==null?void 0:R.includes(E)}),y=n[l].events.filter(E=>{var T,R;return(R=(T=i[l])==null?void 0:T.events)==null?void 0:R.includes(E)}),w=f.map(E=>n[l].accounts.filter(T=>T.includes(E))).flat();u[l]={chains:f,methods:d,events:y,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,y,w,E,T;if(!n[l])return;let R=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(O=>n[l].chains.includes(O)),_=n[l].methods.filter(O=>{var P,L;return(L=(P=s[l])==null?void 0:P.methods)==null?void 0:L.includes(O)}),B=n[l].events.filter(O=>{var P,L;return(L=(P=s[l])==null?void 0:P.events)==null?void 0:L.includes(O)}),x=R?.map(O=>n[l].accounts.filter(P=>P.includes(O))).flat();u[l]={chains:qi((y=u[l])==null?void 0:y.chains,R),methods:qi((w=u[l])==null?void 0:w.methods,_),events:qi((E=u[l])==null?void 0:E.events,B),accounts:qi((T=u[l])==null?void 0:T.accounts,x)}}),u}function Ev(t){return t.includes(":")}function zO(t){return Ev(t)?t.split(":")[0]:t}function ov(t){var e,r,n;let i={};if(!Ep(t))return i;for(let[s,o]of Object.entries(t)){let a=Ev(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=zO(s);i[f]=pQ(dQ({},i[f]),{chains:qi(a,(e=i[f])==null?void 0:e.chains),methods:qi(u,(r=i[f])==null?void 0:r.methods),events:qi(l,(n=i[f])==null?void 0:n.events)})}return i}var mQ={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},wQ={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Jn(t,e){let{message:r,code:n}=wQ[t];return{message:e?`${r} ${e}`:r,code:n}}function co(t,e){let{message:r,code:n}=mQ[t];return{message:e?`${r} ${e}`:r,code:n}}function vl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Ep(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Vi(t){return typeof t>"u"}function cr(t,e){return e&&Vi(t)?!0:typeof t=="string"&&!!t.trim().length}function vp(t,e){return e&&Vi(t)?!0:typeof t=="number"&&!isNaN(t)}function EQ(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ui(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=lo(a),d=r[o];(!Ui(yp(o,d),f)||!Ui(d.methods,u)||!Ui(d.events,l))&&(s=!1)}),s):!1}function Ap(t){return cr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function WO(t){if(cr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Ap(r)}}return!1}function vQ(t){if(cr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function AQ(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function _Q(t){return t?.topic}function bQ(t,e){let r=null;return cr(t?.publicKey,!1)||(r=Jn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function av(t){let e=!0;return vl(t)?t.length&&(e=t.every(r=>cr(r,!1))):e=!1,e}function $O(t,e,r){let n=null;return vl(e)?e.forEach(i=>{n||(!Ap(i)||!i.includes(t))&&(n=co("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=co("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function YO(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;let s=$O(n,yp(n,i),`${e} requiredNamespace`);s&&(r=s)}),r}function JO(t,e){let r=null;return vl(t)?t.forEach(n=>{r||WO(n)||(r=co("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=co("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function XO(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=JO(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function ZO(t,e){let r=null;return av(t?.methods)?av(t?.events)||(r=co("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=co("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function vv(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=ZO(n,`${e}, namespace`);i&&(r=i)}),r}function IQ(t,e,r){let n=null;if(t&&Ep(t)){let i=vv(t,e);i&&(n=i);let s=YO(t,e);s&&(n=s)}else n=Jn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function e3(t,e){let r=null;if(t&&Ep(t)){let n=vv(t,e);n&&(r=n);let i=XO(t,e);i&&(r=i)}else r=Jn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function t3(t){return cr(t.protocol,!0)}function SQ(t,e){let r=!1;return e&&!t?r=!0:t&&vl(t)&&t.length&&t.forEach(n=>{r=t3(n)}),r}function CQ(t){return typeof t=="number"}function TQ(t){return typeof t<"u"&&typeof t!==null}function xQ(t){return!(!t||typeof t!="object"||!t.code||!vp(t.code,!1)||!t.message||!cr(t.message,!1))}function NQ(t){return!(Vi(t)||!cr(t.method,!1))}function DQ(t){return!(Vi(t)||Vi(t.result)&&Vi(t.error)||!vp(t.id,!1)||!cr(t.jsonrpc,!1))}function OQ(t){return!(Vi(t)||!cr(t.name,!1))}function PQ(t,e){return!(!Ap(e)||!QO(t).includes(e))}function BQ(t,e,r){return cr(r,!1)?kO(t,e).includes(r):!1}function RQ(t,e,r){return cr(r,!1)?KO(t,e).includes(r):!1}function r3(t,e,r){let n=null,i=LQ(t),s=FQ(e),o=Object.keys(i),a=Object.keys(s),u=dO(Object.keys(t)),l=dO(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} Received: ${Object.keys(e).toString()}`)),Ui(o,a)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let y=co(e[d].accounts);y.includes(d)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} + Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let y=lo(e[d].accounts);y.includes(d)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${y.toString()}`))}),o.forEach(d=>{n||(Ui(i[d].methods,s[d].methods)?Ui(i[d].events,s[d].events)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function qQ(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function gO(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function VQ(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:co(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function jQ(t,e){return _p(t,!1)&&t<=e.max&&t>=e.min}Q.BASE10=dv,Q.BASE16=$t,Q.BASE64=gp,Q.COLON=M9,Q.DEFAULT_DEPTH=mv,Q.EMPTY_SPACE=yp,Q.ENV_MAP=Tu,Q.ONE_THOUSAND=U9,Q.REACT_NATIVE_PRODUCT=OO,Q.RELAYER_DEFAULT_PROTOCOL=GO,Q.SDK_TYPE=BO,Q.SLASH=PO,Q.TYPE_0=pv,Q.TYPE_1=Nu,Q.UTF8=vp,Q.appendToQueryString=FO,Q.assertType=G9,Q.buildApprovedNamespaces=vQ,Q.calcExpiry=tQ,Q.capitalize=$9,Q.capitalizeWord=HO,Q.createDelayedPromise=Y9,Q.createExpiringPromise=J9,Q.decodeTypeByte=El,Q.decrypt=O9,Q.deriveSymKey=T9,Q.deserialize=yv,Q.encodeTypeByte=xO,Q.encrypt=D9,Q.engineEvent=nQ,Q.enumify=W9,Q.formatAccountId=_O,Q.formatAccountWithChain=m9,Q.formatChainId=AO,Q.formatExpirerTarget=vv,Q.formatIdTarget=Z9,Q.formatMessage=b9,Q.formatMessageContext=Q9,Q.formatRelayParams=kO,Q.formatRelayRpcUrl=j9,Q.formatTopicTarget=X9,Q.formatUA=qO,Q.formatUri=fQ,Q.generateKeyPair=S9,Q.generateRandomBytes32=C9,Q.getAccountsChains=co,Q.getAccountsFromNamespaces=E9,Q.getAddressFromAccount=bO,Q.getAddressesFromAccounts=w9,Q.getAppMetadata=q9,Q.getChainFromAccount=IO,Q.getChainsFromAccounts=SO,Q.getChainsFromNamespace=wp,Q.getChainsFromNamespaces=v9,Q.getChainsFromRequiredNamespaces=A9,Q.getDidAddress=TO,Q.getDidAddressSegments=Ep,Q.getDidChainId=CO,Q.getEnvironment=Ev,Q.getHttpUrl=H9,Q.getInternalError=Jn,Q.getJavascriptID=UO,Q.getJavascriptOS=MO,Q.getLastItems=jO,Q.getNamespacedDidChainId=_9,Q.getNamespacesChains=KO,Q.getNamespacesEventsForChainId=WO,Q.getNamespacesMethodsForChainId=zO,Q.getRelayClientMetadata=V9,Q.getRelayProtocolApi=sQ,Q.getRelayProtocolName=iQ,Q.getRequiredNamespacesFromNamespaces=EQ,Q.getSdkError=uo,Q.getUniqueValues=hv,Q.hasOverlap=Ui,Q.hashKey=x9,Q.hashMessage=N9,Q.isBrowser=LO,Q.isCaipNamespace=Av,Q.isConformingNamespaces=i3,Q.isExpired=rQ,Q.isNode=wv,Q.isProposalStruct=SQ,Q.isReactNative=RO,Q.isSessionCompatible=bQ,Q.isSessionStruct=CQ,Q.isTypeOneEnvelope=B9,Q.isUndefined=Vi,Q.isValidAccountId=YO,Q.isValidAccounts=ZO,Q.isValidActions=t3,Q.isValidArray=vl,Q.isValidChainId=bp,Q.isValidChains=JO,Q.isValidController=TQ,Q.isValidErrorReason=PQ,Q.isValidEvent=LQ,Q.isValidId=DQ,Q.isValidNamespaceAccounts=e3,Q.isValidNamespaceActions=_v,Q.isValidNamespaceChains=XO,Q.isValidNamespaceMethodsOrEvents=cv,Q.isValidNamespaces=r3,Q.isValidNamespacesChainId=FQ,Q.isValidNamespacesEvent=UQ,Q.isValidNamespacesRequest=MQ,Q.isValidNumber=_p,Q.isValidObject=Ap,Q.isValidParams=OQ,Q.isValidRelay=n3,Q.isValidRelays=NQ,Q.isValidRequest=BQ,Q.isValidRequestExpiry=jQ,Q.isValidRequiredNamespaces=xQ,Q.isValidResponse=RQ,Q.isValidString=cr,Q.isValidUrl=IQ,Q.mapEntries=z9,Q.mapToObj=k9,Q.mergeArrays=qi,Q.normalizeNamespaces=uv,Q.objToMap=K9,Q.parseAccountId=fv,Q.parseChainId=vO,Q.parseContextNames=VO,Q.parseExpirerTarget=eQ,Q.parseNamespaceKey=$O,Q.parseRelayParams=QO,Q.parseUri=lQ,Q.serialize=NO,Q.validateDecoding=P9,Q.validateEncoding=DO});var s3,o3,a3,u3,Sp,Al,bv,Cp,ji,_l,Tp=ge(()=>{c();s3="PARSE_ERROR",o3="INVALID_REQUEST",a3="METHOD_NOT_FOUND",u3="INVALID_PARAMS",Sp="INTERNAL_ERROR",Al="SERVER_ERROR",bv=[-32700,-32600,-32601,-32602,-32603],Cp=[-32e3,-32099],ji={[s3]:{code:-32700,message:"Parse error"},[o3]:{code:-32600,message:"Invalid Request"},[a3]:{code:-32601,message:"Method not found"},[u3]:{code:-32602,message:"Invalid params"},[Sp]:{code:-32603,message:"Internal error"},[Al]:{code:-32e3,message:"Server error"}},_l=Al});function HQ(t){return t<=Cp[0]&&t>=Cp[1]}function xp(t){return bv.includes(t)}function c3(t){return typeof t=="number"}function Np(t){return Object.keys(ji).includes(t)?ji[t]:ji[_l]}function Dp(t){let e=Object.values(ji).find(r=>r.code===t);return e||ji[_l]}function GQ(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!c3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(xp(t.error.code)){let e=Dp(t.error.code);if(e.message!==ji[_l].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function Iv(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Sv=ge(()=>{c();Tp()});var f3=v(Hi=>{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.isBrowserCryptoAvailable=Hi.getSubtleCrypto=Hi.getBrowerCrypto=void 0;function Cv(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Hi.getBrowerCrypto=Cv;function l3(){let t=Cv();return t.subtle||t.webkitSubtle}Hi.getSubtleCrypto=l3;function QQ(){return!!Cv()&&!!l3()}Hi.isBrowserCryptoAvailable=QQ});var p3=v(Gi=>{"use strict";c();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.isBrowser=Gi.isNode=Gi.isReactNative=void 0;function h3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Gi.isReactNative=h3;function d3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}Gi.isNode=d3;function kQ(){return!h3()&&!d3()}Gi.isBrowser=kQ});var Tv=v(Op=>{"use strict";c();Object.defineProperty(Op,"__esModule",{value:!0});var g3=(ar(),rt(or));g3.__exportStar(f3(),Op);g3.__exportStar(p3(),Op)});var Ot={};ot(Ot,{isNodeJs:()=>m3});var y3,m3,w3=ge(()=>{c();y3=_e(Tv());Lt(Ot,_e(Tv()));m3=y3.isNode});function xv(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Nv(t=6){return BigInt(xv(t))}function Dv(t,e,r){return{id:r||xv(),jsonrpc:"2.0",method:t,params:e}}function KQ(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Ov(t,e,r){return{id:t,jsonrpc:"2.0",error:E3(e,r)}}function E3(t,e){return typeof t>"u"?Np(Sp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Np(Al)),{message:t})),typeof e<"u"&&(t.data=e),xp(t.code)&&(t=Dp(t.code)),t)}var v3=ge(()=>{c();Sv();Tp()});function zQ(t){return t.includes("*")?Bp(t):!/\W/g.test(t)}function Pp(t){return t==="*"}function Bp(t){return Pp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function WQ(t){return!Pp(t)&&Bp(t)&&!t.split("*")[0].trim()}function $Q(t){return!Pp(t)&&Bp(t)&&!t.split("*")[1].trim()}var A3=ge(()=>{c()});var _3=ge(()=>{c()});var Du,Pv=ge(()=>{c();Du=class{}});var Bv,Rp,bl,b3=ge(()=>{c();Pv();Bv=class extends Du{constructor(e){super()}},Rp=class extends Du{constructor(){super()}},bl=class extends Rp{constructor(e){super()}}});var I3=ge(()=>{c()});var S3=ge(()=>{c();_3();Pv();b3();I3()});var C3=ge(()=>{c();S3()});function XQ(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function T3(t,e){let r=XQ(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function ZQ(t){return T3(t,YQ)}function Lp(t){return T3(t,JQ)}function Rv(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var YQ,JQ,x3=ge(()=>{c();YQ="^https?:",JQ="^wss?:"});function Lv(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function ek(t){return Lv(t)&&"method"in t}function Fv(t){return Lv(t)&&(N3(t)||Fp(t))}function N3(t){return"result"in t}function Fp(t){return"error"in t}function tk(t){return"error"in t&&t.valid===!1}var D3=ge(()=>{c()});var Kt={};ot(Kt,{DEFAULT_ERROR:()=>_l,IBaseJsonRpcProvider:()=>Rp,IEvents:()=>Du,IJsonRpcConnection:()=>Bv,IJsonRpcProvider:()=>bl,INTERNAL_ERROR:()=>Sp,INVALID_PARAMS:()=>u3,INVALID_REQUEST:()=>o3,METHOD_NOT_FOUND:()=>a3,PARSE_ERROR:()=>s3,RESERVED_ERROR_CODES:()=>bv,SERVER_ERROR:()=>Al,SERVER_ERROR_CODE_RANGE:()=>Cp,STANDARD_ERROR_MAP:()=>ji,formatErrorMessage:()=>E3,formatJsonRpcError:()=>Ov,formatJsonRpcRequest:()=>Dv,formatJsonRpcResult:()=>KQ,getBigIntRpcId:()=>Nv,getError:()=>Np,getErrorByCode:()=>Dp,isHttpUrl:()=>ZQ,isJsonRpcError:()=>Fp,isJsonRpcPayload:()=>Lv,isJsonRpcRequest:()=>ek,isJsonRpcResponse:()=>Fv,isJsonRpcResult:()=>N3,isJsonRpcValidationInvalid:()=>tk,isLocalhostUrl:()=>Rv,isNodeJs:()=>m3,isReservedErrorCode:()=>xp,isServerErrorCode:()=>HQ,isValidDefaultRoute:()=>Pp,isValidErrorCode:()=>c3,isValidLeadingWildcardRoute:()=>WQ,isValidRoute:()=>zQ,isValidTrailingWildcardRoute:()=>$Q,isValidWildcardRoute:()=>Bp,isWsUrl:()=>Lp,parseConnectionError:()=>Iv,payloadId:()=>xv,validateJsonRpcError:()=>GQ});var Il=ge(()=>{c();Tp();Sv();w3();Lt(Kt,Ot);v3();A3();C3();x3();D3()});var O3,Mp,P3,Mv=ge(()=>{c();O3=_e(Hn());Il();Mp=class extends bl{constructor(e){super(e),this.events=new O3.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Dv(e.method,e.params||[],Nv().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Fp(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Fv(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},P3=Mp});var B3={};ot(B3,{JsonRpcProvider:()=>Mp,default:()=>rk});var rk,R3=ge(()=>{c();Mv();Mv();rk=P3});var F3=v((Ace,L3)=>{"use strict";c();L3.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var U3,M3,nk,ik,sk,Up,q3,Uv=ge(()=>{c();U3=_e(Hn());Nd();Il();M3=10,nk=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:F3(),ik=()=>typeof window<"u",sk=nk(),Up=class{constructor(e){if(this.url=e,this.events=new U3.EventEmitter,this.registering=!1,!Lp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Zc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Lp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Kt.isReactNative)()?void 0:{rejectUnauthorized:!Rv(e)},s=new sk(e,[],i);ik()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Xc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=Ov(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Iv(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>M3&&this.events.setMaxListeners(M3)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}},q3=Up});var V3={};ot(V3,{WsConnection:()=>Up,default:()=>ok});var ok,j3=ge(()=>{c();Uv();Uv();ok=q3});var _6=v((Sl,Pu)=>{c();var ak=200,$v="__lodash_hash_undefined__",Kp=1,Z3=2,e6=9007199254740991,qp="[object Arguments]",Hv="[object Array]",uk="[object AsyncFunction]",t6="[object Boolean]",r6="[object Date]",n6="[object Error]",i6="[object Function]",ck="[object GeneratorFunction]",Vp="[object Map]",s6="[object Number]",lk="[object Null]",Ou="[object Object]",H3="[object Promise]",fk="[object Proxy]",o6="[object RegExp]",jp="[object Set]",a6="[object String]",hk="[object Symbol]",dk="[object Undefined]",Gv="[object WeakMap]",u6="[object ArrayBuffer]",Hp="[object DataView]",pk="[object Float32Array]",gk="[object Float64Array]",yk="[object Int8Array]",mk="[object Int16Array]",wk="[object Int32Array]",Ek="[object Uint8Array]",vk="[object Uint8ClampedArray]",Ak="[object Uint16Array]",_k="[object Uint32Array]",bk=/[\\^$.*+?()[\]{}|]/g,Ik=/^\[object .+?Constructor\]$/,Sk=/^(?:0|[1-9]\d*)$/,Ye={};Ye[pk]=Ye[gk]=Ye[yk]=Ye[mk]=Ye[wk]=Ye[Ek]=Ye[vk]=Ye[Ak]=Ye[_k]=!0;Ye[qp]=Ye[Hv]=Ye[u6]=Ye[t6]=Ye[Hp]=Ye[r6]=Ye[n6]=Ye[i6]=Ye[Vp]=Ye[s6]=Ye[Ou]=Ye[o6]=Ye[jp]=Ye[a6]=Ye[Gv]=!1;var c6=typeof global=="object"&&global&&global.Object===Object&&global,Ck=typeof self=="object"&&self&&self.Object===Object&&self,Xn=c6||Ck||Function("return this")(),l6=typeof Sl=="object"&&Sl&&!Sl.nodeType&&Sl,G3=l6&&typeof Pu=="object"&&Pu&&!Pu.nodeType&&Pu,f6=G3&&G3.exports===l6,qv=f6&&c6.process,Q3=function(){try{return qv&&qv.binding&&qv.binding("util")}catch{}}(),k3=Q3&&Q3.isTypedArray;function Tk(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function nK(t,e){var r=this.__data__,n=Wp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Zn.prototype.clear=Zk;Zn.prototype.delete=eK;Zn.prototype.get=tK;Zn.prototype.has=rK;Zn.prototype.set=nK;function ho(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,y=r&Z3?new Qp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=e6}function v6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function xl(t){return t!=null&&typeof t=="object"}var A6=k3?Ok(k3):vK;function RK(t){return PK(t)?yK(t):AK(t)}function LK(){return[]}function FK(){return!1}Pu.exports=BK});var IP=v(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});var go=Hn(),MK=pd(),UK=n2(),og=E2(),tt=PE(),Ki=$E(),b6=(Nd(),rt(C2)),qK=(YN(),rt($N)),ee=Ip(),VK=(ev(),rt(Z1)),St=to(),jK=(R3(),rt(B3)),jr=(Il(),rt(Kt)),HK=(j3(),rt(V3)),GK=_6();function Pl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function QK(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var kK=Pl(go),V6=Pl(MK),KK=Pl(UK),Yp=QK(qK),zK=Pl(HK),WK=Pl(GK);function $K(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,T=new Uint8Array(b);M!==x;){for(var P=E[M],B=0,_=b-1;(P!==0||B>>0,T[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=B,M++}for(var S=b-R;S!==b&&T[S]===0;)S++;for(var F=u.repeat(N);S>>0,b=new Uint8Array(x);E[N];){var T=r[E.charCodeAt(N)];if(T===255)return;for(var P=0,B=x-1;(T!==0||P>>0,b[B]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");M=P,N++}if(E[N]!==" "){for(var _=x-M;_!==x&&b[_]===0;)_++;for(var S=new Uint8Array(R+(x-_)),F=R;_!==x;)S[F++]=b[_++];return S}}}function w(E){var N=y(E);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var YK=$K,JK=YK,j6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},XK=t=>new TextEncoder().encode(t),ZK=t=>new TextDecoder().decode(t),Xv=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Zv=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return H6(this,e)}},eA=class{constructor(e){this.decoders=e}or(e){return H6(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},H6=(t,e)=>new eA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),tA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Xv(e,r,n),this.decoder=new Zv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ag=({name:t,prefix:e,encode:r,decode:n})=>new tA(t,e,r,n),Bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=JK(r,e);return ag({prefix:t,name:e,encode:n,decode:s=>j6(i(s))})},ez=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},tz=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<ag({prefix:e,name:t,encode(i){return tz(i,n,r)},decode(i){return ez(i,n,r,t)}}),rz=ag({prefix:"\0",name:"identity",encode:t=>ZK(t),decode:t=>XK(t)}),nz=Object.freeze({__proto__:null,identity:rz}),iz=Mt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),sz=Object.freeze({__proto__:null,base2:iz}),oz=Mt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),az=Object.freeze({__proto__:null,base8:oz}),uz=Bl({prefix:"9",name:"base10",alphabet:"0123456789"}),cz=Object.freeze({__proto__:null,base10:uz}),lz=Mt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),fz=Mt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),hz=Object.freeze({__proto__:null,base16:lz,base16upper:fz}),dz=Mt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pz=Mt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gz=Mt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),yz=Mt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mz=Mt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wz=Mt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ez=Mt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vz=Mt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Az=Mt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_z=Object.freeze({__proto__:null,base32:dz,base32upper:pz,base32pad:gz,base32padupper:yz,base32hex:mz,base32hexupper:wz,base32hexpad:Ez,base32hexpadupper:vz,base32z:Az}),bz=Bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Iz=Bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Sz=Object.freeze({__proto__:null,base36:bz,base36upper:Iz}),Cz=Bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Tz=Bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),xz=Object.freeze({__proto__:null,base58btc:Cz,base58flickr:Tz}),Nz=Mt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Dz=Mt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Oz=Mt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Pz=Mt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Bz=Object.freeze({__proto__:null,base64:Nz,base64pad:Dz,base64url:Oz,base64urlpad:Pz}),G6=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Rz=G6.reduce((t,e,r)=>(t[r]=e,t),[]),Lz=G6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Fz(t){return t.reduce((e,r)=>(e+=Rz[r],e),"")}function Mz(t){let e=[];for(let r of t){let n=Lz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Uz=ag({prefix:"\u{1F680}",name:"base256emoji",encode:Fz,decode:Mz}),qz=Object.freeze({__proto__:null,base256emoji:Uz}),Vz=Q6,I6=128,jz=127,Hz=~jz,Gz=Math.pow(2,31);function Q6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Gz;)e[r++]=t&255|I6,t/=128;for(;t&Hz;)e[r++]=t&255|I6,t>>>=7;return e[r]=t|0,Q6.bytes=r-n+1,e}var Qz=rA,kz=128,S6=127;function rA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw rA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&S6)<=kz);return rA.bytes=s-n,r}var Kz=Math.pow(2,7),zz=Math.pow(2,14),Wz=Math.pow(2,21),$z=Math.pow(2,28),Yz=Math.pow(2,35),Jz=Math.pow(2,42),Xz=Math.pow(2,49),Zz=Math.pow(2,56),eW=Math.pow(2,63),tW=function(t){return t(k6.encode(t,e,r),e),T6=t=>k6.encodingLength(t),nA=(t,e)=>{let r=e.byteLength,n=T6(t),i=n+T6(r),s=new Uint8Array(i+r);return C6(t,s,0),C6(r,s,n),s.set(e,i),new iA(t,r,e,s)},iA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},K6=({name:t,code:e,encode:r})=>new sA(t,e,r),sA=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?nA(this.code,r):r.then(n=>nA(this.code,n))}else throw Error("Unknown type, must be binary type")}},z6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),nW=K6({name:"sha2-256",code:18,encode:z6("SHA-256")}),iW=K6({name:"sha2-512",code:19,encode:z6("SHA-512")}),sW=Object.freeze({__proto__:null,sha256:nW,sha512:iW}),W6=0,oW="identity",$6=j6,aW=t=>nA(W6,$6(t)),uW={code:W6,name:oW,encode:$6,digest:aW},cW=Object.freeze({__proto__:null,identity:uW});new TextEncoder,new TextDecoder;var x6={...nz,...sz,...az,...cz,...hz,..._z,...Sz,...xz,...Bz,...qz};({...sW,...cW});function lW(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Y6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var N6=Y6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Yv=Y6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=lW(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Xp=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=eP,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=Yp.generateKeyPair(i);return Yp.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Yp.generateKeyPair(s),a=ee.generateRandomBytes32(),u=tP;return await Yp.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=b6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let y=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(y,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return b6.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?VK.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.keychain=n||new Jp(this.core,this.logger)}get context(){return tt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(oA)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(oA,e)}return hW(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Zp=class extends Ki.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=iP,this.version=sP,this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=tt.generateChildLogger(e,this.name),this.core=r}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},aA=class extends Ki.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new go.EventEmitter,this.name=aP,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||oP,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l}},d=ee.hashMessage(i);this.queue.set(d,f);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l),this.publishTimeout),this.relayer.events.emit(Ft.publish,f)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(Ft.connection_stalled);return}this.onPublish(d,f),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return tt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,u,l,f;let d={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return ee.isUndefined((a=d.params)==null?void 0:a.prompt)&&((u=d.params)==null||delete u.prompt),ee.isUndefined((l=d.params)==null?void 0:l.tag)&&((f=d.params)==null||delete f.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(og.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},uA=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},mW=Object.defineProperty,wW=Object.defineProperties,EW=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,vW=Object.prototype.hasOwnProperty,AW=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?mW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))vW.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))AW.call(e,r)&&O6(t,r,e[r]);return t},Jv=(t,e)=>wW(t,EW(e)),eg=class extends Ki.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new uA,this.events=new go.EventEmitter,this.name=gP,this.version=yP,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ei,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new St.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=mP&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.clientId=""}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,Jv(Dl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Dl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,Dl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Vr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Vr.deleted,Jv(Dl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vr.sync)}async reset(){if(!this.cached.length)return;let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>Jv(Dl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(og.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Ft.connect,async()=>{await this.onConnect()}),this.relayer.on(Ft.disconnect,()=>{this.onDisconnect()}),this.events.on(Vr.created,async e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Vr.deleted,async e=>{let r=Vr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},_W=Object.defineProperty,P6=Object.getOwnPropertySymbols,bW=Object.prototype.hasOwnProperty,IW=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?_W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,SW=(t,e)=>{for(var r in e||(e={}))bW.call(e,r)&&B6(t,r,e[r]);if(P6)for(var r of P6(e))IW.call(e,r)&&B6(t,r,e[r]);return t},tg=class extends Ki.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new go.EventEmitter,this.name=lP,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?tt.generateChildLogger(e.logger,this.name):V6.default(tt.getDefaultLoggerOptions({level:e.logger||cP})),this.messages=new Zp(this.logger,e.core),this.subscriber=new eg(this,this.logger),this.publisher=new aA(this,this.logger),this.relayUrl=e?.relayUrl||lA,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return tt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Vr.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(Ft.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Vr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,"socket stalled").catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Ft.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Ft.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Ft.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(this.relayUrl=e||this.relayUrl,await this.transportClose(),await new Promise(r=>setTimeout(r,500)),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new jK.JsonRpcProvider(new zK.default(ee.formatRelayRpcUrl({sdkVersion:dP,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),jr.isJsonRpcRequest(e)){if(!e.method.endsWith(fP))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(SW({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ft.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=jr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(Ol.payload,e=>this.onProviderPayload(e)),this.provider.on(Ol.connect,()=>{this.events.emit(Ft.connect)}),this.provider.on(Ol.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(Ol.error,e=>{this.logger.error(e),this.events.emit(Ft.error,e)})}registerEventListeners(){this.events.on(Ft.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Ft.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},St.toMiliseconds(hP))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},CW=Object.defineProperty,R6=Object.getOwnPropertySymbols,TW=Object.prototype.hasOwnProperty,xW=Object.prototype.propertyIsEnumerable,L6=(t,e,r)=>e in t?CW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F6=(t,e)=>{for(var r in e||(e={}))TW.call(e,r)&&L6(t,r,e[r]);if(R6)for(var r of R6(e))xW.call(e,r)&&L6(t,r,e[r]);return t},rg=class extends Ki.IStore{constructor(e,r,n,i=ei,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=pP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>WK.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=F6(F6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=tt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ng=class{constructor(e,r){this.core=e,this.logger=r,this.name=wP,this.version=EP,this.events=new kK.default,this.initialized=!1,this.storagePrefix=ei,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(St.FIVE_MINUTES),o={protocol:uP},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(St.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(St.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=jr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ru[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=jr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=jr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method]?Ru[u.request.method].res:Ru.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{jr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):jr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.pairings=new rg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return tt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ft.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);jr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):jr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Tr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},ig=class extends Ki.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new go.EventEmitter,this.name=vP,this.version=AP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(qr.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=jr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(qr.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(qr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:jr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(qr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(qr.created,e=>{let r=qr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.updated,e=>{let r=qr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.deleted,e=>{let r=qr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sg=class extends Ki.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new go.EventEmitter,this.name=_P,this.version=bP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Tr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Tr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Tr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;St.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Tr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(og.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Tr.created,e=>{let r=Tr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.expired,e=>{let r=Tr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.deleted,e=>{let r=Tr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},NW=Object.defineProperty,M6=Object.getOwnPropertySymbols,DW=Object.prototype.hasOwnProperty,OW=Object.prototype.propertyIsEnumerable,U6=(t,e,r)=>e in t?NW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,q6=(t,e)=>{for(var r in e||(e={}))DW.call(e,r)&&U6(t,r,e[r]);if(M6)for(var r of M6(e))OW.call(e,r)&&U6(t,r,e[r]);return t},Lu=class extends Ki.ICore{constructor(e){super(e),this.protocol=cA,this.version=J6,this.name=ug,this.events=new go.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||lA;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:V6.default(tt.getDefaultLoggerOptions({level:e?.logger||X6.logger}));this.logger=tt.generateChildLogger(r,this.name),this.heartbeat=new og.HeartBeat,this.crypto=new Xp(this,this.logger,e?.keychain),this.history=new ig(this,this.logger),this.expirer=new sg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new KK.default(q6(q6({},Z6),e?.storageOptions)),this.relayer=new tg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ng(this,this.logger)}static async init(e){let r=new Lu(e);return await r.initialize(),r}get context(){return tt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},PW=Lu;ve.CORE_CONTEXT=ug,ve.CORE_DEFAULT=X6,ve.CORE_PROTOCOL=cA,ve.CORE_STORAGE_OPTIONS=Z6,ve.CORE_STORAGE_PREFIX=ei,ve.CORE_VERSION=J6,ve.CRYPTO_CLIENT_SEED=oA,ve.CRYPTO_CONTEXT=eP,ve.CRYPTO_JWT_TTL=tP,ve.Core=PW,ve.Crypto=Xp,ve.EXPIRER_CONTEXT=_P,ve.EXPIRER_DEFAULT_TTL=yW,ve.EXPIRER_EVENTS=Tr,ve.EXPIRER_STORAGE_VERSION=bP,ve.Expirer=sg,ve.HISTORY_CONTEXT=vP,ve.HISTORY_EVENTS=qr,ve.HISTORY_STORAGE_VERSION=AP,ve.JsonRpcHistory=ig,ve.KEYCHAIN_CONTEXT=rP,ve.KEYCHAIN_STORAGE_VERSION=nP,ve.KeyChain=Jp,ve.MESSAGES_CONTEXT=iP,ve.MESSAGES_STORAGE_VERSION=sP,ve.MessageTracker=Zp,ve.PAIRING_CONTEXT=wP,ve.PAIRING_DEFAULT_TTL=gW,ve.PAIRING_RPC_OPTS=Ru,ve.PAIRING_STORAGE_VERSION=EP,ve.PENDING_SUB_RESOLUTION_TIMEOUT=mP,ve.PUBLISHER_CONTEXT=aP,ve.PUBLISHER_DEFAULT_TTL=oP,ve.Pairing=ng,ve.RELAYER_CONTEXT=lP,ve.RELAYER_DEFAULT_LOGGER=cP,ve.RELAYER_DEFAULT_PROTOCOL=uP,ve.RELAYER_DEFAULT_RELAY_URL=lA,ve.RELAYER_EVENTS=Ft,ve.RELAYER_PROVIDER_EVENTS=Ol,ve.RELAYER_RECONNECT_TIMEOUT=hP,ve.RELAYER_SDK_VERSION=dP,ve.RELAYER_STORAGE_OPTIONS=dW,ve.RELAYER_SUBSCRIBER_SUFFIX=fP,ve.Relayer=tg,ve.STORE_STORAGE_VERSION=pP,ve.SUBSCRIBER_CONTEXT=gP,ve.SUBSCRIBER_DEFAULT_TTL=pW,ve.SUBSCRIBER_EVENTS=Vr,ve.SUBSCRIBER_STORAGE_VERSION=yP,ve.Store=rg,ve.Subscriber=eg,ve.default=Lu});var LP=v(nt=>{"use strict";c();Object.defineProperty(nt,"__esModule",{value:!0});var BW=pd(),zi=IP(),fA=PE(),TP=$E(),k=Ip(),xP=Hn(),it=to(),Ct=(Il(),rt(Kt));function NP(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var RW=NP(BW),LW=NP(xP),mA="wc",wA=2,EA="client",fg=`${mA}@${wA}:${EA}:`,cg={name:EA,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},FW={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},MW={database:":memory:"},UW={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},qW="history",VW="0.3",DP="proposal",jW=it.THIRTY_DAYS,OP="Proposal expired",PP="session",Rl=it.SEVEN_DAYS,BP="engine",Fu={wc_sessionPropose:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1104},res:{ttl:it.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1106},res:{ttl:it.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1112},res:{ttl:it.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1115}}},lg={min:it.FIVE_MINUTES,max:it.SEVEN_DAYS},RP="request",HW=Object.defineProperty,GW=Object.defineProperties,QW=Object.getOwnPropertyDescriptors,SP=Object.getOwnPropertySymbols,kW=Object.prototype.hasOwnProperty,KW=Object.prototype.propertyIsEnumerable,CP=(t,e,r)=>e in t?HW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xr=(t,e)=>{for(var r in e||(e={}))kW.call(e,r)&&CP(t,r,e[r]);if(SP)for(var r of SP(e))KW.call(e,r)&&CP(t,r,e[r]);return t},hA=(t,e)=>GW(t,QW(e)),dA=class extends TP.IEngine{constructor(e){super(e),this.name=BP,this.events=new LW.default,this.initialized=!1,this.ignoredPayloadTypes=[k.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Fu)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=hA(xr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:b,uri:T}=await this.client.core.pairing.create();l=b,f=T}let y=await this.client.core.crypto.generateKeyPair(),w=xr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:zi.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:y,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:N,done:R}=k.createDelayedPromise(it.FIVE_MINUTES,OP);if(this.events.once(k.engineEvent("session_connect"),async({error:b,session:T})=>{if(b)E(b);else if(T){T.self.publicKey=y;let P=hA(xr({},T),{requiredNamespaces:T.requiredNamespaces,optionalNamespaces:T.optionalNamespaces});await this.client.session.set(T.topic,P),await this.setExpiry(T.topic,T.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:T.peer.metadata}),N(P)}}),!l){let{message:b}=k.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(b)}let M=await this.sendRequest(l,"wc_sessionPropose",w),x=k.calcExpiry(it.FIVE_MINUTES);return await this.setProposal(M,xr({id:M,expiry:x},w)),{uri:f,approval:R}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",k.isValidObject(f)||(f=k.getRequiredNamespacesFromNamespaces(s,"approve()"));let y=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(y,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:y}),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let N=xr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:y,metadata:this.client.metadata},expiry:k.calcExpiry(Rl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest(E,"wc_sessionSettle",N);let R=hA(xr({},N),{topic:E,pairingTopic:u,acknowledged:!1,self:N.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:y});return await this.client.session.set(E,R),await this.setExpiry(E,k.calcExpiry(Rl)),{topic:E,acknowledged:()=>new Promise(M=>M(this.client.session.get(E)))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,k.calcExpiry(Rl)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=k.createDelayedPromise(o);return this.events.once(k.engineEvent("session_request",a),({error:d,result:y})=>{d?f(d):l(y)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;Ct.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):Ct.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();this.events.once(k.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",k.getSdkError("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>k.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,k.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Fu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,k.calcExpiry(n))},this.sendRequest=async(r,n,i,s)=>{let o=Ct.formatJsonRpcRequest(n,i),a=await this.client.core.crypto.encode(r,o),u=Fu[n].req;return s&&(u.ttl=s),this.client.core.history.set(r,o),this.client.core.relayer.publish(r,a,u),o.id},this.sendResult=async(r,n,i)=>{let s=Ct.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=Ct.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{k.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{k.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(xr({},n.params));let o=k.calcExpiry(it.FIVE_MINUTES),a=xr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(Ct.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else Ct.isJsonRpcError(n)&&(await this.client.proposal.delete(i,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:y,pairingTopic:w}=n.params,E=xr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},y&&{sessionProperties:y});await this.sendResult(n.id,r,!0),this.events.emit(k.engineEvent("session_connect"),{session:E})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(k.engineEvent("session_approve",i),{})):Ct.isJsonRpcError(n)&&(await this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(xr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_update",i),{}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,k.calcExpiry(Rl)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_extend",i),{}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_ping",i),{}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),this.client.core.relayer.once(zi.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(r)}),await this.sendResult(i,r,!0),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(xr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;Ct.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_request",i),{result:n.result}):Ct.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(xr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(k.isUndefined(n)||await this.isValidPairingTopic(n),!k.isValidRelays(a,!0)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!k.isUndefined(i)&&k.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!k.isUndefined(s)&&k.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=k.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!k.isValidParams(r))throw new Error(k.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=k.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=k.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!k.isValidString(s,!0)){let{message:f}=k.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!k.isValidErrorReason(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!k.isValidParams(r)){let{message:l}=k.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!k.isValidRelay(n)){let{message:l}=k.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=k.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=k.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(k.isExpired(o)){let{message:l}=k.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=k.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=k.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!k.isValidNamespacesChainId(a,s)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!k.isValidRequest(i)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!k.isValidNamespacesRequest(a,s,i.method)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!k.isValidRequestExpiry(o,lg)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${lg.min} and ${lg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!k.isValidResponse(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!k.isValidParams(r)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!k.isValidNamespacesChainId(o,s)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!k.isValidEvent(i)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!k.isValidNamespacesEvent(o,s,i.name)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!k.isValidString(i,!1)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=k.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(zi.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);Ct.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Ct.isJsonRpcResponse(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(zi.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=k.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,k.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=k.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=k.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(k.isValidString(e,!1)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!k.isValidId(e)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=k.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},pA=class extends zi.Store{constructor(e,r){super(e,r,DP,fg),this.core=e,this.logger=r}},gA=class extends zi.Store{constructor(e,r){super(e,r,PP,fg),this.core=e,this.logger=r}},yA=class extends zi.Store{constructor(e,r){super(e,r,RP,fg,n=>n.id),this.core=e,this.logger=r}},Mu=class extends TP.ISignClient{constructor(e){super(e),this.protocol=mA,this.version=wA,this.name=cg.name,this.events=new xP.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||cg.name,this.metadata=e?.metadata||k.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:RW.default(fA.getDefaultLoggerOptions({level:e?.logger||cg.logger}));this.core=e?.core||new zi.Core(e),this.logger=fA.generateChildLogger(r,this.name),this.session=new gA(this.core,this.logger),this.proposal=new pA(this.core,this.logger),this.pendingRequest=new yA(this.core,this.logger),this.engine=new dA(this)}static async init(e){let r=new Mu(e);return await r.initialize(),r}get context(){return fA.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},zW=Mu;nt.ENGINE_CONTEXT=BP,nt.ENGINE_RPC_OPTS=Fu,nt.HISTORY_CONTEXT=qW,nt.HISTORY_EVENTS=UW,nt.HISTORY_STORAGE_VERSION=VW,nt.PROPOSAL_CONTEXT=DP,nt.PROPOSAL_EXPIRY=jW,nt.PROPOSAL_EXPIRY_MESSAGE=OP,nt.REQUEST_CONTEXT=RP,nt.SESSION_CONTEXT=PP,nt.SESSION_EXPIRY=Rl,nt.SESSION_REQUEST_EXPIRY_BOUNDARIES=lg,nt.SIGN_CLIENT_CONTEXT=EA,nt.SIGN_CLIENT_DEFAULT=cg,nt.SIGN_CLIENT_EVENTS=FW,nt.SIGN_CLIENT_PROTOCOL=mA,nt.SIGN_CLIENT_STORAGE_OPTIONS=MW,nt.SIGN_CLIENT_STORAGE_PREFIX=fg,nt.SIGN_CLIENT_VERSION=wA,nt.SignClient=zW,nt.default=Mu});var vA=v(Ll=>{"use strict";c();Object.defineProperty(Ll,"__esModule",{value:!0});Ll.Operation=void 0;var WW;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage",t.SIGN_LOGIN_TOKEN="mvx_signLoginToken"})(WW=Ll.Operation||(Ll.Operation={}))});var FP=v(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.WALLETCONNECT_MULTIVERSX_METHODS=Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;var $W=vA();Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Wi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values($W.Operation)});var MP=v(hg=>{"use strict";c();Object.defineProperty(hg,"__esModule",{value:!0});hg.Logger=void 0;var AA=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};hg.Logger=AA});var UP=v(Uu=>{"use strict";c();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.Signature=Uu.Address=void 0;var _A=class{constructor(e){this.value=e}bech32(){return this.value}};Uu.Address=_A;var Fl=class{constructor(e){this.buffer=e}static fromHex(e){return new Fl(h.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Uu.Signature=Fl});var SA=v(Hr=>{"use strict";c();Object.defineProperty(Hr,"__esModule",{value:!0});Hr.WalletConnectV2ProviderErrorMessagesEnum=Hr.ErrBadAddress=Hr.ErrNotImplemented=Hr.Err=void 0;var Ml=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Hr.Err=Ml;var bA=class extends Ml{constructor(){super("Method not yet implemented")}};Hr.ErrNotImplemented=bA;var IA=class extends Ml{constructor(e,r){super(`Bad address: ${e}`,r)}};Hr.ErrBadAddress=IA;var YW;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection"})(YW=Hr.WalletConnectV2ProviderErrorMessagesEnum||(Hr.WalletConnectV2ProviderErrorMessagesEnum={}))});var VP=v(bn=>{"use strict";c();var JW=bn&&bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XW=bn&&bn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZW=bn&&bn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JW(e,t,r);return XW(e,t),e};Object.defineProperty(bn,"__esModule",{value:!0});bn.UserAddress=void 0;var e$=ZW(Tf()),qP=SA(),t$="erd",Ul=class{constructor(e){this.value=e}static fromBech32(e){let r;try{r=e$.decode(e)}catch(n){throw new qP.ErrBadAddress(e,n)}if(r.prefix!=t$)throw new qP.ErrBadAddress(e);return new Ul(e)}bech32(){return this.value}};bn.UserAddress=Ul});var Vl=v(In=>{"use strict";c();var gt=In&&In.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},r$=In&&In.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(In,"__esModule",{value:!0});In.WalletConnectV2Provider=In.WalletConnectV2ProviderErrorMessagesEnum=void 0;var n$=r$(LP()),CA=Ip(),yo=FP(),dg=vA(),Re=MP(),ql=UP(),de=SA();Object.defineProperty(In,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return de.WalletConnectV2ProviderErrorMessagesEnum}});var pg=VP(),TA=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.namespace=yo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.namespace=yo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.session=void 0}init(){return gt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let e=yield n$.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,this.isInitializing=!1,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let o=this.getConnectionParams(e);try{let a=yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},o));return this.events=(n=(r=o?.requiredNamespaces)===null||r===void 0?void 0:r[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||n===void 0?void 0:n.events,this.methods=(s=(i=o?.requiredNamespaces)===null||i===void 0?void 0:i[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||s===void 0?void 0:s.methods,a}catch{throw this.reset(),Re.Logger.error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return gt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=this.getAddressFromSession(n),{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:dg.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!s)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:s})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||this.getCurrentTopic(this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:CA.getSdkError("USER_DISCONNECTED")});else{let r=this.getCurrentTopic(this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:CA.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:dg.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new ql.Signature(n),pg.UserAddress.fromBech32(r))}catch{throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.toPlainObject(n);if(this.chainId!==e.getChainID().valueOf())throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:dg.Operation.SIGN_TRANSACTION,params:{transaction:i}}});if(!s)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(ql.Signature.fromHex(s),pg.UserAddress.fromBech32(r)),e}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(n)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:dg.Operation.SIGN_TRANSACTIONS,params:{transactions:i}}});(!s||!Array.isArray(s))&&Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(ql.Signature.fromHex(s[o].signature),pg.UserAddress.fromBech32(r));return e}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});if(!s)throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=this.getCurrentTopic(this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return gt(this,void 0,void 0,function*(){return e?this.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Re.Logger.error(`${de.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return gt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=this.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=this.getCurrentSession(e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return gt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!CA.isValidArray(f))return;for(let d of f)e.deletePairings?(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0):yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}getCurrentSession(e){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(this.getConnectionParams()).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}else if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}else throw Re.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=this.getCurrentSession(e);if(r?.topic)return r.topic;throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getConnectionParams(e){var r,n;let i=[...yo.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]],s=[`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=(n=e?.events)!==null&&n!==void 0?n:[];return{requiredNamespaces:{[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:o}}}}addressIsValid(e){try{return!!pg.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let r=e.namespaces[this.namespace];if(r&&r.accounts){let n=r.accounts[0],[i,s,o]=n.split(":");return o}return""}};In.WalletConnectV2Provider=TA});var HP=v(($ce,jP)=>{"use strict";c();jP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var kP=v((Jce,QP)=>{"use strict";c();var GP=typeof Symbol<"u"&&Symbol,i$=HP();QP.exports=function(){return typeof GP!="function"||typeof Symbol!="function"||typeof GP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:i$()}});var zP=v((Zce,KP)=>{"use strict";c();var s$="Function.prototype.bind called on incompatible ",xA=Array.prototype.slice,o$=Object.prototype.toString,a$="[object Function]";KP.exports=function(e){var r=this;if(typeof r!="function"||o$.call(r)!==a$)throw new TypeError(s$+r);for(var n=xA.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(xA.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(xA.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var u$=zP();WP.exports=Function.prototype.bind||u$});var YP=v((nle,$P)=>{"use strict";c();var c$=gg();$P.exports=c$.call(Function.call,Object.prototype.hasOwnProperty)});var wg=v((sle,t8)=>{"use strict";c();var Oe,Hu=SyntaxError,e8=Function,ju=TypeError,NA=function(t){try{return e8('"use strict"; return ('+t+").constructor;")()}catch{}},mo=Object.getOwnPropertyDescriptor;if(mo)try{mo({},"")}catch{mo=null}var DA=function(){throw new ju},l$=mo?function(){try{return arguments.callee,DA}catch{try{return mo(arguments,"callee").get}catch{return DA}}}():DA,qu=kP()(),Sn=Object.getPrototypeOf||function(t){return t.__proto__},Vu={},f$=typeof Uint8Array>"u"?Oe:Sn(Uint8Array),wo={"%AggregateError%":typeof AggregateError>"u"?Oe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Oe:ArrayBuffer,"%ArrayIteratorPrototype%":qu?Sn([][Symbol.iterator]()):Oe,"%AsyncFromSyncIteratorPrototype%":Oe,"%AsyncFunction%":Vu,"%AsyncGenerator%":Vu,"%AsyncGeneratorFunction%":Vu,"%AsyncIteratorPrototype%":Vu,"%Atomics%":typeof Atomics>"u"?Oe:Atomics,"%BigInt%":typeof BigInt>"u"?Oe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Oe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Oe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Oe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Oe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Oe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Oe:FinalizationRegistry,"%Function%":e8,"%GeneratorFunction%":Vu,"%Int8Array%":typeof Int8Array>"u"?Oe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Oe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Oe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qu?Sn(Sn([][Symbol.iterator]())):Oe,"%JSON%":typeof JSON=="object"?JSON:Oe,"%Map%":typeof Map>"u"?Oe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!qu?Oe:Sn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Oe:Promise,"%Proxy%":typeof Proxy>"u"?Oe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Oe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Oe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!qu?Oe:Sn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Oe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qu?Sn(""[Symbol.iterator]()):Oe,"%Symbol%":qu?Symbol:Oe,"%SyntaxError%":Hu,"%ThrowTypeError%":l$,"%TypedArray%":f$,"%TypeError%":ju,"%Uint8Array%":typeof Uint8Array>"u"?Oe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Oe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Oe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Oe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Oe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Oe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Oe:WeakSet};try{null.error}catch(t){JP=Sn(Sn(t)),wo["%Error.prototype%"]=JP}var JP,h$=function t(e){var r;if(e==="%AsyncFunction%")r=NA("async function () {}");else if(e==="%GeneratorFunction%")r=NA("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=NA("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&(r=Sn(i.prototype))}return wo[e]=r,r},XP={"%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"]},jl=gg(),yg=YP(),d$=jl.call(Function.call,Array.prototype.concat),p$=jl.call(Function.apply,Array.prototype.splice),ZP=jl.call(Function.call,String.prototype.replace),mg=jl.call(Function.call,String.prototype.slice),g$=jl.call(Function.call,RegExp.prototype.exec),y$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,m$=/\\(\\)?/g,w$=function(e){var r=mg(e,0,1),n=mg(e,-1);if(r==="%"&&n!=="%")throw new Hu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Hu("invalid intrinsic syntax, expected opening `%`");var i=[];return ZP(e,y$,function(s,o,a,u){i[i.length]=a?ZP(u,m$,"$1"):o||s}),i},E$=function(e,r){var n=e,i;if(yg(XP,n)&&(i=XP[n],n="%"+i[0]+"%"),yg(wo,n)){var s=wo[n];if(s===Vu&&(s=h$(n)),typeof s>"u"&&!r)throw new ju("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Hu("intrinsic "+e+" does not exist!")};t8.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new ju("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ju('"allowMissing" argument must be a boolean');if(g$(/^%?[^%]*%?$/,e)===null)throw new Hu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=w$(e),i=n.length>0?n[0]:"",s=E$("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],p$(n,d$([0,1],l)));for(var f=1,d=!0;f=n.length){var N=mo(a,y);d=!!N,d&&"get"in N&&!("originalValue"in N.get)?a=N.get:a=a[y]}else d=yg(a,y),a=a[y];d&&!u&&(wo[o]=a)}}return a}});var a8=v((ale,Eg)=>{"use strict";c();var OA=gg(),Gu=wg(),i8=Gu("%Function.prototype.apply%"),s8=Gu("%Function.prototype.call%"),o8=Gu("%Reflect.apply%",!0)||OA.call(s8,i8),r8=Gu("%Object.getOwnPropertyDescriptor%",!0),Eo=Gu("%Object.defineProperty%",!0),v$=Gu("%Math.max%");if(Eo)try{Eo({},"a",{value:1})}catch{Eo=null}Eg.exports=function(e){var r=o8(OA,s8,arguments);if(r8&&Eo){var n=r8(r,"length");n.configurable&&Eo(r,"length",{value:1+v$(0,e.length-(arguments.length-1))})}return r};var n8=function(){return o8(OA,i8,arguments)};Eo?Eo(Eg.exports,"apply",{value:n8}):Eg.exports.apply=n8});var f8=v((cle,l8)=>{"use strict";c();var u8=wg(),c8=a8(),A$=c8(u8("String.prototype.indexOf"));l8.exports=function(e,r){var n=u8(e,!!r);return typeof n=="function"&&A$(e,".prototype.")>-1?c8(n):n}});var h8=v(()=>{c()});var P8=v((ple,O8)=>{c();var jA=typeof Map=="function"&&Map.prototype,PA=Object.getOwnPropertyDescriptor&&jA?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ag=jA&&PA&&typeof PA.get=="function"?PA.get:null,d8=jA&&Map.prototype.forEach,HA=typeof Set=="function"&&Set.prototype,BA=Object.getOwnPropertyDescriptor&&HA?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_g=HA&&BA&&typeof BA.get=="function"?BA.get:null,p8=HA&&Set.prototype.forEach,_$=typeof WeakMap=="function"&&WeakMap.prototype,Gl=_$?WeakMap.prototype.has:null,b$=typeof WeakSet=="function"&&WeakSet.prototype,Ql=b$?WeakSet.prototype.has:null,I$=typeof WeakRef=="function"&&WeakRef.prototype,g8=I$?WeakRef.prototype.deref:null,S$=Boolean.prototype.valueOf,C$=Object.prototype.toString,T$=Function.prototype.toString,x$=String.prototype.match,GA=String.prototype.slice,Yi=String.prototype.replace,N$=String.prototype.toUpperCase,y8=String.prototype.toLowerCase,S8=RegExp.prototype.test,m8=Array.prototype.concat,Cn=Array.prototype.join,D$=Array.prototype.slice,w8=Math.floor,FA=typeof BigInt=="function"?BigInt.prototype.valueOf:null,RA=Object.getOwnPropertySymbols,MA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",zt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qu||"symbol")?Symbol.toStringTag:null,C8=Object.prototype.propertyIsEnumerable,E8=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function v8(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||S8.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-w8(-t):w8(t);if(n!==t){var i=String(n),s=GA.call(e,i.length+1);return Yi.call(i,r,"$&_")+"."+Yi.call(Yi.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yi.call(e,r,"$&_")}var UA=h8(),A8=UA.custom,_8=x8(A8)?A8:null;O8.exports=function t(e,r,n,i){var s=r||{};if($i(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if($i(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=$i(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if($i(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if($i(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return D8(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?v8(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?v8(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return qA(e)?"[Array]":"[Object]";var d=W$(s,n);if(typeof i>"u")i=[];else if(N8(i,e)>=0)return"[Circular]";function y(G,$,pe){if($&&(i=D$.call(i),i.push($)),pe){var ae={depth:s.depth};return $i(s,"quoteStyle")&&(ae.quoteStyle=s.quoteStyle),t(G,ae,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!b8(e)){var w=q$(e),E=vg(e,y);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Cn.call(E,", ")+" }":"")}if(x8(e)){var N=Qu?Yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):MA.call(e);return typeof e=="object"&&!Qu?Hl(N):N}if(k$(e)){for(var R="<"+y8.call(String(e.nodeName)),M=e.attributes||[],x=0;x",R}if(qA(e)){if(e.length===0)return"[]";var b=vg(e,y);return d&&!z$(b)?"["+VA(b,d)+"]":"[ "+Cn.call(b,", ")+" ]"}if(B$(e)){var T=vg(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!C8.call(e,"cause")?"{ ["+String(e)+"] "+Cn.call(m8.call("[cause]: "+y(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Cn.call(T,", ")+" }"}if(typeof e=="object"&&o){if(_8&&typeof e[_8]=="function"&&UA)return UA(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(V$(e)){var P=[];return d8&&d8.call(e,function(G,$){P.push(y($,e,!0)+" => "+y(G,e))}),I8("Map",Ag.call(e),P,d)}if(G$(e)){var B=[];return p8&&p8.call(e,function(G){B.push(y(G,e))}),I8("Set",_g.call(e),B,d)}if(j$(e))return LA("WeakMap");if(Q$(e))return LA("WeakSet");if(H$(e))return LA("WeakRef");if(L$(e))return Hl(y(Number(e)));if(M$(e))return Hl(y(FA.call(e)));if(F$(e))return Hl(S$.call(e));if(R$(e))return Hl(y(String(e)));if(!P$(e)&&!b8(e)){var _=vg(e,y),S=E8?E8(e)===Object.prototype:e instanceof Object||e.constructor===Object,F=e instanceof Object?"":"null prototype",Z=!S&&zt&&Object(e)===e&&zt in e?GA.call(Ji(e),8,-1):F?"Object":"",K=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=K+(Z||F?"["+Cn.call(m8.call([],Z||[],F||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+VA(_,d)+"}":H+"{ "+Cn.call(_,", ")+" }"}return String(e)};function T8(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function O$(t){return Yi.call(String(t),/"/g,""")}function qA(t){return Ji(t)==="[object Array]"&&(!zt||!(typeof t=="object"&&zt in t))}function P$(t){return Ji(t)==="[object Date]"&&(!zt||!(typeof t=="object"&&zt in t))}function b8(t){return Ji(t)==="[object RegExp]"&&(!zt||!(typeof t=="object"&&zt in t))}function B$(t){return Ji(t)==="[object Error]"&&(!zt||!(typeof t=="object"&&zt in t))}function R$(t){return Ji(t)==="[object String]"&&(!zt||!(typeof t=="object"&&zt in t))}function L$(t){return Ji(t)==="[object Number]"&&(!zt||!(typeof t=="object"&&zt in t))}function F$(t){return Ji(t)==="[object Boolean]"&&(!zt||!(typeof t=="object"&&zt in t))}function x8(t){if(Qu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!MA)return!1;try{return MA.call(t),!0}catch{}return!1}function M$(t){if(!t||typeof t!="object"||!FA)return!1;try{return FA.call(t),!0}catch{}return!1}var U$=Object.prototype.hasOwnProperty||function(t){return t in this};function $i(t,e){return U$.call(t,e)}function Ji(t){return C$.call(t)}function q$(t){if(t.name)return t.name;var e=x$.call(T$.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function N8(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return D8(GA.call(t,0,e.maxStringLength),e)+n}var i=Yi.call(Yi.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,K$);return T8(i,"single",e)}function K$(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+N$.call(e.toString(16))}function Hl(t){return"Object("+t+")"}function LA(t){return t+" { ? }"}function I8(t,e,r,n){var i=n?VA(r,n):Cn.call(r,", ");return t+" ("+e+") {"+i+"}"}function z$(t){for(var e=0;e=0)return!1;return!0}function W$(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Cn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Cn.call(Array(e+1),r)}}function VA(t,e){if(t.length===0)return"";var r=` + Approved: ${y.toString()}`))}),o.forEach(d=>{n||(Ui(i[d].methods,s[d].methods)?Ui(i[d].events,s[d].events)||(n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=Jn("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function LQ(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function dO(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function FQ(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:lo(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function MQ(t,e){return vp(t,!1)&&t<=e.max&&t>=e.min}Q.BASE10=fv,Q.BASE16=$t,Q.BASE64=dp,Q.COLON=B9,Q.DEFAULT_DEPTH=gv,Q.EMPTY_SPACE=pp,Q.ENV_MAP=Tu,Q.ONE_THOUSAND=R9,Q.REACT_NATIVE_PRODUCT=NO,Q.RELAYER_DEFAULT_PROTOCOL=HO,Q.SDK_TYPE=OO,Q.SLASH=DO,Q.TYPE_0=hv,Q.TYPE_1=Nu,Q.UTF8=wp,Q.appendToQueryString=RO,Q.assertType=q9,Q.buildApprovedNamespaces=yQ,Q.calcExpiry=J9,Q.capitalize=k9,Q.capitalizeWord=VO,Q.createDelayedPromise=K9,Q.createExpiringPromise=z9,Q.decodeTypeByte=El,Q.decrypt=T9,Q.deriveSymKey=b9,Q.deserialize=pv,Q.encodeTypeByte=CO,Q.encrypt=C9,Q.engineEvent=Z9,Q.enumify=Q9,Q.formatAccountId=vO,Q.formatAccountWithChain=d9,Q.formatChainId=EO,Q.formatExpirerTarget=wv,Q.formatIdTarget=$9,Q.formatMessage=E9,Q.formatMessageContext=V9,Q.formatRelayParams=GO,Q.formatRelayRpcUrl=M9,Q.formatTopicTarget=W9,Q.formatUA=MO,Q.formatUri=aQ,Q.generateKeyPair=A9,Q.generateRandomBytes32=_9,Q.getAccountsChains=lo,Q.getAccountsFromNamespaces=g9,Q.getAddressFromAccount=AO,Q.getAddressesFromAccounts=p9,Q.getAppMetadata=L9,Q.getChainFromAccount=_O,Q.getChainsFromAccounts=bO,Q.getChainsFromNamespace=yp,Q.getChainsFromNamespaces=y9,Q.getChainsFromRequiredNamespaces=m9,Q.getDidAddress=SO,Q.getDidAddressSegments=mp,Q.getDidChainId=IO,Q.getEnvironment=mv,Q.getHttpUrl=U9,Q.getInternalError=Jn,Q.getJavascriptID=FO,Q.getJavascriptOS=LO,Q.getLastItems=qO,Q.getNamespacedDidChainId=w9,Q.getNamespacesChains=QO,Q.getNamespacesEventsForChainId=KO,Q.getNamespacesMethodsForChainId=kO,Q.getRelayClientMetadata=F9,Q.getRelayProtocolApi=tQ,Q.getRelayProtocolName=eQ,Q.getRequiredNamespacesFromNamespaces=gQ,Q.getSdkError=co,Q.getUniqueValues=lv,Q.hasOverlap=Ui,Q.hashKey=I9,Q.hashMessage=S9,Q.isBrowser=BO,Q.isCaipNamespace=Ev,Q.isConformingNamespaces=r3,Q.isExpired=X9,Q.isNode=yv,Q.isProposalStruct=AQ,Q.isReactNative=PO,Q.isSessionCompatible=EQ,Q.isSessionStruct=_Q,Q.isTypeOneEnvelope=N9,Q.isUndefined=Vi,Q.isValidAccountId=WO,Q.isValidAccounts=JO,Q.isValidActions=ZO,Q.isValidArray=vl,Q.isValidChainId=Ap,Q.isValidChains=$O,Q.isValidController=bQ,Q.isValidErrorReason=xQ,Q.isValidEvent=OQ,Q.isValidId=CQ,Q.isValidNamespaceAccounts=XO,Q.isValidNamespaceActions=vv,Q.isValidNamespaceChains=YO,Q.isValidNamespaceMethodsOrEvents=av,Q.isValidNamespaces=e3,Q.isValidNamespacesChainId=PQ,Q.isValidNamespacesEvent=RQ,Q.isValidNamespacesRequest=BQ,Q.isValidNumber=vp,Q.isValidObject=Ep,Q.isValidParams=TQ,Q.isValidRelay=t3,Q.isValidRelays=SQ,Q.isValidRequest=NQ,Q.isValidRequestExpiry=MQ,Q.isValidRequiredNamespaces=IQ,Q.isValidResponse=DQ,Q.isValidString=cr,Q.isValidUrl=vQ,Q.mapEntries=G9,Q.mapToObj=H9,Q.mergeArrays=qi,Q.normalizeNamespaces=ov,Q.objToMap=j9,Q.parseAccountId=cv,Q.parseChainId=wO,Q.parseContextNames=UO,Q.parseExpirerTarget=Y9,Q.parseNamespaceKey=zO,Q.parseRelayParams=jO,Q.parseUri=oQ,Q.serialize=TO,Q.validateDecoding=x9,Q.validateEncoding=xO});var n3,i3,s3,o3,bp,Al,Av,Ip,Hi,_l,Sp=ge(()=>{c();n3="PARSE_ERROR",i3="INVALID_REQUEST",s3="METHOD_NOT_FOUND",o3="INVALID_PARAMS",bp="INTERNAL_ERROR",Al="SERVER_ERROR",Av=[-32700,-32600,-32601,-32602,-32603],Ip=[-32e3,-32099],Hi={[n3]:{code:-32700,message:"Parse error"},[i3]:{code:-32600,message:"Invalid Request"},[s3]:{code:-32601,message:"Method not found"},[o3]:{code:-32602,message:"Invalid params"},[bp]:{code:-32603,message:"Internal error"},[Al]:{code:-32e3,message:"Server error"}},_l=Al});function UQ(t){return t<=Ip[0]&&t>=Ip[1]}function Cp(t){return Av.includes(t)}function a3(t){return typeof t=="number"}function Tp(t){return Object.keys(Hi).includes(t)?Hi[t]:Hi[_l]}function xp(t){let e=Object.values(Hi).find(r=>r.code===t);return e||Hi[_l]}function qQ(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!a3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Cp(t.error.code)){let e=xp(t.error.code);if(e.message!==Hi[_l].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function _v(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var bv=ge(()=>{c();Sp()});var c3=v(ji=>{"use strict";c();Object.defineProperty(ji,"__esModule",{value:!0});ji.isBrowserCryptoAvailable=ji.getSubtleCrypto=ji.getBrowerCrypto=void 0;function Iv(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}ji.getBrowerCrypto=Iv;function u3(){let t=Iv();return t.subtle||t.webkitSubtle}ji.getSubtleCrypto=u3;function VQ(){return!!Iv()&&!!u3()}ji.isBrowserCryptoAvailable=VQ});var h3=v(Gi=>{"use strict";c();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.isBrowser=Gi.isNode=Gi.isReactNative=void 0;function l3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Gi.isReactNative=l3;function f3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}Gi.isNode=f3;function HQ(){return!l3()&&!f3()}Gi.isBrowser=HQ});var Sv=v(Np=>{"use strict";c();Object.defineProperty(Np,"__esModule",{value:!0});var d3=(ar(),nt(or));d3.__exportStar(c3(),Np);d3.__exportStar(h3(),Np)});var Ot={};at(Ot,{isNodeJs:()=>g3});var p3,g3,y3=ge(()=>{c();p3=be(Sv());Lt(Ot,be(Sv()));g3=p3.isNode});function Cv(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Tv(t=6){return BigInt(Cv(t))}function xv(t,e,r){return{id:r||Cv(),jsonrpc:"2.0",method:t,params:e}}function jQ(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Nv(t,e,r){return{id:t,jsonrpc:"2.0",error:m3(e,r)}}function m3(t,e){return typeof t>"u"?Tp(bp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Tp(Al)),{message:t})),typeof e<"u"&&(t.data=e),Cp(t.code)&&(t=xp(t.code)),t)}var w3=ge(()=>{c();bv();Sp()});function GQ(t){return t.includes("*")?Op(t):!/\W/g.test(t)}function Dp(t){return t==="*"}function Op(t){return Dp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function QQ(t){return!Dp(t)&&Op(t)&&!t.split("*")[0].trim()}function kQ(t){return!Dp(t)&&Op(t)&&!t.split("*")[1].trim()}var E3=ge(()=>{c()});var v3=ge(()=>{c()});var Du,Dv=ge(()=>{c();Du=class{}});var Ov,Pp,bl,A3=ge(()=>{c();Dv();Ov=class extends Du{constructor(e){super()}},Pp=class extends Du{constructor(){super()}},bl=class extends Pp{constructor(e){super()}}});var _3=ge(()=>{c()});var b3=ge(()=>{c();v3();Dv();A3();_3()});var I3=ge(()=>{c();b3()});function WQ(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function S3(t,e){let r=WQ(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $Q(t){return S3(t,KQ)}function Bp(t){return S3(t,zQ)}function Pv(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var KQ,zQ,C3=ge(()=>{c();KQ="^https?:",zQ="^wss?:"});function Bv(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function YQ(t){return Bv(t)&&"method"in t}function Rv(t){return Bv(t)&&(T3(t)||Rp(t))}function T3(t){return"result"in t}function Rp(t){return"error"in t}function JQ(t){return"error"in t&&t.valid===!1}var x3=ge(()=>{c()});var Kt={};at(Kt,{DEFAULT_ERROR:()=>_l,IBaseJsonRpcProvider:()=>Pp,IEvents:()=>Du,IJsonRpcConnection:()=>Ov,IJsonRpcProvider:()=>bl,INTERNAL_ERROR:()=>bp,INVALID_PARAMS:()=>o3,INVALID_REQUEST:()=>i3,METHOD_NOT_FOUND:()=>s3,PARSE_ERROR:()=>n3,RESERVED_ERROR_CODES:()=>Av,SERVER_ERROR:()=>Al,SERVER_ERROR_CODE_RANGE:()=>Ip,STANDARD_ERROR_MAP:()=>Hi,formatErrorMessage:()=>m3,formatJsonRpcError:()=>Nv,formatJsonRpcRequest:()=>xv,formatJsonRpcResult:()=>jQ,getBigIntRpcId:()=>Tv,getError:()=>Tp,getErrorByCode:()=>xp,isHttpUrl:()=>$Q,isJsonRpcError:()=>Rp,isJsonRpcPayload:()=>Bv,isJsonRpcRequest:()=>YQ,isJsonRpcResponse:()=>Rv,isJsonRpcResult:()=>T3,isJsonRpcValidationInvalid:()=>JQ,isLocalhostUrl:()=>Pv,isNodeJs:()=>g3,isReservedErrorCode:()=>Cp,isServerErrorCode:()=>UQ,isValidDefaultRoute:()=>Dp,isValidErrorCode:()=>a3,isValidLeadingWildcardRoute:()=>QQ,isValidRoute:()=>GQ,isValidTrailingWildcardRoute:()=>kQ,isValidWildcardRoute:()=>Op,isWsUrl:()=>Bp,parseConnectionError:()=>_v,payloadId:()=>Cv,validateJsonRpcError:()=>qQ});var Il=ge(()=>{c();Sp();bv();y3();Lt(Kt,Ot);w3();E3();I3();C3();x3()});var N3,Lp,D3,Lv=ge(()=>{c();N3=be(jn());Il();Lp=class extends bl{constructor(e){super(e),this.events=new N3.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(xv(e.method,e.params||[],Tv().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Rp(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Rv(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},D3=Lp});var O3={};at(O3,{JsonRpcProvider:()=>Lp,default:()=>XQ});var XQ,P3=ge(()=>{c();Lv();Lv();XQ=D3});var R3=v((mce,B3)=>{"use strict";c();B3.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var F3,L3,ZQ,ek,tk,Fp,M3,Fv=ge(()=>{c();F3=be(jn());Td();Il();L3=10,ZQ=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:R3(),ek=()=>typeof window<"u",tk=ZQ(),Fp=class{constructor(e){if(this.url=e,this.events=new F3.EventEmitter,this.registering=!1,!Bp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Zc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Bp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Kt.isReactNative)()?void 0:{rejectUnauthorized:!Pv(e)},s=new tk(e,[],i);ek()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Xc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=Nv(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return _v(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>L3&&this.events.setMaxListeners(L3)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}},M3=Fp});var U3={};at(U3,{WsConnection:()=>Fp,default:()=>rk});var rk,q3=ge(()=>{c();Fv();Fv();rk=M3});var v6=v((Sl,Pu)=>{c();var nk=200,zv="__lodash_hash_undefined__",Qp=1,J3=2,X3=9007199254740991,Mp="[object Arguments]",Vv="[object Array]",ik="[object AsyncFunction]",Z3="[object Boolean]",e6="[object Date]",t6="[object Error]",r6="[object Function]",sk="[object GeneratorFunction]",Up="[object Map]",n6="[object Number]",ok="[object Null]",Ou="[object Object]",V3="[object Promise]",ak="[object Proxy]",i6="[object RegExp]",qp="[object Set]",s6="[object String]",uk="[object Symbol]",ck="[object Undefined]",Hv="[object WeakMap]",o6="[object ArrayBuffer]",Vp="[object DataView]",lk="[object Float32Array]",fk="[object Float64Array]",hk="[object Int8Array]",dk="[object Int16Array]",pk="[object Int32Array]",gk="[object Uint8Array]",yk="[object Uint8ClampedArray]",mk="[object Uint16Array]",wk="[object Uint32Array]",Ek=/[\\^$.*+?()[\]{}|]/g,vk=/^\[object .+?Constructor\]$/,Ak=/^(?:0|[1-9]\d*)$/,Ye={};Ye[lk]=Ye[fk]=Ye[hk]=Ye[dk]=Ye[pk]=Ye[gk]=Ye[yk]=Ye[mk]=Ye[wk]=!0;Ye[Mp]=Ye[Vv]=Ye[o6]=Ye[Z3]=Ye[Vp]=Ye[e6]=Ye[t6]=Ye[r6]=Ye[Up]=Ye[n6]=Ye[Ou]=Ye[i6]=Ye[qp]=Ye[s6]=Ye[Hv]=!1;var a6=typeof global=="object"&&global&&global.Object===Object&&global,_k=typeof self=="object"&&self&&self.Object===Object&&self,Xn=a6||_k||Function("return this")(),u6=typeof Sl=="object"&&Sl&&!Sl.nodeType&&Sl,H3=u6&&typeof Pu=="object"&&Pu&&!Pu.nodeType&&Pu,c6=H3&&H3.exports===u6,Mv=c6&&a6.process,j3=function(){try{return Mv&&Mv.binding&&Mv.binding("util")}catch{}}(),G3=j3&&j3.isTypedArray;function bk(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function Zk(t,e){var r=this.__data__,n=Kp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Zn.prototype.clear=$k;Zn.prototype.delete=Yk;Zn.prototype.get=Jk;Zn.prototype.has=Xk;Zn.prototype.set=Zk;function po(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,y=r&J3?new jp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=X3}function w6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function xl(t){return t!=null&&typeof t=="object"}var E6=G3?Tk(G3):yK;function DK(t){return xK(t)?hK(t):mK(t)}function OK(){return[]}function PK(){return!1}Pu.exports=NK});var _P=v(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});var yo=jn(),BK=hd(),RK=t2(),ig=m2(),tt=DE(),Ki=zE(),A6=(Td(),nt(I2)),LK=(WN(),nt(zN)),ee=_p(),FK=(X1(),nt(J1)),It=ro(),MK=(P3(),nt(O3)),Hr=(Il(),nt(Kt)),UK=(q3(),nt(U3)),qK=v6();function Pl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function VK(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var HK=Pl(yo),U6=Pl(BK),jK=Pl(RK),Wp=VK(LK),GK=Pl(UK),QK=Pl(qK);function kK(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,O=new Uint8Array(x);_!==B;){for(var P=E[_],L=0,b=x-1;(P!==0||L>>0,O[b]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");R=L,_++}for(var C=x-R;C!==x&&O[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(B);E[T];){var O=r[E.charCodeAt(T)];if(O===255)return;for(var P=0,L=B-1;(O!==0||P<_)&&L!==-1;L--,P++)O+=a*x[L]>>>0,x[L]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");_=P,T++}if(E[T]!==" "){for(var b=B-_;b!==B&&x[b]===0;)b++;for(var C=new Uint8Array(R+(B-b)),M=R;b!==B;)C[M++]=x[b++];return C}}}function w(E){var T=y(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var KK=kK,zK=KK,q6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},WK=t=>new TextEncoder().encode(t),$K=t=>new TextDecoder().decode(t),Yv=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Jv=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return V6(this,e)}},Xv=class{constructor(e){this.decoders=e}or(e){return V6(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},V6=(t,e)=>new Xv({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Zv=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Yv(e,r,n),this.decoder=new Jv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},sg=({name:t,prefix:e,encode:r,decode:n})=>new Zv(t,e,r,n),Bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=zK(r,e);return sg({prefix:t,name:e,encode:n,decode:s=>q6(i(s))})},YK=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},JK=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<sg({prefix:e,name:t,encode(i){return JK(i,n,r)},decode(i){return YK(i,n,r,t)}}),XK=sg({prefix:"\0",name:"identity",encode:t=>$K(t),decode:t=>WK(t)}),ZK=Object.freeze({__proto__:null,identity:XK}),ez=Mt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),tz=Object.freeze({__proto__:null,base2:ez}),rz=Mt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),nz=Object.freeze({__proto__:null,base8:rz}),iz=Bl({prefix:"9",name:"base10",alphabet:"0123456789"}),sz=Object.freeze({__proto__:null,base10:iz}),oz=Mt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),az=Mt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),uz=Object.freeze({__proto__:null,base16:oz,base16upper:az}),cz=Mt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lz=Mt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fz=Mt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hz=Mt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),dz=Mt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),pz=Mt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gz=Mt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),yz=Mt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mz=Mt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),wz=Object.freeze({__proto__:null,base32:cz,base32upper:lz,base32pad:fz,base32padupper:hz,base32hex:dz,base32hexupper:pz,base32hexpad:gz,base32hexpadupper:yz,base32z:mz}),Ez=Bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vz=Bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Az=Object.freeze({__proto__:null,base36:Ez,base36upper:vz}),_z=Bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bz=Bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Iz=Object.freeze({__proto__:null,base58btc:_z,base58flickr:bz}),Sz=Mt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Cz=Mt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tz=Mt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xz=Mt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Nz=Object.freeze({__proto__:null,base64:Sz,base64pad:Cz,base64url:Tz,base64urlpad:xz}),H6=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Dz=H6.reduce((t,e,r)=>(t[r]=e,t),[]),Oz=H6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Pz(t){return t.reduce((e,r)=>(e+=Dz[r],e),"")}function Bz(t){let e=[];for(let r of t){let n=Oz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Rz=sg({prefix:"\u{1F680}",name:"base256emoji",encode:Pz,decode:Bz}),Lz=Object.freeze({__proto__:null,base256emoji:Rz}),Fz=j6,_6=128,Mz=127,Uz=~Mz,qz=Math.pow(2,31);function j6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=qz;)e[r++]=t&255|_6,t/=128;for(;t&Uz;)e[r++]=t&255|_6,t>>>=7;return e[r]=t|0,j6.bytes=r-n+1,e}var Vz=eA,Hz=128,b6=127;function eA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw eA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&b6)<=Hz);return eA.bytes=s-n,r}var jz=Math.pow(2,7),Gz=Math.pow(2,14),Qz=Math.pow(2,21),kz=Math.pow(2,28),Kz=Math.pow(2,35),zz=Math.pow(2,42),Wz=Math.pow(2,49),$z=Math.pow(2,56),Yz=Math.pow(2,63),Jz=function(t){return t(G6.encode(t,e,r),e),S6=t=>G6.encodingLength(t),tA=(t,e)=>{let r=e.byteLength,n=S6(t),i=n+S6(r),s=new Uint8Array(i+r);return I6(t,s,0),I6(r,s,n),s.set(e,i),new rA(t,r,e,s)},rA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},Q6=({name:t,code:e,encode:r})=>new nA(t,e,r),nA=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?tA(this.code,r):r.then(n=>tA(this.code,n))}else throw Error("Unknown type, must be binary type")}},k6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Zz=Q6({name:"sha2-256",code:18,encode:k6("SHA-256")}),eW=Q6({name:"sha2-512",code:19,encode:k6("SHA-512")}),tW=Object.freeze({__proto__:null,sha256:Zz,sha512:eW}),K6=0,rW="identity",z6=q6,nW=t=>tA(K6,z6(t)),iW={code:K6,name:rW,encode:z6,digest:nW},sW=Object.freeze({__proto__:null,identity:iW});new TextEncoder,new TextDecoder;var C6={...ZK,...tz,...nz,...sz,...uz,...wz,...Az,...Iz,...Nz,...Lz};({...tW,...sW});function oW(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function W6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var T6=W6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Wv=W6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=oW(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Yp=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=X6,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=Wp.generateKeyPair(i);return Wp.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Wp.generateKeyPair(s),a=ee.generateRandomBytes32(),u=Z6;return await Wp.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=A6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let y=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(y,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return A6.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?FK.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.keychain=n||new $p(this.core,this.logger)}get context(){return tt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(iA)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(iA,e)}return uW(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Jp=class extends Ki.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=rP,this.version=nP,this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=tt.generateChildLogger(e,this.name),this.core=r}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sA=class extends Ki.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new yo.EventEmitter,this.name=sP,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||iP,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l}},d=ee.hashMessage(i);this.queue.set(d,f);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l),this.publishTimeout),this.relayer.events.emit(Ft.publish,f)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(Ft.connection_stalled);return}this.onPublish(d,f),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return tt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,u,l,f;let d={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return ee.isUndefined((a=d.params)==null?void 0:a.prompt)&&((u=d.params)==null||delete u.prompt),ee.isUndefined((l=d.params)==null?void 0:l.tag)&&((f=d.params)==null||delete f.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(ig.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},oA=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},dW=Object.defineProperty,pW=Object.defineProperties,gW=Object.getOwnPropertyDescriptors,x6=Object.getOwnPropertySymbols,yW=Object.prototype.hasOwnProperty,mW=Object.prototype.propertyIsEnumerable,N6=(t,e,r)=>e in t?dW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))yW.call(e,r)&&N6(t,r,e[r]);if(x6)for(var r of x6(e))mW.call(e,r)&&N6(t,r,e[r]);return t},$v=(t,e)=>pW(t,gW(e)),Xp=class extends Ki.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new oA,this.events=new yo.EventEmitter,this.name=dP,this.version=pP,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ei,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new It.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=gP&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.clientId=""}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Ft.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,$v(Dl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Dl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,Dl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Vr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Vr.deleted,$v(Dl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vr.sync)}async reset(){if(!this.cached.length)return;let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>$v(Dl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(ig.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Ft.connect,async()=>{await this.onConnect()}),this.relayer.on(Ft.disconnect,()=>{this.onDisconnect()}),this.events.on(Vr.created,async e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Vr.deleted,async e=>{let r=Vr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},wW=Object.defineProperty,D6=Object.getOwnPropertySymbols,EW=Object.prototype.hasOwnProperty,vW=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?wW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AW=(t,e)=>{for(var r in e||(e={}))EW.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))vW.call(e,r)&&O6(t,r,e[r]);return t},Zp=class extends Ki.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new yo.EventEmitter,this.name=uP,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?tt.generateChildLogger(e.logger,this.name):U6.default(tt.getDefaultLoggerOptions({level:e.logger||aP})),this.messages=new Jp(this.logger,e.core),this.subscriber=new Xp(this,this.logger),this.publisher=new sA(this,this.logger),this.relayUrl=e?.relayUrl||uA,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return tt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Vr.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(Ft.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Vr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,"socket stalled").catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Ft.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Ft.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Ft.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(this.relayUrl=e||this.relayUrl,await this.transportClose(),await new Promise(r=>setTimeout(r,500)),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new MK.JsonRpcProvider(new GK.default(ee.formatRelayRpcUrl({sdkVersion:fP,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Hr.isJsonRpcRequest(e)){if(!e.method.endsWith(cP))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(AW({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ft.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Hr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(Ol.payload,e=>this.onProviderPayload(e)),this.provider.on(Ol.connect,()=>{this.events.emit(Ft.connect)}),this.provider.on(Ol.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(Ol.error,e=>{this.logger.error(e),this.events.emit(Ft.error,e)})}registerEventListeners(){this.events.on(Ft.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Ft.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},It.toMiliseconds(lP))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},_W=Object.defineProperty,P6=Object.getOwnPropertySymbols,bW=Object.prototype.hasOwnProperty,IW=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?_W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R6=(t,e)=>{for(var r in e||(e={}))bW.call(e,r)&&B6(t,r,e[r]);if(P6)for(var r of P6(e))IW.call(e,r)&&B6(t,r,e[r]);return t},eg=class extends Ki.IStore{constructor(e,r,n,i=ei,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=hP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>QK.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=R6(R6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=tt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},tg=class{constructor(e,r){this.core=e,this.logger=r,this.name=yP,this.version=mP,this.events=new HK.default,this.initialized=!1,this.storagePrefix=ei,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(It.FIVE_MINUTES),o={protocol:oP},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(It.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(It.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Hr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ru[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Hr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Hr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ru[u.request.method]?Ru[u.request.method].res:Ru.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{Hr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):Hr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.pairings=new eg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return tt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ft.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);Hr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Hr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Tr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},rg=class extends Ki.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new yo.EventEmitter,this.name=wP,this.version=EP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(qr.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Hr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(qr.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(qr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:Hr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(qr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(qr.created,e=>{let r=qr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.updated,e=>{let r=qr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(qr.deleted,e=>{let r=qr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ng=class extends Ki.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new yo.EventEmitter,this.name=vP,this.version=AP,this.cached=[],this.initialized=!1,this.storagePrefix=ei,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Tr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Tr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Tr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;It.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Tr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ig.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Tr.created,e=>{let r=Tr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.expired,e=>{let r=Tr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Tr.deleted,e=>{let r=Tr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},SW=Object.defineProperty,L6=Object.getOwnPropertySymbols,CW=Object.prototype.hasOwnProperty,TW=Object.prototype.propertyIsEnumerable,F6=(t,e,r)=>e in t?SW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M6=(t,e)=>{for(var r in e||(e={}))CW.call(e,r)&&F6(t,r,e[r]);if(L6)for(var r of L6(e))TW.call(e,r)&&F6(t,r,e[r]);return t},Lu=class extends Ki.ICore{constructor(e){super(e),this.protocol=aA,this.version=$6,this.name=og,this.events=new yo.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||uA;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:U6.default(tt.getDefaultLoggerOptions({level:e?.logger||Y6.logger}));this.logger=tt.generateChildLogger(r,this.name),this.heartbeat=new ig.HeartBeat,this.crypto=new Yp(this,this.logger,e?.keychain),this.history=new rg(this,this.logger),this.expirer=new ng(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new jK.default(M6(M6({},J6),e?.storageOptions)),this.relayer=new Zp({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new tg(this,this.logger)}static async init(e){let r=new Lu(e);return await r.initialize(),r}get context(){return tt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},xW=Lu;ve.CORE_CONTEXT=og,ve.CORE_DEFAULT=Y6,ve.CORE_PROTOCOL=aA,ve.CORE_STORAGE_OPTIONS=J6,ve.CORE_STORAGE_PREFIX=ei,ve.CORE_VERSION=$6,ve.CRYPTO_CLIENT_SEED=iA,ve.CRYPTO_CONTEXT=X6,ve.CRYPTO_JWT_TTL=Z6,ve.Core=xW,ve.Crypto=Yp,ve.EXPIRER_CONTEXT=vP,ve.EXPIRER_DEFAULT_TTL=hW,ve.EXPIRER_EVENTS=Tr,ve.EXPIRER_STORAGE_VERSION=AP,ve.Expirer=ng,ve.HISTORY_CONTEXT=wP,ve.HISTORY_EVENTS=qr,ve.HISTORY_STORAGE_VERSION=EP,ve.JsonRpcHistory=rg,ve.KEYCHAIN_CONTEXT=eP,ve.KEYCHAIN_STORAGE_VERSION=tP,ve.KeyChain=$p,ve.MESSAGES_CONTEXT=rP,ve.MESSAGES_STORAGE_VERSION=nP,ve.MessageTracker=Jp,ve.PAIRING_CONTEXT=yP,ve.PAIRING_DEFAULT_TTL=fW,ve.PAIRING_RPC_OPTS=Ru,ve.PAIRING_STORAGE_VERSION=mP,ve.PENDING_SUB_RESOLUTION_TIMEOUT=gP,ve.PUBLISHER_CONTEXT=sP,ve.PUBLISHER_DEFAULT_TTL=iP,ve.Pairing=tg,ve.RELAYER_CONTEXT=uP,ve.RELAYER_DEFAULT_LOGGER=aP,ve.RELAYER_DEFAULT_PROTOCOL=oP,ve.RELAYER_DEFAULT_RELAY_URL=uA,ve.RELAYER_EVENTS=Ft,ve.RELAYER_PROVIDER_EVENTS=Ol,ve.RELAYER_RECONNECT_TIMEOUT=lP,ve.RELAYER_SDK_VERSION=fP,ve.RELAYER_STORAGE_OPTIONS=cW,ve.RELAYER_SUBSCRIBER_SUFFIX=cP,ve.Relayer=Zp,ve.STORE_STORAGE_VERSION=hP,ve.SUBSCRIBER_CONTEXT=dP,ve.SUBSCRIBER_DEFAULT_TTL=lW,ve.SUBSCRIBER_EVENTS=Vr,ve.SUBSCRIBER_STORAGE_VERSION=pP,ve.Store=eg,ve.Subscriber=Xp,ve.default=Lu});var BP=v(it=>{"use strict";c();Object.defineProperty(it,"__esModule",{value:!0});var NW=hd(),zi=_P(),cA=DE(),SP=zE(),k=_p(),CP=jn(),st=ro(),St=(Il(),nt(Kt));function TP(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var DW=TP(NW),OW=TP(CP),gA="wc",yA=2,mA="client",cg=`${gA}@${yA}:${mA}:`,ag={name:mA,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},PW={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},BW={database:":memory:"},RW={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},LW="history",FW="0.3",xP="proposal",MW=st.THIRTY_DAYS,NP="Proposal expired",DP="session",Rl=st.SEVEN_DAYS,OP="engine",Fu={wc_sessionPropose:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1104},res:{ttl:st.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1106},res:{ttl:st.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1112},res:{ttl:st.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1115}}},ug={min:st.FIVE_MINUTES,max:st.SEVEN_DAYS},PP="request",UW=Object.defineProperty,qW=Object.defineProperties,VW=Object.getOwnPropertyDescriptors,bP=Object.getOwnPropertySymbols,HW=Object.prototype.hasOwnProperty,jW=Object.prototype.propertyIsEnumerable,IP=(t,e,r)=>e in t?UW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xr=(t,e)=>{for(var r in e||(e={}))HW.call(e,r)&&IP(t,r,e[r]);if(bP)for(var r of bP(e))jW.call(e,r)&&IP(t,r,e[r]);return t},lA=(t,e)=>qW(t,VW(e)),fA=class extends SP.IEngine{constructor(e){super(e),this.name=OP,this.events=new OW.default,this.initialized=!1,this.ignoredPayloadTypes=[k.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Fu)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=lA(xr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:x,uri:O}=await this.client.core.pairing.create();l=x,f=O}let y=await this.client.core.crypto.generateKeyPair(),w=xr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:zi.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:y,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:T,done:R}=k.createDelayedPromise(st.FIVE_MINUTES,NP);if(this.events.once(k.engineEvent("session_connect"),async({error:x,session:O})=>{if(x)E(x);else if(O){O.self.publicKey=y;let P=lA(xr({},O),{requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces});await this.client.session.set(O.topic,P),await this.setExpiry(O.topic,O.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:O.peer.metadata}),T(P)}}),!l){let{message:x}=k.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(x)}let _=await this.sendRequest(l,"wc_sessionPropose",w),B=k.calcExpiry(st.FIVE_MINUTES);return await this.setProposal(_,xr({id:_,expiry:B},w)),{uri:f,approval:R}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",k.isValidObject(f)||(f=k.getRequiredNamespacesFromNamespaces(s,"approve()"));let y=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(y,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:y}),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=xr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:y,metadata:this.client.metadata},expiry:k.calcExpiry(Rl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest(E,"wc_sessionSettle",T);let R=lA(xr({},T),{topic:E,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:y});return await this.client.session.set(E,R),await this.setExpiry(E,k.calcExpiry(Rl)),{topic:E,acknowledged:()=>new Promise(_=>_(this.client.session.get(E)))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,k.calcExpiry(Rl)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=k.createDelayedPromise(o);return this.events.once(k.engineEvent("session_request",a),({error:d,result:y})=>{d?f(d):l(y)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;St.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):St.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();this.events.once(k.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",k.getSdkError("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>k.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,k.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Fu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,k.calcExpiry(n))},this.sendRequest=async(r,n,i,s)=>{let o=St.formatJsonRpcRequest(n,i),a=await this.client.core.crypto.encode(r,o),u=Fu[n].req;return s&&(u.ttl=s),this.client.core.history.set(r,o),this.client.core.relayer.publish(r,a,u),o.id},this.sendResult=async(r,n,i)=>{let s=St.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=St.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Fu[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{k.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{k.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(xr({},n.params));let o=k.calcExpiry(st.FIVE_MINUTES),a=xr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(St.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else St.isJsonRpcError(n)&&(await this.client.proposal.delete(i,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:y,pairingTopic:w}=n.params,E=xr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},y&&{sessionProperties:y});await this.sendResult(n.id,r,!0),this.events.emit(k.engineEvent("session_connect"),{session:E})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(k.engineEvent("session_approve",i),{})):St.isJsonRpcError(n)&&(await this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(xr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_update",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,k.calcExpiry(Rl)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_extend",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_ping",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),this.client.core.relayer.once(zi.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(r)}),await this.sendResult(i,r,!0),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(xr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_request",i),{result:n.result}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(xr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(k.isUndefined(n)||await this.isValidPairingTopic(n),!k.isValidRelays(a,!0)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!k.isUndefined(i)&&k.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!k.isUndefined(s)&&k.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=k.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!k.isValidParams(r))throw new Error(k.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=k.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=k.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!k.isValidString(s,!0)){let{message:f}=k.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!k.isValidErrorReason(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!k.isValidParams(r)){let{message:l}=k.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!k.isValidRelay(n)){let{message:l}=k.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=k.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=k.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(k.isExpired(o)){let{message:l}=k.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=k.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=k.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!k.isValidNamespacesChainId(a,s)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!k.isValidRequest(i)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!k.isValidNamespacesRequest(a,s,i.method)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!k.isValidRequestExpiry(o,ug)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ug.min} and ${ug.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!k.isValidResponse(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!k.isValidParams(r)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!k.isValidNamespacesChainId(o,s)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!k.isValidEvent(i)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!k.isValidNamespacesEvent(o,s,i.name)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!k.isValidString(i,!1)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=k.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(zi.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);St.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):St.isJsonRpcResponse(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(zi.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=k.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,k.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=k.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=k.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(k.isValidString(e,!1)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!k.isValidId(e)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=k.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},hA=class extends zi.Store{constructor(e,r){super(e,r,xP,cg),this.core=e,this.logger=r}},dA=class extends zi.Store{constructor(e,r){super(e,r,DP,cg),this.core=e,this.logger=r}},pA=class extends zi.Store{constructor(e,r){super(e,r,PP,cg,n=>n.id),this.core=e,this.logger=r}},Mu=class extends SP.ISignClient{constructor(e){super(e),this.protocol=gA,this.version=yA,this.name=ag.name,this.events=new CP.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||ag.name,this.metadata=e?.metadata||k.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:DW.default(cA.getDefaultLoggerOptions({level:e?.logger||ag.logger}));this.core=e?.core||new zi.Core(e),this.logger=cA.generateChildLogger(r,this.name),this.session=new dA(this.core,this.logger),this.proposal=new hA(this.core,this.logger),this.pendingRequest=new pA(this.core,this.logger),this.engine=new fA(this)}static async init(e){let r=new Mu(e);return await r.initialize(),r}get context(){return cA.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},GW=Mu;it.ENGINE_CONTEXT=OP,it.ENGINE_RPC_OPTS=Fu,it.HISTORY_CONTEXT=LW,it.HISTORY_EVENTS=RW,it.HISTORY_STORAGE_VERSION=FW,it.PROPOSAL_CONTEXT=xP,it.PROPOSAL_EXPIRY=MW,it.PROPOSAL_EXPIRY_MESSAGE=NP,it.REQUEST_CONTEXT=PP,it.SESSION_CONTEXT=DP,it.SESSION_EXPIRY=Rl,it.SESSION_REQUEST_EXPIRY_BOUNDARIES=ug,it.SIGN_CLIENT_CONTEXT=mA,it.SIGN_CLIENT_DEFAULT=ag,it.SIGN_CLIENT_EVENTS=PW,it.SIGN_CLIENT_PROTOCOL=gA,it.SIGN_CLIENT_STORAGE_OPTIONS=BW,it.SIGN_CLIENT_STORAGE_PREFIX=cg,it.SIGN_CLIENT_VERSION=yA,it.SignClient=GW,it.default=Mu});var wA=v(Ll=>{"use strict";c();Object.defineProperty(Ll,"__esModule",{value:!0});Ll.Operation=void 0;var QW;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage",t.SIGN_LOGIN_TOKEN="mvx_signLoginToken"})(QW=Ll.Operation||(Ll.Operation={}))});var RP=v(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.WALLETCONNECT_MULTIVERSX_METHODS=Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;var kW=wA();Wi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Wi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(kW.Operation)});var LP=v(lg=>{"use strict";c();Object.defineProperty(lg,"__esModule",{value:!0});lg.Logger=void 0;var EA=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};lg.Logger=EA});var FP=v(Uu=>{"use strict";c();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.Signature=Uu.Address=void 0;var vA=class{constructor(e){this.value=e}bech32(){return this.value}};Uu.Address=vA;var Fl=class{constructor(e){this.buffer=e}static fromHex(e){return new Fl(h.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Uu.Signature=Fl});var bA=v(jr=>{"use strict";c();Object.defineProperty(jr,"__esModule",{value:!0});jr.WalletConnectV2ProviderErrorMessagesEnum=jr.ErrBadAddress=jr.ErrNotImplemented=jr.Err=void 0;var Ml=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};jr.Err=Ml;var AA=class extends Ml{constructor(){super("Method not yet implemented")}};jr.ErrNotImplemented=AA;var _A=class extends Ml{constructor(e,r){super(`Bad address: ${e}`,r)}};jr.ErrBadAddress=_A;var KW;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection"})(KW=jr.WalletConnectV2ProviderErrorMessagesEnum||(jr.WalletConnectV2ProviderErrorMessagesEnum={}))});var UP=v(bn=>{"use strict";c();var zW=bn&&bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WW=bn&&bn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$W=bn&&bn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zW(e,t,r);return WW(e,t),e};Object.defineProperty(bn,"__esModule",{value:!0});bn.UserAddress=void 0;var YW=$W(Cf()),MP=bA(),JW="erd",Ul=class{constructor(e){this.value=e}static fromBech32(e){let r;try{r=YW.decode(e)}catch(n){throw new MP.ErrBadAddress(e,n)}if(r.prefix!=JW)throw new MP.ErrBadAddress(e);return new Ul(e)}bech32(){return this.value}};bn.UserAddress=Ul});var Vl=v(In=>{"use strict";c();var gt=In&&In.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},XW=In&&In.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(In,"__esModule",{value:!0});In.WalletConnectV2Provider=In.WalletConnectV2ProviderErrorMessagesEnum=void 0;var ZW=XW(BP()),IA=_p(),mo=RP(),fg=wA(),Re=LP(),ql=FP(),he=bA();Object.defineProperty(In,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return he.WalletConnectV2ProviderErrorMessagesEnum}});var hg=UP(),SA=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.namespace=mo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.namespace=mo.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.session=void 0}init(){return gt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let e=yield ZW.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,this.isInitializing=!1,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let o=this.getConnectionParams(e);try{let a=yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},o));return this.events=(n=(r=o?.requiredNamespaces)===null||r===void 0?void 0:r[mo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||n===void 0?void 0:n.events,this.methods=(s=(i=o?.requiredNamespaces)===null||i===void 0?void 0:i[mo.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||s===void 0?void 0:s.methods,a}catch{throw this.reset(),Re.Logger.error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return gt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=this.getAddressFromSession(n),{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:fg.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!s)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:s})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||this.getCurrentTopic(this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:IA.getSdkError("USER_DISCONNECTED")});else{let r=this.getCurrentTopic(this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:IA.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:fg.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new ql.Signature(n),hg.UserAddress.fromBech32(r))}catch{throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.toPlainObject(n);if(this.chainId!==e.getChainID().valueOf())throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:fg.Operation.SIGN_TRANSACTION,params:{transaction:i}}});if(!s)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(ql.Signature.fromHex(s),hg.UserAddress.fromBech32(r)),e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ql.Address(r),i=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(n)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:fg.Operation.SIGN_TRANSACTIONS,params:{transactions:i}}});(!s||!Array.isArray(s))&&Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(ql.Signature.fromHex(s[o].signature),hg.UserAddress.fromBech32(r));return e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});if(!s)throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=this.getCurrentTopic(this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return gt(this,void 0,void 0,function*(){return e?this.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Re.Logger.error(`${he.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return gt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=this.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=this.getCurrentSession(e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return gt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!IA.isValidArray(f))return;for(let d of f)e.deletePairings?(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0):yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}getCurrentSession(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(this.getConnectionParams()).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}else if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}else throw Re.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=this.getCurrentSession(e);if(r?.topic)return r.topic;throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getConnectionParams(e){var r,n;let i=[...mo.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]],s=[`${mo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=(n=e?.events)!==null&&n!==void 0?n:[];return{requiredNamespaces:{[mo.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:o}}}}addressIsValid(e){try{return!!hg.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let r=e.namespaces[this.namespace];if(r&&r.accounts){let n=r.accounts[0],[i,s,o]=n.split(":");return o}return""}};In.WalletConnectV2Provider=SA});var VP=v((kce,qP)=>{"use strict";c();qP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var GP=v((zce,jP)=>{"use strict";c();var HP=typeof Symbol<"u"&&Symbol,e$=VP();jP.exports=function(){return typeof HP!="function"||typeof Symbol!="function"||typeof HP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e$()}});var kP=v(($ce,QP)=>{"use strict";c();var t$="Function.prototype.bind called on incompatible ",CA=Array.prototype.slice,r$=Object.prototype.toString,n$="[object Function]";QP.exports=function(e){var r=this;if(typeof r!="function"||r$.call(r)!==n$)throw new TypeError(t$+r);for(var n=CA.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(CA.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(CA.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var i$=kP();KP.exports=Function.prototype.bind||i$});var WP=v((Zce,zP)=>{"use strict";c();var s$=dg();zP.exports=s$.call(Function.call,Object.prototype.hasOwnProperty)});var yg=v((tle,ZP)=>{"use strict";c();var Oe,ju=SyntaxError,XP=Function,Hu=TypeError,TA=function(t){try{return XP('"use strict"; return ('+t+").constructor;")()}catch{}},wo=Object.getOwnPropertyDescriptor;if(wo)try{wo({},"")}catch{wo=null}var xA=function(){throw new Hu},o$=wo?function(){try{return arguments.callee,xA}catch{try{return wo(arguments,"callee").get}catch{return xA}}}():xA,qu=GP()(),Sn=Object.getPrototypeOf||function(t){return t.__proto__},Vu={},a$=typeof Uint8Array>"u"?Oe:Sn(Uint8Array),Eo={"%AggregateError%":typeof AggregateError>"u"?Oe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Oe:ArrayBuffer,"%ArrayIteratorPrototype%":qu?Sn([][Symbol.iterator]()):Oe,"%AsyncFromSyncIteratorPrototype%":Oe,"%AsyncFunction%":Vu,"%AsyncGenerator%":Vu,"%AsyncGeneratorFunction%":Vu,"%AsyncIteratorPrototype%":Vu,"%Atomics%":typeof Atomics>"u"?Oe:Atomics,"%BigInt%":typeof BigInt>"u"?Oe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Oe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Oe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Oe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Oe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Oe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Oe:FinalizationRegistry,"%Function%":XP,"%GeneratorFunction%":Vu,"%Int8Array%":typeof Int8Array>"u"?Oe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Oe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Oe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qu?Sn(Sn([][Symbol.iterator]())):Oe,"%JSON%":typeof JSON=="object"?JSON:Oe,"%Map%":typeof Map>"u"?Oe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!qu?Oe:Sn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Oe:Promise,"%Proxy%":typeof Proxy>"u"?Oe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Oe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Oe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!qu?Oe:Sn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Oe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qu?Sn(""[Symbol.iterator]()):Oe,"%Symbol%":qu?Symbol:Oe,"%SyntaxError%":ju,"%ThrowTypeError%":o$,"%TypedArray%":a$,"%TypeError%":Hu,"%Uint8Array%":typeof Uint8Array>"u"?Oe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Oe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Oe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Oe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Oe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Oe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Oe:WeakSet};try{null.error}catch(t){$P=Sn(Sn(t)),Eo["%Error.prototype%"]=$P}var $P,u$=function t(e){var r;if(e==="%AsyncFunction%")r=TA("async function () {}");else if(e==="%GeneratorFunction%")r=TA("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=TA("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&(r=Sn(i.prototype))}return Eo[e]=r,r},YP={"%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"]},Hl=dg(),pg=WP(),c$=Hl.call(Function.call,Array.prototype.concat),l$=Hl.call(Function.apply,Array.prototype.splice),JP=Hl.call(Function.call,String.prototype.replace),gg=Hl.call(Function.call,String.prototype.slice),f$=Hl.call(Function.call,RegExp.prototype.exec),h$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,d$=/\\(\\)?/g,p$=function(e){var r=gg(e,0,1),n=gg(e,-1);if(r==="%"&&n!=="%")throw new ju("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new ju("invalid intrinsic syntax, expected opening `%`");var i=[];return JP(e,h$,function(s,o,a,u){i[i.length]=a?JP(u,d$,"$1"):o||s}),i},g$=function(e,r){var n=e,i;if(pg(YP,n)&&(i=YP[n],n="%"+i[0]+"%"),pg(Eo,n)){var s=Eo[n];if(s===Vu&&(s=u$(n)),typeof s>"u"&&!r)throw new Hu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new ju("intrinsic "+e+" does not exist!")};ZP.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Hu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Hu('"allowMissing" argument must be a boolean');if(f$(/^%?[^%]*%?$/,e)===null)throw new ju("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=p$(e),i=n.length>0?n[0]:"",s=g$("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],l$(n,c$([0,1],l)));for(var f=1,d=!0;f=n.length){var T=wo(a,y);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[y]}else d=pg(a,y),a=a[y];d&&!u&&(Eo[o]=a)}}return a}});var s8=v((nle,mg)=>{"use strict";c();var NA=dg(),Gu=yg(),r8=Gu("%Function.prototype.apply%"),n8=Gu("%Function.prototype.call%"),i8=Gu("%Reflect.apply%",!0)||NA.call(n8,r8),e8=Gu("%Object.getOwnPropertyDescriptor%",!0),vo=Gu("%Object.defineProperty%",!0),y$=Gu("%Math.max%");if(vo)try{vo({},"a",{value:1})}catch{vo=null}mg.exports=function(e){var r=i8(NA,n8,arguments);if(e8&&vo){var n=e8(r,"length");n.configurable&&vo(r,"length",{value:1+y$(0,e.length-(arguments.length-1))})}return r};var t8=function(){return i8(NA,r8,arguments)};vo?vo(mg.exports,"apply",{value:t8}):mg.exports.apply=t8});var c8=v((sle,u8)=>{"use strict";c();var o8=yg(),a8=s8(),m$=a8(o8("String.prototype.indexOf"));u8.exports=function(e,r){var n=o8(e,!!r);return typeof n=="function"&&m$(e,".prototype.")>-1?a8(n):n}});var l8=v(()=>{c()});var D8=v((lle,N8)=>{c();var qA=typeof Map=="function"&&Map.prototype,DA=Object.getOwnPropertyDescriptor&&qA?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Eg=qA&&DA&&typeof DA.get=="function"?DA.get:null,f8=qA&&Map.prototype.forEach,VA=typeof Set=="function"&&Set.prototype,OA=Object.getOwnPropertyDescriptor&&VA?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,vg=VA&&OA&&typeof OA.get=="function"?OA.get:null,h8=VA&&Set.prototype.forEach,w$=typeof WeakMap=="function"&&WeakMap.prototype,Gl=w$?WeakMap.prototype.has:null,E$=typeof WeakSet=="function"&&WeakSet.prototype,Ql=E$?WeakSet.prototype.has:null,v$=typeof WeakRef=="function"&&WeakRef.prototype,d8=v$?WeakRef.prototype.deref:null,A$=Boolean.prototype.valueOf,_$=Object.prototype.toString,b$=Function.prototype.toString,I$=String.prototype.match,HA=String.prototype.slice,Yi=String.prototype.replace,S$=String.prototype.toUpperCase,p8=String.prototype.toLowerCase,b8=RegExp.prototype.test,g8=Array.prototype.concat,Cn=Array.prototype.join,C$=Array.prototype.slice,y8=Math.floor,RA=typeof BigInt=="function"?BigInt.prototype.valueOf:null,PA=Object.getOwnPropertySymbols,LA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",zt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qu||"symbol")?Symbol.toStringTag:null,I8=Object.prototype.propertyIsEnumerable,m8=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function w8(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||b8.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-y8(-t):y8(t);if(n!==t){var i=String(n),s=HA.call(e,i.length+1);return Yi.call(i,r,"$&_")+"."+Yi.call(Yi.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yi.call(e,r,"$&_")}var FA=l8(),E8=FA.custom,v8=C8(E8)?E8:null;N8.exports=function t(e,r,n,i){var s=r||{};if($i(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if($i(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=$i(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if($i(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if($i(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return x8(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?w8(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?w8(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return MA(e)?"[Array]":"[Object]";var d=Q$(s,n);if(typeof i>"u")i=[];else if(T8(i,e)>=0)return"[Circular]";function y(G,$,de){if($&&(i=C$.call(i),i.push($)),de){var ae={depth:s.depth};return $i(s,"quoteStyle")&&(ae.quoteStyle=s.quoteStyle),t(G,ae,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!A8(e)){var w=L$(e),E=wg(e,y);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Cn.call(E,", ")+" }":"")}if(C8(e)){var T=Qu?Yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):LA.call(e);return typeof e=="object"&&!Qu?jl(T):T}if(H$(e)){for(var R="<"+p8.call(String(e.nodeName)),_=e.attributes||[],B=0;B<_.length;B++)R+=" "+_[B].name+"="+S8(T$(_[B].value),"double",s);return R+=">",e.childNodes&&e.childNodes.length&&(R+="..."),R+="",R}if(MA(e)){if(e.length===0)return"[]";var x=wg(e,y);return d&&!G$(x)?"["+UA(x,d)+"]":"[ "+Cn.call(x,", ")+" ]"}if(N$(e)){var O=wg(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!I8.call(e,"cause")?"{ ["+String(e)+"] "+Cn.call(g8.call("[cause]: "+y(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Cn.call(O,", ")+" }"}if(typeof e=="object"&&o){if(v8&&typeof e[v8]=="function"&&FA)return FA(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(F$(e)){var P=[];return f8&&f8.call(e,function(G,$){P.push(y($,e,!0)+" => "+y(G,e))}),_8("Map",Eg.call(e),P,d)}if(q$(e)){var L=[];return h8&&h8.call(e,function(G){L.push(y(G,e))}),_8("Set",vg.call(e),L,d)}if(M$(e))return BA("WeakMap");if(V$(e))return BA("WeakSet");if(U$(e))return BA("WeakRef");if(O$(e))return jl(y(Number(e)));if(B$(e))return jl(y(RA.call(e)));if(P$(e))return jl(A$.call(e));if(D$(e))return jl(y(String(e)));if(!x$(e)&&!A8(e)){var b=wg(e,y),C=m8?m8(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",Z=!C&&zt&&Object(e)===e&&zt in e?HA.call(Ji(e),8,-1):M?"Object":"",K=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=K+(Z||M?"["+Cn.call(g8.call([],Z||[],M||[]),": ")+"] ":"");return b.length===0?j+"{}":d?j+"{"+UA(b,d)+"}":j+"{ "+Cn.call(b,", ")+" }"}return String(e)};function S8(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function T$(t){return Yi.call(String(t),/"/g,""")}function MA(t){return Ji(t)==="[object Array]"&&(!zt||!(typeof t=="object"&&zt in t))}function x$(t){return Ji(t)==="[object Date]"&&(!zt||!(typeof t=="object"&&zt in t))}function A8(t){return Ji(t)==="[object RegExp]"&&(!zt||!(typeof t=="object"&&zt in t))}function N$(t){return Ji(t)==="[object Error]"&&(!zt||!(typeof t=="object"&&zt in t))}function D$(t){return Ji(t)==="[object String]"&&(!zt||!(typeof t=="object"&&zt in t))}function O$(t){return Ji(t)==="[object Number]"&&(!zt||!(typeof t=="object"&&zt in t))}function P$(t){return Ji(t)==="[object Boolean]"&&(!zt||!(typeof t=="object"&&zt in t))}function C8(t){if(Qu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!LA)return!1;try{return LA.call(t),!0}catch{}return!1}function B$(t){if(!t||typeof t!="object"||!RA)return!1;try{return RA.call(t),!0}catch{}return!1}var R$=Object.prototype.hasOwnProperty||function(t){return t in this};function $i(t,e){return R$.call(t,e)}function Ji(t){return _$.call(t)}function L$(t){if(t.name)return t.name;var e=I$.call(b$.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function T8(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return x8(HA.call(t,0,e.maxStringLength),e)+n}var i=Yi.call(Yi.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,j$);return S8(i,"single",e)}function j$(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+S$.call(e.toString(16))}function jl(t){return"Object("+t+")"}function BA(t){return t+" { ? }"}function _8(t,e,r,n){var i=n?UA(r,n):Cn.call(r,", ");return t+" ("+e+") {"+i+"}"}function G$(t){for(var e=0;e=0)return!1;return!0}function Q$(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Cn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Cn.call(Array(e+1),r)}}function UA(t,e){if(t.length===0)return"";var r=` `+e.prev+e.base;return r+Cn.call(t,","+r)+` -`+e.prev}function vg(t,e){var r=qA(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var QA=wg(),ku=f8(),$$=P8(),Y$=QA("%TypeError%"),bg=QA("%WeakMap%",!0),Ig=QA("%Map%",!0),J$=ku("WeakMap.prototype.get",!0),X$=ku("WeakMap.prototype.set",!0),Z$=ku("WeakMap.prototype.has",!0),eY=ku("Map.prototype.get",!0),tY=ku("Map.prototype.set",!0),rY=ku("Map.prototype.has",!0),kA=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},nY=function(t,e){var r=kA(t,e);return r&&r.value},iY=function(t,e,r){var n=kA(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},sY=function(t,e){return!!kA(t,e)};B8.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Y$("Side channel does not contain "+$$(s))},get:function(s){if(bg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return J$(e,s)}else if(Ig){if(r)return eY(r,s)}else if(n)return nY(n,s)},has:function(s){if(bg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Z$(e,s)}else if(Ig){if(r)return rY(r,s)}else if(n)return sY(n,s);return!1},set:function(s,o){bg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new bg),X$(e,s,o)):Ig?(r||(r=new Ig),tY(r,s,o)):(n||(n={key:{},next:null}),iY(n,s,o))}};return i}});var Sg=v((wle,L8)=>{"use strict";c();var oY=String.prototype.replace,aY=/%20/g,KA={RFC1738:"RFC1738",RFC3986:"RFC3986"};L8.exports={default:KA.RFC3986,formatters:{RFC1738:function(t){return oY.call(t,aY,"+")},RFC3986:function(t){return String(t)}},RFC1738:KA.RFC1738,RFC3986:KA.RFC3986}});var WA=v((vle,M8)=>{"use strict";c();var uY=Sg(),zA=Object.prototype.hasOwnProperty,vo=Array.isArray,Tn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),cY=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(vo(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===uY.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Tn[l];continue}if(l<2048){a=a+(Tn[192|l>>6]+Tn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Tn[224|l>>12]+Tn[128|l>>6&63]+Tn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Tn[240|l>>18]+Tn[128|l>>12&63]+Tn[128|l>>6&63]+Tn[128|l&63]}return a},pY=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var V8=R8(),YA=WA(),kl=Sg(),EY=Object.prototype.hasOwnProperty,U8={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ao=Array.isArray,vY=String.prototype.split,AY=Array.prototype.push,j8=function(t,e){AY.apply(t,Ao(e)?e:[e])},_Y=Date.prototype.toISOString,q8=kl.default,Ut={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:YA.encode,encodeValuesOnly:!1,format:q8,formatter:kl.formatters[q8],indices:!1,serializeDate:function(e){return _Y.call(e)},skipNulls:!1,strictNullHandling:!1},bY=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},$A={},IY=function t(e,r,n,i,s,o,a,u,l,f,d,y,w,E,N){for(var R=e,M=N,x=0,b=!1;(M=M.get($A))!==void 0&&!b;){var T=M.get(e);if(x+=1,typeof T<"u"){if(T===x)throw new RangeError("Cyclic object value");b=!0}typeof M.get($A)>"u"&&(x=0)}if(typeof a=="function"?R=a(r,R):R instanceof Date?R=f(R):n==="comma"&&Ao(R)&&(R=YA.maybeMap(R,function(re){return re instanceof Date?f(re):re})),R===null){if(i)return o&&!w?o(r,Ut.encoder,E,"key",d):r;R=""}if(bY(R)||YA.isBuffer(R)){if(o){var P=w?r:o(r,Ut.encoder,E,"key",d);if(n==="comma"&&w){for(var B=vY.call(String(R),","),_="",S=0;S"u")return F;var Z;if(n==="comma"&&Ao(R))Z=[{value:R.length>0?R.join(",")||null:void 0}];else if(Ao(a))Z=a;else{var K=Object.keys(R);Z=u?K.sort(u):K}for(var H=0;H"u"?Ut.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,delimiter:typeof e.delimiter>"u"?Ut.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Ut.encode,encoder:typeof e.encoder=="function"?e.encoder:Ut.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Ut.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Ut.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Ut.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};H8.exports=function(t,e){var r=t,n=SY(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Ao(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in U8?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=U8[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=V8(),f=0;f0?w+y:""}});var K8=v((Ile,k8)=>{"use strict";c();var Ku=WA(),JA=Object.prototype.hasOwnProperty,CY=Array.isArray,Pt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ku.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},TY=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Q8=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},xY="utf8=%26%2310003%3B",NY="utf8=%E2%9C%93",DY=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=CY(E)?[E]:E),JA.call(n,w)?n[w]=Ku.combine(n[w],E):n[w]=E}return n},OY=function(t,e,r,n){for(var i=n?e:Q8(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},PY=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&JA.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Pt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Pt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Pt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Pt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Pt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Pt.comma,decoder:typeof e.decoder=="function"?e.decoder:Pt.decoder,delimiter:typeof e.delimiter=="string"||Ku.isRegExp(e.delimiter)?e.delimiter:Pt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Pt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Pt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Pt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Pt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}};k8.exports=function(t,e){var r=BY(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?DY(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var RY=G8(),LY=K8(),FY=Sg();z8.exports={formats:FY,parse:LY,stringify:RY}});var XA=v(lt=>{"use strict";c();Object.defineProperty(lt,"__esModule",{value:!0});lt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=lt.WALLET_PROVIDER_CALLBACK_PARAM=lt.WALLET_PROVIDER_SIGN_MESSAGE_URL=lt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=lt.WALLET_PROVIDER_SEND_TRANSACTION_URL=lt.WALLET_PROVIDER_DISCONNECT_URL=lt.WALLET_PROVIDER_CONNECT_URL=lt.WALLET_PROVIDER_TESTNET=lt.WALLET_PROVIDER_DEVNET=lt.WALLET_PROVIDER_MAINNET=void 0;lt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";lt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";lt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";lt.WALLET_PROVIDER_CONNECT_URL="hook/login";lt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";lt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";lt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";lt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";lt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";lt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var $8=v(zu=>{"use strict";c();Object.defineProperty(zu,"__esModule",{value:!0});zu.ErrCannotSignedMessage=zu.ErrCannotGetSignedTransactions=void 0;var ZA=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};zu.ErrCannotGetSignedTransactions=ZA;var e_=class extends Error{constructor(){super("Cannot get signed message")}};zu.ErrCannotSignedMessage=e_});var Y8=v(Cg=>{"use strict";c();Object.defineProperty(Cg,"__esModule",{value:!0});Cg.PlainSignedTransaction=void 0;var t_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Cg.PlainSignedTransaction=t_});var Kl=v(Xi=>{"use strict";c();var _o=Xi&&Xi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},MY=Xi&&Xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xi,"__esModule",{value:!0});Xi.WalletProvider=void 0;var r_=MY(W8()),bo=XA(),n_=$8(),UY=Y8(),Wu=class{constructor(e){this.walletUrl=e}login(e){return _o(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return _o(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return _o(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return _o(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return _o(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=r_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new n_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}signTransactions(e,r){return _o(this,void 0,void 0,function*(){let n={};e.map(s=>{let o=Wu.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!n.hasOwnProperty(a)&&(n[a]=[]),n[a].push(o[a])});let i=this.buildWalletUrl({endpoint:bo.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:r?.callbackUrl,params:n});window.location.href=i})}signTransaction(e,r){return _o(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=r_.default.parse(window.location.search.slice(1));return Wu.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(bo.WALLET_PROVIDER_CALLBACK_PARAM)&&e[bo.WALLET_PROVIDER_CALLBACK_PARAM]===bo.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new n_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new n_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{"use strict";c();Object.defineProperty(Ng,"__esModule",{value:!0});Ng.TransactionStatus=void 0;var zl=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new zl("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};Ng.TransactionStatus=zl});var Ju=v(Rt=>{"use strict";c();var qY=Rt&&Rt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VY=Rt&&Rt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jY=Rt&&Rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qY(e,t,r);return VY(e,t),e};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.zeroPadStringIfOddLength=Rt.isPaddedHex=Rt.numberToPaddedHex=Rt.Nonce=Rt.Address=void 0;var rB=jY(Tf()),HY="erd",Wl=class{constructor(e){this.value=e}static fromPubkey(e){let r=rB.toWords(e),n=rB.encode(HY,r);return new Wl(n)}bech32(){return this.value}toString(){return this.bech32()}};Rt.Address=Wl;var i_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return nB(this.value)}};Rt.Nonce=i_;function nB(t){let e=t.toString(16);return iB(e)}Rt.numberToPaddedHex=nB;function GY(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Rt.isPaddedHex=GY;function iB(t){return t=t||"",t.length%2==1?"0"+t:t}Rt.zeroPadStringIfOddLength=iB});var oB=v(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.TransactionReceipt=void 0;var sB=Ju(),$l=class{constructor(){this.value="",this.sender=new sB.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new $l;return r.value=(e.value||0).toString(),r.sender=new sB.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Dg.TransactionReceipt=$l});var aB=v(xn=>{"use strict";c();Object.defineProperty(xn,"__esModule",{value:!0});xn.ErrContractQuery=xn.ErrNetworkProvider=xn.ErrUnexpectedCondition=xn.Err=void 0;var Xu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};xn.Err=Xu;var s_=class extends Xu{constructor(e){super(`Unexpected condition: [${e}]`)}};xn.ErrUnexpectedCondition=s_;var o_=class extends Xu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};xn.ErrNetworkProvider=o_;var a_=class extends Xu{constructor(e){super(e.message.replace("executeQuery:",""))}};xn.ErrContractQuery=a_});var cB=v(Zu=>{"use strict";c();Object.defineProperty(Zu,"__esModule",{value:!0});Zu.TransactionEventTopic=Zu.TransactionEvent=void 0;var uB=Ju(),Yl=class{constructor(e){this.address=new uB.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new Yl;return r.address=new uB.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Og(n)),r.data=h.Buffer.from(e.data||"","base64").toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Zu.TransactionEvent=Yl;var Og=class{constructor(e){this.raw=h.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Zu.TransactionEventTopic=Og});var u_=v(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.TransactionLogs=void 0;var QY=aB(),lB=Ju(),kY=cB(),Jl=class{constructor(e){this.address=new lB.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new Jl;return r.address=new lB.Address(e.address),r.events=(e.events||[]).map(n=>kY.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new QY.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};Pg.TransactionLogs=Jl});var hB=v(tc=>{"use strict";c();Object.defineProperty(tc,"__esModule",{value:!0});tc.ContractResultItem=tc.ContractResults=void 0;var fB=u_(),Bg=Ju(),ec=class{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>ti.fromProxyHttpResponse(n));return new ec(r)}static fromApiHttpResponse(e){let r=e.map(n=>ti.fromApiHttpResponse(n));return new ec(r)}};tc.ContractResults=ec;var ti=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Bg.Address(""),this.sender=new Bg.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new fB.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ti.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=ti.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new ti;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Bg.Address(e.receiver),r.sender=new Bg.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=fB.TransactionLogs.fromHttpResponse(e.logs||{}),r}};tc.ContractResultItem=ti});var dB=v(es=>{"use strict";c();var KY=es&&es.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(es,"__esModule",{value:!0});es.EsdtContractAddress=es.MaxUint64AsBigNumber=void 0;var zY=KY(Wt()),WY=Ju();es.MaxUint64AsBigNumber=new zY.default("18446744073709551615");es.EsdtContractAddress=new WY.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var pB=v(rc=>{"use strict";c();var $Y=rc&&rc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rc,"__esModule",{value:!0});rc.ContractQueryResponse=void 0;var YY=$Y(Wt()),JY=dB(),Xl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new YY.default(e.gasRemaining||e.GasRemaining||0),o=JY.MaxUint64AsBigNumber.minus(s).toNumber();return new Xl({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>h.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};rc.ContractQueryResponse=Xl});var gB=v(Rg=>{"use strict";c();Object.defineProperty(Rg,"__esModule",{value:!0});Rg.ContractQueryRequest=void 0;var c_=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Rg.ContractQueryRequest=c_});var CB=v(($fe,SB)=>{c();SB.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ts=v(Co=>{c();var l_,XY=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Co.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Co.getSymbolTotalCodewords=function(e){return XY[e]};Co.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Co.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');l_=e};Co.isKanjiModeEnabled=function(){return typeof l_<"u"};Co.toSJIS=function(e){return l_(e)}});var Mg=v(Nr=>{c();Nr.L={bit:1};Nr.M={bit:0};Nr.Q={bit:3};Nr.H={bit:2};function ZY(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Nr.L;case"m":case"medium":return Nr.M;case"q":case"quartile":return Nr.Q;case"h":case"high":return Nr.H;default:throw new Error("Unknown EC Level: "+t)}}Nr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Nr.from=function(e,r){if(Nr.isValid(e))return e;try{return ZY(e)}catch{return r}}});var NB=v((the,xB)=>{c();function TB(){this.buffer=[],this.length=0}TB.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};xB.exports=TB});var OB=v((nhe,DB)=>{c();function Zl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Zl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Zl.prototype.get=function(t,e){return this.data[t*this.size+e]};Zl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Zl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};DB.exports=Zl});var PB=v(Ug=>{c();var eJ=ts().getSymbolSize;Ug.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=eJ(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var tJ=ts().getSymbolSize,BB=7;RB.getPositions=function(e){let r=tJ(e);return[[0,0],[r-BB,0],[0,r-BB]]}});var FB=v(We=>{c();We.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var To={N1:3,N2:3,N3:40,N4:10};We.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};We.from=function(e){return We.isValid(e)?parseInt(e,10):void 0};We.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=To.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=To.N1+(s-5)),a=f,s=1)}i>=5&&(n+=To.N1+(i-5)),s>=5&&(n+=To.N1+(s-5))}return n};We.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*To.N3};We.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var rs=Mg(),qg=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Vg=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];f_.getBlocksCount=function(e,r){switch(r){case rs.L:return qg[(e-1)*4+0];case rs.M:return qg[(e-1)*4+1];case rs.Q:return qg[(e-1)*4+2];case rs.H:return qg[(e-1)*4+3];default:return}};f_.getTotalCodewordsCount=function(e,r){switch(r){case rs.L:return Vg[(e-1)*4+0];case rs.M:return Vg[(e-1)*4+1];case rs.Q:return Vg[(e-1)*4+2];case rs.H:return Vg[(e-1)*4+3];default:return}}});var MB=v(Hg=>{c();var ef=new Uint8Array(512),jg=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ef[r]=e,jg[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ef[r]=ef[r-255]})();Hg.log=function(e){if(e<1)throw new Error("log("+e+")");return jg[e]};Hg.exp=function(e){return ef[e]};Hg.mul=function(e,r){return e===0||r===0?0:ef[jg[e]+jg[r]]}});var UB=v(tf=>{c();var d_=MB();tf.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var qB=UB();function p_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}p_.prototype.initialize=function(e){this.degree=e,this.genPoly=qB.generateECPolynomial(this.degree)};p_.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=qB.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};VB.exports=p_});var g_=v(HB=>{c();HB.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var y_=v(ri=>{c();var GB="[0-9]+",nJ="[A-Z $%*+\\-./:]+",rf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";rf=rf.replace(/u/g,"\\u");var iJ="(?:(?![A-Z0-9 $%*+\\-./:]|"+rf+`)(?:.|[\r -]))+`;ri.KANJI=new RegExp(rf,"g");ri.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ri.BYTE=new RegExp(iJ,"g");ri.NUMERIC=new RegExp(GB,"g");ri.ALPHANUMERIC=new RegExp(nJ,"g");var sJ=new RegExp("^"+rf+"$"),oJ=new RegExp("^"+GB+"$"),aJ=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ri.testKanji=function(e){return sJ.test(e)};ri.testNumeric=function(e){return oJ.test(e)};ri.testAlphanumeric=function(e){return aJ.test(e)}});var ns=v(Et=>{c();var uJ=g_(),m_=y_();Et.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};Et.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};Et.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};Et.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};Et.MIXED={bit:-1};Et.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!uJ.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Et.getBestModeForData=function(e){return m_.testNumeric(e)?Et.NUMERIC:m_.testAlphanumeric(e)?Et.ALPHANUMERIC:m_.testKanji(e)?Et.KANJI:Et.BYTE};Et.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Et.isValid=function(e){return e&&e.bit&&e.ccBits};function cJ(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Et.NUMERIC;case"alphanumeric":return Et.ALPHANUMERIC;case"kanji":return Et.KANJI;case"byte":return Et.BYTE;default:throw new Error("Unknown mode: "+t)}}Et.from=function(e,r){if(Et.isValid(e))return e;try{return cJ(e)}catch{return r}}});var WB=v(xo=>{c();var Gg=ts(),lJ=h_(),QB=Mg(),is=ns(),w_=g_(),KB=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,kB=Gg.getBCHDigit(KB);function fJ(t,e,r){for(let n=1;n<=40;n++)if(e<=xo.getCapacity(n,r,t))return n}function zB(t,e){return is.getCharCountIndicator(t,e)+4}function hJ(t,e){let r=0;return t.forEach(function(n){let i=zB(n.mode,e);r+=i+n.getBitsLength()}),r}function dJ(t,e){for(let r=1;r<=40;r++)if(hJ(t,r)<=xo.getCapacity(r,e,is.MIXED))return r}xo.from=function(e,r){return w_.isValid(e)?parseInt(e,10):r};xo.getCapacity=function(e,r,n){if(!w_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=is.BYTE);let i=Gg.getSymbolTotalCodewords(e),s=lJ.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===is.MIXED)return o;let a=o-zB(n,e);switch(n){case is.NUMERIC:return Math.floor(a/10*3);case is.ALPHANUMERIC:return Math.floor(a/11*2);case is.KANJI:return Math.floor(a/13);case is.BYTE:default:return Math.floor(a/8)}};xo.getBestVersionForData=function(e,r){let n,i=QB.from(r,QB.M);if(Array.isArray(e)){if(e.length>1)return dJ(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return fJ(n.mode,n.getLength(),i)};xo.getEncodedBits=function(e){if(!w_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Gg.getBCHDigit(r)-kB>=0;)r^=KB<{c();var E_=ts(),YB=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,pJ=1<<14|1<<12|1<<10|1<<4|1<<1,$B=E_.getBCHDigit(YB);JB.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;E_.getBCHDigit(i)-$B>=0;)i^=YB<{c();var gJ=ns();function nc(t){this.mode=gJ.NUMERIC,this.data=t.toString()}nc.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};nc.prototype.getLength=function(){return this.data.length};nc.prototype.getBitsLength=function(){return nc.getBitsLength(this.data.length)};nc.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};ZB.exports=nc});var rR=v((Ohe,tR)=>{c();var yJ=ns(),v_=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ic(t){this.mode=yJ.ALPHANUMERIC,this.data=t}ic.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};ic.prototype.getLength=function(){return this.data.length};ic.prototype.getBitsLength=function(){return ic.getBitsLength(this.data.length)};ic.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=v_.indexOf(this.data[r])*45;n+=v_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(v_.indexOf(this.data[r]),6)};tR.exports=ic});var iR=v((Bhe,nR)=>{"use strict";c();nR.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var oR=v((Lhe,sR)=>{c();var mJ=iR(),wJ=ns();function sc(t){this.mode=wJ.BYTE,typeof t=="string"&&(t=mJ(t)),this.data=new Uint8Array(t)}sc.getBitsLength=function(e){return e*8};sc.prototype.getLength=function(){return this.data.length};sc.prototype.getBitsLength=function(){return sc.getBitsLength(this.data.length)};sc.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var EJ=ns(),vJ=ts();function oc(t){this.mode=EJ.KANJI,this.data=t}oc.getBitsLength=function(e){return e*13};oc.prototype.getLength=function(){return this.data.length};oc.prototype.getBitsLength=function(){return oc.getBitsLength(this.data.length)};oc.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};aR.exports=oc});var cR=v((qhe,A_)=>{"use strict";c();var nf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=nf.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,y,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],y=l+d,w=i[u],E=typeof i[u]>"u",(E||w>y)&&(i[u]=y,s.push(u,y),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var N=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(N)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=nf.single_source_shortest_paths(t,e,r);return nf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=nf.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof A_<"u"&&(A_.exports=nf)});var mR=v(ac=>{c();var Ve=ns(),hR=eR(),dR=rR(),pR=oR(),gR=uR(),sf=y_(),Qg=ts(),AJ=cR();function lR(t){return unescape(encodeURIComponent(t)).length}function of(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function yR(t){let e=of(sf.NUMERIC,Ve.NUMERIC,t),r=of(sf.ALPHANUMERIC,Ve.ALPHANUMERIC,t),n,i;return Qg.isKanjiModeEnabled()?(n=of(sf.BYTE,Ve.BYTE,t),i=of(sf.KANJI,Ve.KANJI,t)):(n=of(sf.BYTE_KANJI,Ve.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function __(t,e){switch(e){case Ve.NUMERIC:return hR.getBitsLength(t);case Ve.ALPHANUMERIC:return dR.getBitsLength(t);case Ve.KANJI:return gR.getBitsLength(t);case Ve.BYTE:return pR.getBitsLength(t)}}function _J(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function bJ(t){let e=[];for(let r=0;r{c();var Kg=ts(),b_=Mg(),SJ=NB(),CJ=OB(),TJ=PB(),xJ=LB(),C_=FB(),T_=h_(),NJ=jB(),kg=WB(),DJ=XB(),OJ=ns(),I_=mR();function PJ(t,e){let r=t.size,n=xJ.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function BJ(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function S_(t,e,r){let n=t.size,i=DJ.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function FJ(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function MJ(t,e,r){let n=new SJ;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),OJ.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Kg.getSymbolTotalCodewords(t),s=T_.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{"use strict";c();var jA=yg(),ku=c8(),k$=D8(),K$=jA("%TypeError%"),Ag=jA("%WeakMap%",!0),_g=jA("%Map%",!0),z$=ku("WeakMap.prototype.get",!0),W$=ku("WeakMap.prototype.set",!0),$$=ku("WeakMap.prototype.has",!0),Y$=ku("Map.prototype.get",!0),J$=ku("Map.prototype.set",!0),X$=ku("Map.prototype.has",!0),GA=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Z$=function(t,e){var r=GA(t,e);return r&&r.value},eY=function(t,e,r){var n=GA(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},tY=function(t,e){return!!GA(t,e)};O8.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new K$("Side channel does not contain "+k$(s))},get:function(s){if(Ag&&s&&(typeof s=="object"||typeof s=="function")){if(e)return z$(e,s)}else if(_g){if(r)return Y$(r,s)}else if(n)return Z$(n,s)},has:function(s){if(Ag&&s&&(typeof s=="object"||typeof s=="function")){if(e)return $$(e,s)}else if(_g){if(r)return X$(r,s)}else if(n)return tY(n,s);return!1},set:function(s,o){Ag&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Ag),W$(e,s,o)):_g?(r||(r=new _g),J$(r,s,o)):(n||(n={key:{},next:null}),eY(n,s,o))}};return i}});var bg=v((ple,B8)=>{"use strict";c();var rY=String.prototype.replace,nY=/%20/g,QA={RFC1738:"RFC1738",RFC3986:"RFC3986"};B8.exports={default:QA.RFC3986,formatters:{RFC1738:function(t){return rY.call(t,nY,"+")},RFC3986:function(t){return String(t)}},RFC1738:QA.RFC1738,RFC3986:QA.RFC3986}});var KA=v((yle,L8)=>{"use strict";c();var iY=bg(),kA=Object.prototype.hasOwnProperty,Ao=Array.isArray,Tn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),sY=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Ao(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===iY.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Tn[l];continue}if(l<2048){a=a+(Tn[192|l>>6]+Tn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Tn[224|l>>12]+Tn[128|l>>6&63]+Tn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Tn[240|l>>18]+Tn[128|l>>12&63]+Tn[128|l>>6&63]+Tn[128|l&63]}return a},lY=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var U8=P8(),WA=KA(),kl=bg(),gY=Object.prototype.hasOwnProperty,F8={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},_o=Array.isArray,yY=String.prototype.split,mY=Array.prototype.push,q8=function(t,e){mY.apply(t,_o(e)?e:[e])},wY=Date.prototype.toISOString,M8=kl.default,Ut={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:WA.encode,encodeValuesOnly:!1,format:M8,formatter:kl.formatters[M8],indices:!1,serializeDate:function(e){return wY.call(e)},skipNulls:!1,strictNullHandling:!1},EY=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},zA={},vY=function t(e,r,n,i,s,o,a,u,l,f,d,y,w,E,T){for(var R=e,_=T,B=0,x=!1;(_=_.get(zA))!==void 0&&!x;){var O=_.get(e);if(B+=1,typeof O<"u"){if(O===B)throw new RangeError("Cyclic object value");x=!0}typeof _.get(zA)>"u"&&(B=0)}if(typeof a=="function"?R=a(r,R):R instanceof Date?R=f(R):n==="comma"&&_o(R)&&(R=WA.maybeMap(R,function(re){return re instanceof Date?f(re):re})),R===null){if(i)return o&&!w?o(r,Ut.encoder,E,"key",d):r;R=""}if(EY(R)||WA.isBuffer(R)){if(o){var P=w?r:o(r,Ut.encoder,E,"key",d);if(n==="comma"&&w){for(var L=yY.call(String(R),","),b="",C=0;C"u")return M;var Z;if(n==="comma"&&_o(R))Z=[{value:R.length>0?R.join(",")||null:void 0}];else if(_o(a))Z=a;else{var K=Object.keys(R);Z=u?K.sort(u):K}for(var j=0;j"u"?Ut.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,delimiter:typeof e.delimiter>"u"?Ut.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Ut.encode,encoder:typeof e.encoder=="function"?e.encoder:Ut.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Ut.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Ut.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Ut.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};V8.exports=function(t,e){var r=t,n=AY(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):_o(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in F8?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=F8[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=U8(),f=0;f0?w+y:""}});var Q8=v((vle,G8)=>{"use strict";c();var Ku=KA(),$A=Object.prototype.hasOwnProperty,_Y=Array.isArray,Pt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ku.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},bY=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},j8=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},IY="utf8=%26%2310003%3B",SY="utf8=%E2%9C%93",CY=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=_Y(E)?[E]:E),$A.call(n,w)?n[w]=Ku.combine(n[w],E):n[w]=E}return n},TY=function(t,e,r,n){for(var i=n?e:j8(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},xY=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&$A.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Pt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Pt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Pt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Pt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Pt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Pt.comma,decoder:typeof e.decoder=="function"?e.decoder:Pt.decoder,delimiter:typeof e.delimiter=="string"||Ku.isRegExp(e.delimiter)?e.delimiter:Pt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Pt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Pt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Pt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Pt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}};G8.exports=function(t,e){var r=NY(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?CY(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var DY=H8(),OY=Q8(),PY=bg();k8.exports={formats:PY,parse:OY,stringify:DY}});var YA=v(rt=>{"use strict";c();Object.defineProperty(rt,"__esModule",{value:!0});rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=rt.WALLET_PROVIDER_CALLBACK_PARAM=rt.WALLET_PROVIDER_SIGN_MESSAGE_URL=rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL=rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=rt.WALLET_PROVIDER_SEND_TRANSACTION_URL=rt.WALLET_PROVIDER_DISCONNECT_URL=rt.WALLET_PROVIDER_CONNECT_URL=rt.WALLET_PROVIDER_TESTNET=rt.WALLET_PROVIDER_DEVNET=rt.WALLET_PROVIDER_MAINNET=void 0;rt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_CONNECT_URL="hook/login";rt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";rt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";rt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";rt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var z8=v(zu=>{"use strict";c();Object.defineProperty(zu,"__esModule",{value:!0});zu.ErrCannotSignedMessage=zu.ErrCannotGetSignedTransactions=void 0;var JA=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};zu.ErrCannotGetSignedTransactions=JA;var XA=class extends Error{constructor(){super("Cannot get signed message")}};zu.ErrCannotSignedMessage=XA});var W8=v(Ig=>{"use strict";c();Object.defineProperty(Ig,"__esModule",{value:!0});Ig.PlainSignedTransaction=void 0;var ZA=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Ig.PlainSignedTransaction=ZA});var Kl=v(es=>{"use strict";c();var Xi=es&&es.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},BY=es&&es.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var e_=BY(K8()),Zi=YA(),t_=z8(),RY=W8(),Wu=class{constructor(e){this.walletUrl=e}login(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Xi(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return Xi(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Xi(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=e_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new t_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Xi(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=e_.default.parse(window.location.search.slice(1));return Wu.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(Zi.WALLET_PROVIDER_CALLBACK_PARAM)&&e[Zi.WALLET_PROVIDER_CALLBACK_PARAM]===Zi.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new t_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new t_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=Wu.prepareWalletTransaction(o);for(let u in a)a.hasOwnProperty(u)&&!i.hasOwnProperty(u)&&(i[u]=[]),i[u].push(a[u])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};es.WalletProvider=Wu});var Z8=v(Tg=>{"use strict";c();Object.defineProperty(Tg,"__esModule",{value:!0});Tg.TransactionStatus=void 0;var zl=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new zl("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};Tg.TransactionStatus=zl});var Ju=v(Rt=>{"use strict";c();var LY=Rt&&Rt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FY=Rt&&Rt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MY=Rt&&Rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LY(e,t,r);return FY(e,t),e};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.zeroPadStringIfOddLength=Rt.isPaddedHex=Rt.numberToPaddedHex=Rt.Nonce=Rt.Address=void 0;var eB=MY(Cf()),UY="erd",Wl=class{constructor(e){this.value=e}static fromPubkey(e){let r=eB.toWords(e),n=eB.encode(UY,r);return new Wl(n)}bech32(){return this.value}toString(){return this.bech32()}};Rt.Address=Wl;var r_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return tB(this.value)}};Rt.Nonce=r_;function tB(t){let e=t.toString(16);return rB(e)}Rt.numberToPaddedHex=tB;function qY(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Rt.isPaddedHex=qY;function rB(t){return t=t||"",t.length%2==1?"0"+t:t}Rt.zeroPadStringIfOddLength=rB});var iB=v(xg=>{"use strict";c();Object.defineProperty(xg,"__esModule",{value:!0});xg.TransactionReceipt=void 0;var nB=Ju(),$l=class{constructor(){this.value="",this.sender=new nB.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new $l;return r.value=(e.value||0).toString(),r.sender=new nB.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};xg.TransactionReceipt=$l});var sB=v(xn=>{"use strict";c();Object.defineProperty(xn,"__esModule",{value:!0});xn.ErrContractQuery=xn.ErrNetworkProvider=xn.ErrUnexpectedCondition=xn.Err=void 0;var Xu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};xn.Err=Xu;var n_=class extends Xu{constructor(e){super(`Unexpected condition: [${e}]`)}};xn.ErrUnexpectedCondition=n_;var i_=class extends Xu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};xn.ErrNetworkProvider=i_;var s_=class extends Xu{constructor(e){super(e.message.replace("executeQuery:",""))}};xn.ErrContractQuery=s_});var aB=v(Zu=>{"use strict";c();Object.defineProperty(Zu,"__esModule",{value:!0});Zu.TransactionEventTopic=Zu.TransactionEvent=void 0;var oB=Ju(),Yl=class{constructor(e){this.address=new oB.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new Yl;return r.address=new oB.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Ng(n)),r.data=h.Buffer.from(e.data||"","base64").toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Zu.TransactionEvent=Yl;var Ng=class{constructor(e){this.raw=h.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Zu.TransactionEventTopic=Ng});var o_=v(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.TransactionLogs=void 0;var VY=sB(),uB=Ju(),HY=aB(),Jl=class{constructor(e){this.address=new uB.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new Jl;return r.address=new uB.Address(e.address),r.events=(e.events||[]).map(n=>HY.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new VY.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};Dg.TransactionLogs=Jl});var lB=v(tc=>{"use strict";c();Object.defineProperty(tc,"__esModule",{value:!0});tc.ContractResultItem=tc.ContractResults=void 0;var cB=o_(),Og=Ju(),ec=class{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>ti.fromProxyHttpResponse(n));return new ec(r)}static fromApiHttpResponse(e){let r=e.map(n=>ti.fromApiHttpResponse(n));return new ec(r)}};tc.ContractResults=ec;var ti=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Og.Address(""),this.sender=new Og.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new cB.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ti.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=ti.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new ti;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Og.Address(e.receiver),r.sender=new Og.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=cB.TransactionLogs.fromHttpResponse(e.logs||{}),r}};tc.ContractResultItem=ti});var fB=v(rs=>{"use strict";c();var jY=rs&&rs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rs,"__esModule",{value:!0});rs.EsdtContractAddress=rs.MaxUint64AsBigNumber=void 0;var GY=jY(Wt()),QY=Ju();rs.MaxUint64AsBigNumber=new GY.default("18446744073709551615");rs.EsdtContractAddress=new QY.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var hB=v(rc=>{"use strict";c();var kY=rc&&rc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rc,"__esModule",{value:!0});rc.ContractQueryResponse=void 0;var KY=kY(Wt()),zY=fB(),Xl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new KY.default(e.gasRemaining||e.GasRemaining||0),o=zY.MaxUint64AsBigNumber.minus(s).toNumber();return new Xl({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>h.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};rc.ContractQueryResponse=Xl});var dB=v(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.ContractQueryRequest=void 0;var a_=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Pg.ContractQueryRequest=a_});var IB=v((kfe,bB)=>{c();bB.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ns=v(So=>{c();var u_,WY=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];So.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};So.getSymbolTotalCodewords=function(e){return WY[e]};So.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};So.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');u_=e};So.isKanjiModeEnabled=function(){return typeof u_<"u"};So.toSJIS=function(e){return u_(e)}});var Lg=v(Nr=>{c();Nr.L={bit:1};Nr.M={bit:0};Nr.Q={bit:3};Nr.H={bit:2};function $Y(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Nr.L;case"m":case"medium":return Nr.M;case"q":case"quartile":return Nr.Q;case"h":case"high":return Nr.H;default:throw new Error("Unknown EC Level: "+t)}}Nr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Nr.from=function(e,r){if(Nr.isValid(e))return e;try{return $Y(e)}catch{return r}}});var TB=v((Jfe,CB)=>{c();function SB(){this.buffer=[],this.length=0}SB.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};CB.exports=SB});var NB=v((Zfe,xB)=>{c();function Zl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Zl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Zl.prototype.get=function(t,e){return this.data[t*this.size+e]};Zl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Zl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};xB.exports=Zl});var DB=v(Fg=>{c();var YY=ns().getSymbolSize;Fg.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=YY(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var JY=ns().getSymbolSize,OB=7;PB.getPositions=function(e){let r=JY(e);return[[0,0],[r-OB,0],[0,r-OB]]}});var RB=v(We=>{c();We.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Co={N1:3,N2:3,N3:40,N4:10};We.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};We.from=function(e){return We.isValid(e)?parseInt(e,10):void 0};We.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Co.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=Co.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Co.N1+(i-5)),s>=5&&(n+=Co.N1+(s-5))}return n};We.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*Co.N3};We.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var is=Lg(),Mg=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ug=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];c_.getBlocksCount=function(e,r){switch(r){case is.L:return Mg[(e-1)*4+0];case is.M:return Mg[(e-1)*4+1];case is.Q:return Mg[(e-1)*4+2];case is.H:return Mg[(e-1)*4+3];default:return}};c_.getTotalCodewordsCount=function(e,r){switch(r){case is.L:return Ug[(e-1)*4+0];case is.M:return Ug[(e-1)*4+1];case is.Q:return Ug[(e-1)*4+2];case is.H:return Ug[(e-1)*4+3];default:return}}});var LB=v(Vg=>{c();var ef=new Uint8Array(512),qg=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ef[r]=e,qg[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ef[r]=ef[r-255]})();Vg.log=function(e){if(e<1)throw new Error("log("+e+")");return qg[e]};Vg.exp=function(e){return ef[e]};Vg.mul=function(e,r){return e===0||r===0?0:ef[qg[e]+qg[r]]}});var FB=v(tf=>{c();var f_=LB();tf.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var MB=FB();function h_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}h_.prototype.initialize=function(e){this.degree=e,this.genPoly=MB.generateECPolynomial(this.degree)};h_.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=MB.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};UB.exports=h_});var d_=v(VB=>{c();VB.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var p_=v(ri=>{c();var HB="[0-9]+",ZY="[A-Z $%*+\\-./:]+",rf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";rf=rf.replace(/u/g,"\\u");var eJ="(?:(?![A-Z0-9 $%*+\\-./:]|"+rf+`)(?:.|[\r +]))+`;ri.KANJI=new RegExp(rf,"g");ri.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ri.BYTE=new RegExp(eJ,"g");ri.NUMERIC=new RegExp(HB,"g");ri.ALPHANUMERIC=new RegExp(ZY,"g");var tJ=new RegExp("^"+rf+"$"),rJ=new RegExp("^"+HB+"$"),nJ=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ri.testKanji=function(e){return tJ.test(e)};ri.testNumeric=function(e){return rJ.test(e)};ri.testAlphanumeric=function(e){return nJ.test(e)}});var ss=v(Et=>{c();var iJ=d_(),g_=p_();Et.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Et.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Et.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Et.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Et.MIXED={bit:-1};Et.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!iJ.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Et.getBestModeForData=function(e){return g_.testNumeric(e)?Et.NUMERIC:g_.testAlphanumeric(e)?Et.ALPHANUMERIC:g_.testKanji(e)?Et.KANJI:Et.BYTE};Et.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Et.isValid=function(e){return e&&e.bit&&e.ccBits};function sJ(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Et.NUMERIC;case"alphanumeric":return Et.ALPHANUMERIC;case"kanji":return Et.KANJI;case"byte":return Et.BYTE;default:throw new Error("Unknown mode: "+t)}}Et.from=function(e,r){if(Et.isValid(e))return e;try{return sJ(e)}catch{return r}}});var KB=v(To=>{c();var Hg=ns(),oJ=l_(),jB=Lg(),os=ss(),y_=d_(),QB=7973,GB=Hg.getBCHDigit(QB);function aJ(t,e,r){for(let n=1;n<=40;n++)if(e<=To.getCapacity(n,r,t))return n}function kB(t,e){return os.getCharCountIndicator(t,e)+4}function uJ(t,e){let r=0;return t.forEach(function(n){let i=kB(n.mode,e);r+=i+n.getBitsLength()}),r}function cJ(t,e){for(let r=1;r<=40;r++)if(uJ(t,r)<=To.getCapacity(r,e,os.MIXED))return r}To.from=function(e,r){return y_.isValid(e)?parseInt(e,10):r};To.getCapacity=function(e,r,n){if(!y_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=os.BYTE);let i=Hg.getSymbolTotalCodewords(e),s=oJ.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===os.MIXED)return o;let a=o-kB(n,e);switch(n){case os.NUMERIC:return Math.floor(a/10*3);case os.ALPHANUMERIC:return Math.floor(a/11*2);case os.KANJI:return Math.floor(a/13);case os.BYTE:default:return Math.floor(a/8)}};To.getBestVersionForData=function(e,r){let n,i=jB.from(r,jB.M);if(Array.isArray(e)){if(e.length>1)return cJ(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return aJ(n.mode,n.getLength(),i)};To.getEncodedBits=function(e){if(!y_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Hg.getBCHDigit(r)-GB>=0;)r^=QB<{c();var m_=ns(),WB=1335,lJ=21522,zB=m_.getBCHDigit(WB);$B.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;m_.getBCHDigit(i)-zB>=0;)i^=WB<{c();var fJ=ss();function nc(t){this.mode=fJ.NUMERIC,this.data=t.toString()}nc.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};nc.prototype.getLength=function(){return this.data.length};nc.prototype.getBitsLength=function(){return nc.getBitsLength(this.data.length)};nc.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};JB.exports=nc});var eR=v((The,ZB)=>{c();var hJ=ss(),w_=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ic(t){this.mode=hJ.ALPHANUMERIC,this.data=t}ic.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};ic.prototype.getLength=function(){return this.data.length};ic.prototype.getBitsLength=function(){return ic.getBitsLength(this.data.length)};ic.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=w_.indexOf(this.data[r])*45;n+=w_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(w_.indexOf(this.data[r]),6)};ZB.exports=ic});var rR=v((Nhe,tR)=>{"use strict";c();tR.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var iR=v((Ohe,nR)=>{c();var dJ=rR(),pJ=ss();function sc(t){this.mode=pJ.BYTE,typeof t=="string"&&(t=dJ(t)),this.data=new Uint8Array(t)}sc.getBitsLength=function(e){return e*8};sc.prototype.getLength=function(){return this.data.length};sc.prototype.getBitsLength=function(){return sc.getBitsLength(this.data.length)};sc.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var gJ=ss(),yJ=ns();function oc(t){this.mode=gJ.KANJI,this.data=t}oc.getBitsLength=function(e){return e*13};oc.prototype.getLength=function(){return this.data.length};oc.prototype.getBitsLength=function(){return oc.getBitsLength(this.data.length)};oc.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};sR.exports=oc});var aR=v((Lhe,E_)=>{"use strict";c();var nf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=nf.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,y,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],y=l+d,w=i[u],E=typeof i[u]>"u",(E||w>y)&&(i[u]=y,s.push(u,y),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=nf.single_source_shortest_paths(t,e,r);return nf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=nf.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof E_<"u"&&(E_.exports=nf)});var gR=v(ac=>{c();var Ve=ss(),lR=XB(),fR=eR(),hR=iR(),dR=oR(),sf=p_(),jg=ns(),mJ=aR();function uR(t){return unescape(encodeURIComponent(t)).length}function of(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function pR(t){let e=of(sf.NUMERIC,Ve.NUMERIC,t),r=of(sf.ALPHANUMERIC,Ve.ALPHANUMERIC,t),n,i;return jg.isKanjiModeEnabled()?(n=of(sf.BYTE,Ve.BYTE,t),i=of(sf.KANJI,Ve.KANJI,t)):(n=of(sf.BYTE_KANJI,Ve.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function v_(t,e){switch(e){case Ve.NUMERIC:return lR.getBitsLength(t);case Ve.ALPHANUMERIC:return fR.getBitsLength(t);case Ve.KANJI:return dR.getBitsLength(t);case Ve.BYTE:return hR.getBitsLength(t)}}function wJ(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function EJ(t){let e=[];for(let r=0;r{c();var Qg=ns(),A_=Lg(),AJ=TB(),_J=NB(),bJ=DB(),IJ=BB(),I_=RB(),S_=l_(),SJ=qB(),Gg=KB(),CJ=YB(),TJ=ss(),__=gR();function xJ(t,e){let r=t.size,n=IJ.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function NJ(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function b_(t,e,r){let n=t.size,i=CJ.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function PJ(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function BJ(t,e,r){let n=new AJ;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),TJ.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Qg.getSymbolTotalCodewords(t),s=S_.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u=7&&LJ(u,e),FJ(u,o),isNaN(n)&&(n=C_.getBestMask(u,S_.bind(null,u,r))),C_.applyMask(n,u),S_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}wR.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=b_.M,i,s;return typeof r<"u"&&(n=b_.from(r.errorCorrectionLevel,b_.M),i=kg.from(r.version),s=C_.from(r.maskPattern),r.toSJISFunc&&Kg.setToSJISFunction(r.toSJISFunc)),qJ(e,i,n,s)}});var x_=v(No=>{c();function vR(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}No.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:vR(e.color.dark||"#000000ff"),light:vR(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};No.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};No.getImageWidth=function(e,r){let n=No.getScale(e,r);return Math.floor((e+r.margin*2)*n)};No.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=No.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var N_=x_();function VJ(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function jJ(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}zg.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=jJ()),i=N_.getOptions(i);let o=N_.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return N_.qrToImageData(u.data,e,i),VJ(a,s,o),a.putImageData(u,0,0),s};zg.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=zg.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var IR=v(bR=>{c();var HJ=x_();function _R(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function D_(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function GJ(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?D_("M",u+r,.5+l+r):D_("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',y=''+u+l+` -`;return typeof n=="function"&&n(null,y),y}});var CR=v(af=>{c();var QJ=CB(),O_=ER(),SR=AR(),kJ=IR();function P_(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!QJ())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=O_.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=O_.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}af.create=O_.create;af.toCanvas=P_.bind(null,SR.render);af.toDataURL=P_.bind(null,SR.renderToDataURL);af.toString=P_.bind(null,function(t,e,r){return kJ.render(t,r)})});var UR=v(ss=>{"use strict";c();var nX=ss&&ss.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MR=ss&&ss.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nX(e,t,r)};Object.defineProperty(ss,"__esModule",{value:!0});MR(Kl(),ss);MR(XA(),ss)});c();var iX=_e(ub()),sX=_e(KC()),oX=_e(WC()),aX=_e(Zt()),uX=_e(Ph()),cX=_e(Pc()),lX=_e(Cc()),fX=_e(uw()),hX=_e(Lx()),dX=_e(Fh()),QR=_e(li()),Nn=_e(wc()),kR=_e(gc()),KR=_e(Xo());c();c();var Gx=_e(uE());c();c();var ud="elvenjs_state",Vx="https://devnet-api.multiversx.com";var cd="/dapp/init",ld="devnet",jx="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",Hx=["wss://relay.walletconnect.com"],yn={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Te={get(t){let e=localStorage.getItem(ud);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(ud,JSON.stringify(r))},clear(){localStorage.removeItem(ud)}};var fd=()=>Ce(void 0,null,function*(){let t=Gx.ExtensionProvider.getInstance();try{let e=yield t.init(),r=Te.get();if(r!=null&&r.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var jR=_e(uE()),HR=_e(Vl()),GR=_e(Kl());c();var Z8=_e(Vl());c();c();var Se=class{static set(e,r){if(!e)return;let n=M_(Oo({},this.events),{[e]:r});this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){var n,i;!e||!this.events||(i=(n=this.events)[e])==null||i.call(n,...r)}static clear(){this.events=void 0}};c();var Io=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(Io||{});var $u=t=>Ce(void 0,null,function*(){if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Se.run("onLoginPending");let e=yield t.dappProvider.logout();return e&&(Te.clear(),Se.run("onLogout")),e});c();var J8=_e(Zt()),X8=_e(Ph());c();var Bt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var Yu=()=>new Date().setHours(new Date().getHours()+24),Tg=t=>Date.now()>t;var Zi=t=>Ce(void 0,null,function*(){let e=Te.get("address"),r=Te.get("expires");if(!(r&&Tg(r))&&e&&t.networkProvider){let i=new J8.Address(e),s=new X8.Account(i);try{let o=yield t.networkProvider.getAccount(i);Te.set("address",e),Te.set("nonce",o.nonce.valueOf()),Te.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});c();function xg(t){return t[Math.floor(Math.random()*t.length)]}var eB=t=>Ce(void 0,null,function*(){if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{Zi(t),Se.run("onLoggedIn")},onClientLogout:()=>$u(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=xg(t.initOptions.walletConnectV2RelayAddresses),n=new Z8.WalletConnectV2Provider(e,yn[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return yield n.init(),n}catch(i){console.warn("Can't initialize the Dapp Provider!")}});c();var yB=_e(Wt()),Lg=_e(Zt()),mB=_e(tB()),wB=_e(oB()),EB=_e(u_()),vB=_e(hB()),AB=_e(pB()),_B=_e(gB()),bB=_e(Uh());var Fg=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){var i,s;this.chainType=r||ld,this.apiUrl=e||((i=yn[this.chainType])==null?void 0:i.apiAddress),this.apiTimeout=n||((s=yn[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,r){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,r,n){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=yield a.json();if(!a.ok){let l=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}sendTransaction(e){return Ce(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Ce(this,null,function*(){let r=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Lg.Address((r==null?void 0:r.address)||""),nonce:Number((r==null?void 0:r.nonce)||0),balance:new yB.default((r==null?void 0:r.balance)||0),code:(r==null?void 0:r.code)||"",userName:(r==null?void 0:r.username)||""}})}getTransaction(e){return Ce(this,null,function*(){let r=yield this.apiGet(`transactions/${e}`),n=new mB.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new Lg.Address(r.sender),receiver:new Lg.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:wB.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:EB.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:vB.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}})}queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n,value:i,caller:s}){try{let a=new bB.Query({address:e,func:r,args:n,value:i,caller:s}),u=new _B.ContractQueryRequest(a).toHttpRequest(),l=yield this.apiPost("query",u);return AB.ContractQueryResponse.fromHttpResponse(l)}catch(a){this.handleApiError(a,"query")}})}};c();var IB=(t,e)=>Ce(void 0,null,function*(){let r=yield fd();try{r&&(yield r.login()),Se.run("onLoginPending")}catch(i){let s=Bt(i);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!r)throw new Error("Error: There were problems with auth provider initialization!");let{signature:n}=r.account;if(e&&Te.set("loginToken",e),n&&Te.set("signature",n),t.networkProvider)try{let i=yield r.getAddress();if(!i)throw new Error("Canceled!");return Te.set("address",i),Te.set("loginMethod","browser-extension"),Te.set("expires",Yu()),yield Zi(t),Se.run("onLoggedIn"),r}catch(i){console.warn(`Something went wrong trying to synchronize the user account: ${i==null?void 0:i.message}`),Se.run("onLogout")}});c();c();var TR=_e(CR()),xR=_e(Vl());var zJ=t=>{var r;let e=document.createElement("template");return e.innerHTML=t.trim(),(r=e.content.firstChild)==null?void 0:r.cloneNode(!0)},WJ=t=>{let e=`${jx}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},$J=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},YJ=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},B_={},JJ=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",B_[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:B_[t.topic].signal}),r},Wg={},XJ=(t,e,r)=>{var o,a;let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${(o=t.peerMetadata)==null?void 0:o.description} (${(a=t.peerMetadata)==null?void 0:a.url})`,n.appendChild(i);let s=JJ(t,e);return n.appendChild(s),Wg[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Wg[t.topic].signal}),n},ZJ=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},eX=t=>{if(!t)return;let e=document.getElementById(t);e==null||e.remove()},tX=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),rX=t=>Ce(void 0,null,function*(){return t?yield TR.default.toString(t,{type:"svg"}):void 0}),NR=(t,e,r,n)=>Ce(void 0,null,function*(){if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=yield rX(e),o;if(s&&(o=zJ(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),tX()&&i.appendChild(WJ(e))),i&&r instanceof xR.WalletConnectV2Provider){let a=r.pairings,u=f=>Ce(void 0,null,function*(){try{f&&(yield r.logout({topic:f}),eX(f))}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${y}`)}finally{Wg[f].abort()}}),l=f=>Ce(void 0,null,function*(){try{let{approval:d}=yield r.connect({topic:f,methods:["mvx_cancelAction"]});if(!document.getElementById("elven-wc-pairing-item-confirm-msessage")){let w=document.getElementById(f);w==null||w.after(ZJ())}yield r.login({approval:d,token:n})}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to login the user: ${y}`)}finally{for(let d of Object.values(Wg))d==null||d.abort();for(let d of Object.values(B_))d==null||d.abort()}});if(a&&a.length>0){let f=$J();i.appendChild(f);let d=YJ();f.appendChild(d);for(let y of a){let w=XJ(y,u,l);f.appendChild(w)}}}return i});var $g=_e(Vl());var DR=(t,e,r)=>Ce(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let n=xg(t.initOptions.walletConnectV2RelayAddresses);if(!n||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let i,s={onClientLogin:()=>Ce(void 0,null,function*(){if(t.dappProvider instanceof $g.WalletConnectV2Provider){Se.run("onLoginPending");let a=yield t.dappProvider.getAddress(),u=yield t.dappProvider.getSignature();Te.set("address",a),Te.set("loginMethod","mobile"),Te.set("expires",Yu()),yield Zi(t),u&&Te.set("signature",u),r&&Te.set("loginToken",r),Se.run("onLoggedIn"),i==null||i.replaceChildren()}}),onClientLogout:()=>Ce(void 0,null,function*(){t.dappProvider instanceof $g.WalletConnectV2Provider&&(yield $u(t),Se.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new $g.WalletConnectV2Provider(s,yn[t.initOptions.chainType].shortId,n,t.initOptions.walletConnectV2ProjectId);try{if(o){t.dappProvider=o,Se.run("onQrPending"),yield o.init();let{uri:a,approval:u}=yield o.connect({methods:["mvx_cancelAction"]}),l=r?`${a}&token=${r}`:a;return e&&l&&(i=yield NR(e,l,o,r),Se.run("onQrLoaded")),yield o.login({approval:u,token:r}),o}}catch(a){let u=Bt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.run("onLogout")}});c();var OR=_e(Kl());var PR=(t,e,r)=>Ce(void 0,null,function*(){let n=new OR.WalletProvider(`${t}${cd}`),i=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=Oo({callbackUrl:i},r?{token:r}:{});try{return Se.run("onLoginPending"),Te.set("loginMethod","web-wallet"),yield n.login(s),Te.set("expires",Yu()),r&&Te.set("loginToken",r),n}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Te.set("loginMethod",""),Se.run("onLogout")}});c();var Do=t=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var BR=_e(Kl());var RR=t=>Ce(void 0,null,function*(){let e=Do("signature"),r=Do("address"),n=Te.get("address");if(e&&Te.set("signature",e),r||n)return r&&(Te.set("address",r),window.history.replaceState(null,"",window.location.pathname)),new BR.WalletProvider(`${t}${cd}`)});c();var LR=_e(Ph()),FR=_e(uw());var Yg=(t,e)=>Ce(void 0,null,function*(){Se.run("onTxSent",t),yield new FR.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new LR.Account(n),s=yield e.getAccount(n);i.update(s),Te.set("address",i.address.bech32()),Te.set("nonce",i.getNonceThenIncrement().valueOf()),Te.set("balance",i.balance.toString()),Se.run("onTxFinalized",t)});c();var Jg=_e(UR()),qR=_e(Pc());var VR=(t,e,r)=>Ce(void 0,null,function*(){if(Do(Jg.WALLET_PROVIDER_CALLBACK_PARAM)===Jg.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i==null?void 0:i[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=qR.Transaction.fromPlainObject(s);o.setNonce(r);try{Se.run("onTxStarted",o),yield e.sendTransaction(o),yield Yg(o,e)}catch(a){let u=Bt(a);throw Se.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var cf=class{static init(e){return Ce(this,null,function*(){let r=Te.get();if(r.expires&&Tg(r.expires)){Te.clear(),this.dappProvider=void 0;return}this.initOptions=Oo({chainType:ld,apiUrl:Vx,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:Hx},e),this.networkProvider=new Fg(this.initOptions),this.initOptions.onLoginPending&&Se.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Se.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Se.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Se.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Se.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Se.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Se.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Se.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Se.set("onTxError",this.initOptions.onTxError),((r==null?void 0:r.address)||r.loginMethod==="web-wallet"&&Do("address"))&&(r!=null&&r.loginMethod)&&(Se.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=yield fd()),r.loginMethod==="mobile"&&(this.dappProvider=yield eB(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield RR(yn[this.initOptions.chainType].walletAddress)),yield Zi(this),Se.run("onLoggedIn"),r.loginMethod==="web-wallet"&&(yield VR(this.dappProvider,this.networkProvider,r.nonce)))})}static login(e,r){return Ce(this,null,function*(){var i;if(!Object.values(Io).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield IB(this,r==null?void 0:r.token);this.dappProvider=s}if(e==="mobile"){let s=yield DR(this,r==null?void 0:r.qrCodeContainer,r==null?void 0:r.token);this.dappProvider=s}if(e==="web-wallet"&&((i=this.initOptions)!=null&&i.chainType)){let s=yield PR(yn[this.initOptions.chainType].walletAddress,r==null?void 0:r.callbackRoute,r==null?void 0:r.token);this.dappProvider=s}}catch(s){let o=Bt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Ce(this,null,function*(){try{let e=yield $u(this);return this.dappProvider=void 0,e}catch(e){let r=Bt(e);console.warn("Something went wrong when logging out: ",r)}})}static signAndSendTransaction(e){return Ce(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Se.run("onTxStarted",e);let r=Te.get();e.setNonce(r.nonce),this.dappProvider instanceof jR.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof HR.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof GR.WalletProvider&&(yield this.dappProvider.signTransaction(e)),r.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Yg(e,this.networkProvider))}catch(r){let n=Bt(r);throw Se.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e})}static queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(a){let u=Bt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},uf=cf;uf.storage=Te,uf.destroy=()=>{cf.networkProvider=void 0,cf.dappProvider=void 0,cf.initOptions=void 0,Se.clear()};var export_Account=uX.Account;var export_Address=aX.Address;var export_AddressType=KR.AddressType;var export_AddressValue=KR.AddressValue;var export_BigUIntType=Nn.BigUIntType;var export_BigUIntValue=Nn.BigUIntValue;var export_BooleanType=kR.BooleanType;var export_BooleanValue=kR.BooleanValue;var export_BytesType=QR.BytesType;var export_BytesValue=QR.BytesValue;var export_ContractFunction=dX.ContractFunction;var export_GasEstimator=oX.GasEstimator;var export_SmartContract=hX.SmartContract;var export_TokenTransfer=iX.TokenTransfer;var export_Transaction=cX.Transaction;var export_TransactionPayload=lX.TransactionPayload;var export_TransactionWatcher=fX.TransactionWatcher;var export_TransferTransactionsFactory=sX.TransferTransactionsFactory;var export_U16Type=Nn.U16Type;var export_U16Value=Nn.U16Value;var export_U32Type=Nn.U32Type;var export_U32Value=Nn.U32Value;var export_U64Type=Nn.U64Type;var export_U64Value=Nn.U64Value;var export_U8Type=Nn.U8Type;var export_U8Value=Nn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,uf as ElvenJS,export_GasEstimator as GasEstimator,Io as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; +`);let o=BJ(e,r,i),a=Qg.getSymbolSize(e),u=new _J(a);return xJ(u,e),NJ(u),DJ(u,e),b_(u,r,0),e>=7&&OJ(u,e),PJ(u,o),isNaN(n)&&(n=I_.getBestMask(u,b_.bind(null,u,r))),I_.applyMask(n,u),b_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}yR.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=A_.M,i,s;return typeof r<"u"&&(n=A_.from(r.errorCorrectionLevel,A_.M),i=Gg.from(r.version),s=I_.from(r.maskPattern),r.toSJISFunc&&Qg.setToSJISFunction(r.toSJISFunc)),LJ(e,i,n,s)}});var C_=v(xo=>{c();function wR(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}xo.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:wR(e.color.dark||"#000000ff"),light:wR(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};xo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};xo.getImageWidth=function(e,r){let n=xo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};xo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=xo.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var T_=C_();function FJ(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function MJ(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}kg.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=MJ()),i=T_.getOptions(i);let o=T_.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return T_.qrToImageData(u.data,e,i),FJ(a,s,o),a.putImageData(u,0,0),s};kg.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=kg.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var _R=v(AR=>{c();var UJ=C_();function vR(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function x_(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function qJ(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?x_("M",u+r,.5+l+r):x_("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',y=''+u+l+` +`;return typeof n=="function"&&n(null,y),y}});var IR=v(af=>{c();var VJ=IB(),N_=mR(),bR=ER(),HJ=_R();function D_(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!VJ())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=N_.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=N_.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}af.create=N_.create;af.toCanvas=D_.bind(null,bR.render);af.toDataURL=D_.bind(null,bR.renderToDataURL);af.toString=D_.bind(null,function(t,e,r){return HJ.render(t,r)})});var FR=v(as=>{"use strict";c();var ZJ=as&&as.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LR=as&&as.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZJ(e,t,r)};Object.defineProperty(as,"__esModule",{value:!0});LR(Kl(),as);LR(YA(),as)});c();var eX=be(ob()),tX=be(QC()),rX=be(KC()),nX=be(Zt()),iX=be(Oh()),sX=be(Pc()),oX=be(Cc()),aX=be(ow()),uX=be(Bx()),cX=be(Lh()),jR=be(li()),Nn=be(wc()),GR=be(gc()),QR=be(Xo());c();c();var Hx=be(oE());c();c();var od="elvenjs_state",Ux="https://devnet-api.multiversx.com";var ad="/dapp/init",ud="devnet",qx="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",Vx=["wss://relay.walletconnect.com"],yn={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Te={get(t){let e=localStorage.getItem(od);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(od,JSON.stringify(r))},clear(){localStorage.removeItem(od)}};var cd=()=>Ce(void 0,null,function*(){let t=Hx.ExtensionProvider.getInstance();try{let e=yield t.init(),r=Te.get();if(r!=null&&r.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var qR=be(oE()),VR=be(Vl()),HR=be(Kl());c();var J8=be(Vl());c();c();var Se=class{static set(e,r){if(!e)return;let n=L_(Do({},this.events),{[e]:r});this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){var n,i;!e||!this.events||(i=(n=this.events)[e])==null||i.call(n,...r)}static clear(){this.events=void 0}};c();var bo=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(bo||{});var $u=t=>Ce(void 0,null,function*(){if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Se.run("onLoginPending");let e=yield t.dappProvider.logout();return e&&(Te.clear(),Se.run("onLogout")),e});c();var $8=be(Zt()),Y8=be(Oh());c();var Bt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var Yu=()=>new Date().setHours(new Date().getHours()+24),Sg=t=>Date.now()>t;var ts=t=>Ce(void 0,null,function*(){let e=Te.get("address"),r=Te.get("expires");if(!(r&&Sg(r))&&e&&t.networkProvider){let i=new $8.Address(e),s=new Y8.Account(i);try{let o=yield t.networkProvider.getAccount(i);Te.set("address",e),Te.set("nonce",o.nonce.valueOf()),Te.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});c();function Cg(t){return t[Math.floor(Math.random()*t.length)]}var X8=t=>Ce(void 0,null,function*(){if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{ts(t),Se.run("onLoggedIn")},onClientLogout:()=>$u(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Cg(t.initOptions.walletConnectV2RelayAddresses),n=new J8.WalletConnectV2Provider(e,yn[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return yield n.init(),n}catch(i){console.warn("Can't initialize the Dapp Provider!")}});c();var pB=be(Wt()),Bg=be(Zt()),gB=be(Z8()),yB=be(iB()),mB=be(o_()),wB=be(lB()),EB=be(hB()),vB=be(dB()),AB=be(Mh());var Rg=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){var i,s;this.chainType=r||ud,this.apiUrl=e||((i=yn[this.chainType])==null?void 0:i.apiAddress),this.apiTimeout=n||((s=yn[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,r){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,r,n){return Ce(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=yield a.json();if(!a.ok){let l=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}sendTransaction(e){return Ce(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Ce(this,null,function*(){let r=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Bg.Address((r==null?void 0:r.address)||""),nonce:Number((r==null?void 0:r.nonce)||0),balance:new pB.default((r==null?void 0:r.balance)||0),code:(r==null?void 0:r.code)||"",userName:(r==null?void 0:r.username)||""}})}getTransaction(e){return Ce(this,null,function*(){let r=yield this.apiGet(`transactions/${e}`),n=new gB.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new Bg.Address(r.sender),receiver:new Bg.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:yB.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:mB.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:wB.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}})}queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n,value:i,caller:s}){try{let a=new AB.Query({address:e,func:r,args:n,value:i,caller:s}),u=new vB.ContractQueryRequest(a).toHttpRequest(),l=yield this.apiPost("query",u);return EB.ContractQueryResponse.fromHttpResponse(l)}catch(a){this.handleApiError(a,"query")}})}};c();var _B=(t,e)=>Ce(void 0,null,function*(){let r=yield cd();try{r&&(yield r.login()),Se.run("onLoginPending")}catch(i){let s=Bt(i);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!r)throw new Error("Error: There were problems with auth provider initialization!");let{signature:n}=r.account;if(e&&Te.set("loginToken",e),n&&Te.set("signature",n),t.networkProvider)try{let i=yield r.getAddress();if(!i)throw new Error("Canceled!");return Te.set("address",i),Te.set("loginMethod","browser-extension"),Te.set("expires",Yu()),yield ts(t),Se.run("onLoggedIn"),r}catch(i){console.warn(`Something went wrong trying to synchronize the user account: ${i==null?void 0:i.message}`),Se.run("onLogout")}});c();c();var SR=be(IR()),CR=be(Vl());var GJ=t=>{var r;let e=document.createElement("template");return e.innerHTML=t.trim(),(r=e.content.firstChild)==null?void 0:r.cloneNode(!0)},QJ=t=>{let e=`${qx}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},kJ=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},KJ=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},O_={},zJ=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",O_[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:O_[t.topic].signal}),r},Kg={},WJ=(t,e,r)=>{var o,a;let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${(o=t.peerMetadata)==null?void 0:o.description} (${(a=t.peerMetadata)==null?void 0:a.url})`,n.appendChild(i);let s=zJ(t,e);return n.appendChild(s),Kg[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Kg[t.topic].signal}),n},$J=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},YJ=t=>{if(!t)return;let e=document.getElementById(t);e==null||e.remove()},JJ=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),XJ=t=>Ce(void 0,null,function*(){return t?yield SR.default.toString(t,{type:"svg"}):void 0}),TR=(t,e,r,n)=>Ce(void 0,null,function*(){if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=yield XJ(e),o;if(s&&(o=GJ(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),JJ()&&i.appendChild(QJ(e))),i&&r instanceof CR.WalletConnectV2Provider){let a=r.pairings,u=f=>Ce(void 0,null,function*(){try{f&&(yield r.logout({topic:f}),YJ(f))}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${y}`)}finally{Kg[f].abort()}}),l=f=>Ce(void 0,null,function*(){try{let{approval:d}=yield r.connect({topic:f,methods:["mvx_cancelAction"]});if(!document.getElementById("elven-wc-pairing-item-confirm-msessage")){let w=document.getElementById(f);w==null||w.after($J())}yield r.login({approval:d,token:n})}catch(d){let y=Bt(d);console.warn(`Something went wrong trying to login the user: ${y}`)}finally{for(let d of Object.values(Kg))d==null||d.abort();for(let d of Object.values(O_))d==null||d.abort()}});if(a&&a.length>0){let f=kJ();i.appendChild(f);let d=KJ();f.appendChild(d);for(let y of a){let w=WJ(y,u,l);f.appendChild(w)}}}return i});var zg=be(Vl());var xR=(t,e,r)=>Ce(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let n=Cg(t.initOptions.walletConnectV2RelayAddresses);if(!n||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let i,s={onClientLogin:()=>Ce(void 0,null,function*(){if(t.dappProvider instanceof zg.WalletConnectV2Provider){Se.run("onLoginPending");let a=yield t.dappProvider.getAddress(),u=yield t.dappProvider.getSignature();Te.set("address",a),Te.set("loginMethod","mobile"),Te.set("expires",Yu()),yield ts(t),u&&Te.set("signature",u),r&&Te.set("loginToken",r),Se.run("onLoggedIn"),i==null||i.replaceChildren()}}),onClientLogout:()=>Ce(void 0,null,function*(){t.dappProvider instanceof zg.WalletConnectV2Provider&&(yield $u(t),Se.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new zg.WalletConnectV2Provider(s,yn[t.initOptions.chainType].shortId,n,t.initOptions.walletConnectV2ProjectId);try{if(o){t.dappProvider=o,Se.run("onQrPending"),yield o.init();let{uri:a,approval:u}=yield o.connect({methods:["mvx_cancelAction"]}),l=r?`${a}&token=${r}`:a;return e&&l&&(i=yield TR(e,l,o,r),Se.run("onQrLoaded")),yield o.login({approval:u,token:r}),o}}catch(a){let u=Bt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.run("onLogout")}});c();var NR=be(Kl());var DR=(t,e,r)=>Ce(void 0,null,function*(){let n=new NR.WalletProvider(`${t}${ad}`),i=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=Do({callbackUrl:i},r?{token:r}:{});try{return Se.run("onLoginPending"),Te.set("loginMethod","web-wallet"),yield n.login(s),Te.set("expires",Yu()),r&&Te.set("loginToken",r),n}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Te.set("loginMethod",""),Se.run("onLogout")}});c();var No=t=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var OR=be(Kl());var PR=t=>Ce(void 0,null,function*(){let e=No("signature"),r=No("address"),n=Te.get("address");if(e&&Te.set("signature",e),r||n)return r&&(Te.set("address",r),window.history.replaceState(null,"",window.location.pathname)),new OR.WalletProvider(`${t}${ad}`)});c();var BR=be(Oh()),RR=be(ow());var Wg=(t,e)=>Ce(void 0,null,function*(){Se.run("onTxSent",t),yield new RR.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new BR.Account(n),s=yield e.getAccount(n);i.update(s),Te.set("address",i.address.bech32()),Te.set("nonce",i.getNonceThenIncrement().valueOf()),Te.set("balance",i.balance.toString()),Se.run("onTxFinalized",t)});c();var $g=be(FR()),MR=be(Pc());var UR=(t,e,r)=>Ce(void 0,null,function*(){if(No($g.WALLET_PROVIDER_CALLBACK_PARAM)===$g.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i==null?void 0:i[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=MR.Transaction.fromPlainObject(s);o.setNonce(r);try{Se.run("onTxStarted",o),yield e.sendTransaction(o),yield Wg(o,e)}catch(a){let u=Bt(a);throw Se.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var cf=class{static init(e){return Ce(this,null,function*(){let r=Te.get();if(r.expires&&Sg(r.expires)){Te.clear(),this.dappProvider=void 0;return}this.initOptions=Do({chainType:ud,apiUrl:Ux,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:Vx},e),this.networkProvider=new Rg(this.initOptions),this.initOptions.onLoginPending&&Se.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Se.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Se.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Se.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Se.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Se.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Se.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Se.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Se.set("onTxError",this.initOptions.onTxError),((r==null?void 0:r.address)||r.loginMethod==="web-wallet"&&No("address"))&&(r!=null&&r.loginMethod)&&(Se.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=yield cd()),r.loginMethod==="mobile"&&(this.dappProvider=yield X8(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield PR(yn[this.initOptions.chainType].walletAddress)),yield ts(this),Se.run("onLoggedIn"),r.loginMethod==="web-wallet"&&(yield UR(this.dappProvider,this.networkProvider,r.nonce)))})}static login(e,r){return Ce(this,null,function*(){var i;if(!Object.values(bo).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield _B(this,r==null?void 0:r.token);this.dappProvider=s}if(e==="mobile"){let s=yield xR(this,r==null?void 0:r.qrCodeContainer,r==null?void 0:r.token);this.dappProvider=s}if(e==="web-wallet"&&((i=this.initOptions)!=null&&i.chainType)){let s=yield DR(yn[this.initOptions.chainType].walletAddress,r==null?void 0:r.callbackRoute,r==null?void 0:r.token);this.dappProvider=s}}catch(s){let o=Bt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Ce(this,null,function*(){try{let e=yield $u(this);return this.dappProvider=void 0,e}catch(e){let r=Bt(e);console.warn("Something went wrong when logging out: ",r)}})}static signAndSendTransaction(e){return Ce(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Se.run("onTxStarted",e);let r=Te.get();e.setNonce(r.nonce),this.dappProvider instanceof qR.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof VR.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof HR.WalletProvider&&(yield this.dappProvider.signTransaction(e)),r.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Wg(e,this.networkProvider))}catch(r){let n=Bt(r);throw Se.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e})}static queryContract(o){return Ce(this,arguments,function*({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(a){let u=Bt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},uf=cf;uf.storage=Te,uf.destroy=()=>{cf.networkProvider=void 0,cf.dappProvider=void 0,cf.initOptions=void 0,Se.clear()};var export_Account=iX.Account;var export_Address=nX.Address;var export_AddressType=QR.AddressType;var export_AddressValue=QR.AddressValue;var export_BigUIntType=Nn.BigUIntType;var export_BigUIntValue=Nn.BigUIntValue;var export_BooleanType=GR.BooleanType;var export_BooleanValue=GR.BooleanValue;var export_BytesType=jR.BytesType;var export_BytesValue=jR.BytesValue;var export_ContractFunction=cX.ContractFunction;var export_GasEstimator=rX.GasEstimator;var export_SmartContract=uX.SmartContract;var export_TokenTransfer=eX.TokenTransfer;var export_Transaction=sX.Transaction;var export_TransactionPayload=oX.TransactionPayload;var export_TransactionWatcher=aX.TransactionWatcher;var export_TransferTransactionsFactory=tX.TransferTransactionsFactory;var export_U16Type=Nn.U16Type;var export_U16Value=Nn.U16Value;var export_U32Type=Nn.U32Type;var export_U32Value=Nn.U32Value;var export_U64Type=Nn.U64Type;var export_U64Value=Nn.U64Value;var export_U8Type=Nn.U8Type;var export_U8Value=Nn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,uf as ElvenJS,export_GasEstimator as GasEstimator,bo as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; /*! Bundled license information: ieee754/index.js: diff --git a/package-lock.json b/package-lock.json index 3110a5d..3acb814 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,30 +1,30 @@ { "name": "elven.js", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "elven.js", - "version": "0.9.0", + "version": "0.9.1", "license": "MIT", "devDependencies": { - "@multiversx/sdk-core": "12.1.0", + "@multiversx/sdk-core": "12.2.1", "@multiversx/sdk-extension-provider": "2.0.7", - "@multiversx/sdk-network-providers": "1.3.0", + "@multiversx/sdk-network-providers": "1.4.0", "@multiversx/sdk-wallet-connect-provider": "3.2.1", - "@multiversx/sdk-web-wallet-provider": "2.3.0", + "@multiversx/sdk-web-wallet-provider": "3.0.0", "@types/qrcode": "1.5.0", "@types/serve-handler": "6.1.1", - "@typescript-eslint/eslint-plugin": "5.57.1", - "@typescript-eslint/parser": "5.57.1", - "esbuild": "0.17.16", - "eslint": "8.38.0", + "@typescript-eslint/eslint-plugin": "5.59.5", + "@typescript-eslint/parser": "5.59.5", + "esbuild": "0.17.19", + "eslint": "8.40.0", "eslint-config-prettier": "8.8.0", "eslint-plugin-prettier": "4.2.1", "node-stdlib-browser": "1.2.0", - "prettier": "2.8.7", - "qrcode": "1.5.1", + "prettier": "2.8.8", + "qrcode": "1.5.3", "rimraf": "5.0.0", "serve-handler": "6.1.5", "typescript": "5.0.4" @@ -43,9 +43,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.16.tgz", - "integrity": "sha512-baLqRpLe4JnKrUXLJChoTN0iXZH7El/mu58GE3WIA6/H834k0XWvLRmGLG8y8arTRS9hJJibPnF0tiGhmWeZgw==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", "cpu": [ "arm" ], @@ -59,9 +59,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.16.tgz", - "integrity": "sha512-QX48qmsEZW+gcHgTmAj+x21mwTz8MlYQBnzF6861cNdQGvj2jzzFjqH0EBabrIa/WVZ2CHolwMoqxVryqKt8+Q==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", "cpu": [ "arm64" ], @@ -75,9 +75,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.16.tgz", - "integrity": "sha512-G4wfHhrrz99XJgHnzFvB4UwwPxAWZaZBOFXh+JH1Duf1I4vIVfuYY9uVLpx4eiV2D/Jix8LJY+TAdZ3i40tDow==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", "cpu": [ "x64" ], @@ -91,9 +91,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.16.tgz", - "integrity": "sha512-/Ofw8UXZxuzTLsNFmz1+lmarQI6ztMZ9XktvXedTbt3SNWDn0+ODTwxExLYQ/Hod91EZB4vZPQJLoqLF0jvEzA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", "cpu": [ "arm64" ], @@ -107,9 +107,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.16.tgz", - "integrity": "sha512-SzBQtCV3Pdc9kyizh36Ol+dNVhkDyIrGb/JXZqFq8WL37LIyrXU0gUpADcNV311sCOhvY+f2ivMhb5Tuv8nMOQ==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", "cpu": [ "x64" ], @@ -123,9 +123,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.16.tgz", - "integrity": "sha512-ZqftdfS1UlLiH1DnS2u3It7l4Bc3AskKeu+paJSfk7RNOMrOxmeFDhLTMQqMxycP1C3oj8vgkAT6xfAuq7ZPRA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", "cpu": [ "arm64" ], @@ -139,9 +139,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.16.tgz", - "integrity": "sha512-rHV6zNWW1tjgsu0dKQTX9L0ByiJHHLvQKrWtnz8r0YYJI27FU3Xu48gpK2IBj1uCSYhJ+pEk6Y0Um7U3rIvV8g==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", "cpu": [ "x64" ], @@ -155,9 +155,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.16.tgz", - "integrity": "sha512-n4O8oVxbn7nl4+m+ISb0a68/lcJClIbaGAoXwqeubj/D1/oMMuaAXmJVfFlRjJLu/ZvHkxoiFJnmbfp4n8cdSw==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", "cpu": [ "arm" ], @@ -171,9 +171,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.16.tgz", - "integrity": "sha512-8yoZhGkU6aHu38WpaM4HrRLTFc7/VVD9Q2SvPcmIQIipQt2I/GMTZNdEHXoypbbGao5kggLcxg0iBKjo0SQYKA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", "cpu": [ "arm64" ], @@ -187,9 +187,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.16.tgz", - "integrity": "sha512-9ZBjlkdaVYxPNO8a7OmzDbOH9FMQ1a58j7Xb21UfRU29KcEEU3VTHk+Cvrft/BNv0gpWJMiiZ/f4w0TqSP0gLA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", "cpu": [ "ia32" ], @@ -203,9 +203,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.16.tgz", - "integrity": "sha512-TIZTRojVBBzdgChY3UOG7BlPhqJz08AL7jdgeeu+kiObWMFzGnQD7BgBBkWRwOtKR1i2TNlO7YK6m4zxVjjPRQ==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", "cpu": [ "loong64" ], @@ -219,9 +219,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.16.tgz", - "integrity": "sha512-UPeRuFKCCJYpBbIdczKyHLAIU31GEm0dZl1eMrdYeXDH+SJZh/i+2cAmD3A1Wip9pIc5Sc6Kc5cFUrPXtR0XHA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", "cpu": [ "mips64el" ], @@ -235,9 +235,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.16.tgz", - "integrity": "sha512-io6yShgIEgVUhExJejJ21xvO5QtrbiSeI7vYUnr7l+v/O9t6IowyhdiYnyivX2X5ysOVHAuyHW+Wyi7DNhdw6Q==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", "cpu": [ "ppc64" ], @@ -251,9 +251,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.16.tgz", - "integrity": "sha512-WhlGeAHNbSdG/I2gqX2RK2gfgSNwyJuCiFHMc8s3GNEMMHUI109+VMBfhVqRb0ZGzEeRiibi8dItR3ws3Lk+cA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", "cpu": [ "riscv64" ], @@ -267,9 +267,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.16.tgz", - "integrity": "sha512-gHRReYsJtViir63bXKoFaQ4pgTyah4ruiMRQ6im9YZuv+gp3UFJkNTY4sFA73YDynmXZA6hi45en4BGhNOJUsw==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", "cpu": [ "s390x" ], @@ -283,9 +283,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.16.tgz", - "integrity": "sha512-mfiiBkxEbUHvi+v0P+TS7UnA9TeGXR48aK4XHkTj0ZwOijxexgMF01UDFaBX7Q6CQsB0d+MFNv9IiXbIHTNd4g==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", "cpu": [ "x64" ], @@ -299,9 +299,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.16.tgz", - "integrity": "sha512-n8zK1YRDGLRZfVcswcDMDM0j2xKYLNXqei217a4GyBxHIuPMGrrVuJ+Ijfpr0Kufcm7C1k/qaIrGy6eG7wvgmA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", "cpu": [ "x64" ], @@ -315,9 +315,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.16.tgz", - "integrity": "sha512-lEEfkfsUbo0xC47eSTBqsItXDSzwzwhKUSsVaVjVji07t8+6KA5INp2rN890dHZeueXJAI8q0tEIfbwVRYf6Ew==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", "cpu": [ "x64" ], @@ -331,9 +331,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.16.tgz", - "integrity": "sha512-jlRjsuvG1fgGwnE8Afs7xYDnGz0dBgTNZfgCK6TlvPH3Z13/P5pi6I57vyLE8qZYLrGVtwcm9UbUx1/mZ8Ukag==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", "cpu": [ "x64" ], @@ -347,9 +347,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.16.tgz", - "integrity": "sha512-TzoU2qwVe2boOHl/3KNBUv2PNUc38U0TNnzqOAcgPiD/EZxT2s736xfC2dYQbszAwo4MKzzwBV0iHjhfjxMimg==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", "cpu": [ "arm64" ], @@ -363,9 +363,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.16.tgz", - "integrity": "sha512-B8b7W+oo2yb/3xmwk9Vc99hC9bNolvqjaTZYEfMQhzdpBsjTvZBlXQ/teUE55Ww6sg//wlcDjOaqldOKyigWdA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", "cpu": [ "ia32" ], @@ -379,9 +379,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.16.tgz", - "integrity": "sha512-xJ7OH/nanouJO9pf03YsL9NAFQBHd8AqfrQd7Pf5laGyyTt/gToul6QYOA/i5i/q8y9iaM5DQFNTgpi995VkOg==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", "cpu": [ "x64" ], @@ -419,14 +419,14 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", - "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", + "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.1", + "espree": "^9.5.2", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -442,9 +442,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.38.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz", - "integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==", + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.40.0.tgz", + "integrity": "sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -509,9 +509,9 @@ } }, "node_modules/@multiversx/sdk-core": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.1.0.tgz", - "integrity": "sha512-WJ+Ox/en4BUUFkT8n/UzdNEVeB1nfetTf2HmifaiTSuoXvBb2KkdhCx37fU3udoildlFTgaWfr/k38C+p4zxqA==", + "version": "12.2.1", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.2.1.tgz", + "integrity": "sha512-jnVwr7ljZ3AD5rN/lifrNq5uZU7CenNVqnCzu8Ks1fVJ/TOZM6VUkVXoSvceweXY0vw7FyH6FBVRUQqWPWbZzg==", "dev": true, "dependencies": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -531,9 +531,9 @@ "dev": true }, "node_modules/@multiversx/sdk-network-providers": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.3.0.tgz", - "integrity": "sha512-UCoQDcjccwwkTySMGeiG4taW17UEr4oBQ4t3kDeqj704PVEnRKKGAjyYWlwbbXZSTvqtuKeYNYaEeWdSrBcdew==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.4.0.tgz", + "integrity": "sha512-a9vcY6wNM3ZccApULXbTCPp3/dAu4J6uH0go3jHy8YB0iH9nKiTLQLUD+1fM0lJmuC9Tk9Q+EeAj7OJzQqHKkQ==", "dev": true, "dependencies": { "axios": "0.24.0", @@ -571,12 +571,15 @@ } }, "node_modules/@multiversx/sdk-web-wallet-provider": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-2.3.0.tgz", - "integrity": "sha512-ENaFPKH6wF5XYic/BP3eSjANl0We3HQLUQfNdQi/7secylx1+HCBzg5C/EXLb+53UM+WSsvuz+4lR2fwcoEy0g==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.0.0.tgz", + "integrity": "sha512-JzyOJJKx+vr1kMRHwVx6Y/SBSo/yUeWAHPeUJtvmjyRrTEhniYUhuKgy6U8lkD4djLKf8G/qpUOXwvfu4fbXuw==", "dev": true, "dependencies": { "qs": "6.10.3" + }, + "peerDependencies": { + "@multiversx/sdk-core": ">= 12.1.0" } }, "node_modules/@nodelib/fs.scandir": { @@ -894,9 +897,9 @@ } }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", "dev": true }, "node_modules/@types/serve-handler": { @@ -909,15 +912,15 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.57.1.tgz", - "integrity": "sha512-1MeobQkQ9tztuleT3v72XmY0XuKXVXusAhryoLuU5YZ+mXoYKZP9SQ7Flulh1NX4DTjpGTc2b/eMu4u7M7dhnQ==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz", + "integrity": "sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/type-utils": "5.57.1", - "@typescript-eslint/utils": "5.57.1", + "@typescript-eslint/scope-manager": "5.59.5", + "@typescript-eslint/type-utils": "5.59.5", + "@typescript-eslint/utils": "5.59.5", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -943,14 +946,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.57.1.tgz", - "integrity": "sha512-hlA0BLeVSA/wBPKdPGxoVr9Pp6GutGoY380FEhbVi0Ph4WNe8kLvqIRx76RSQt1lynZKfrXKs0/XeEk4zZycuA==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.5.tgz", + "integrity": "sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/typescript-estree": "5.57.1", + "@typescript-eslint/scope-manager": "5.59.5", + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/typescript-estree": "5.59.5", "debug": "^4.3.4" }, "engines": { @@ -970,13 +973,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.57.1.tgz", - "integrity": "sha512-N/RrBwEUKMIYxSKl0oDK5sFVHd6VI7p9K5MyUlVYAY6dyNb/wHUqndkTd3XhpGlXgnQsBkRZuu4f9kAHghvgPw==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz", + "integrity": "sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/visitor-keys": "5.57.1" + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/visitor-keys": "5.59.5" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -987,13 +990,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.57.1.tgz", - "integrity": "sha512-/RIPQyx60Pt6ga86hKXesXkJ2WOS4UemFrmmq/7eOyiYjYv/MUSHPlkhU6k9T9W1ytnTJueqASW+wOmW4KrViw==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.5.tgz", + "integrity": "sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.57.1", - "@typescript-eslint/utils": "5.57.1", + "@typescript-eslint/typescript-estree": "5.59.5", + "@typescript-eslint/utils": "5.59.5", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1014,9 +1017,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.57.1.tgz", - "integrity": "sha512-bSs4LOgyV3bJ08F5RDqO2KXqg3WAdwHCu06zOqcQ6vqbTJizyBhuh1o1ImC69X4bV2g1OJxbH71PJqiO7Y1RuA==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.5.tgz", + "integrity": "sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1027,13 +1030,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.57.1.tgz", - "integrity": "sha512-A2MZqD8gNT0qHKbk2wRspg7cHbCDCk2tcqt6ScCFLr5Ru8cn+TCfM786DjPhqwseiS+PrYwcXht5ztpEQ6TFTw==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz", + "integrity": "sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/visitor-keys": "5.57.1", + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/visitor-keys": "5.59.5", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1054,17 +1057,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.57.1.tgz", - "integrity": "sha512-kN6vzzf9NkEtawECqze6v99LtmDiUJCVpvieTFA1uL7/jDghiJGubGZ5csicYHU1Xoqb3oH/R5cN5df6W41Nfg==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.5.tgz", + "integrity": "sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/typescript-estree": "5.57.1", + "@typescript-eslint/scope-manager": "5.59.5", + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/typescript-estree": "5.59.5", "eslint-scope": "^5.1.1", "semver": "^7.3.7" }, @@ -1080,12 +1083,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.57.1.tgz", - "integrity": "sha512-RjQrAniDU0CEk5r7iphkm731zKlFiUjvcBS2yHAg8WWqFMCaCrD0rKEVOMUyMMcbGPZ0bPp56srkGWrgfZqLRA==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz", + "integrity": "sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.57.1", + "@typescript-eslint/types": "5.59.5", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -2556,9 +2559,9 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.16.tgz", - "integrity": "sha512-aeSuUKr9aFVY9Dc8ETVELGgkj4urg5isYx8pLf4wlGgB0vTFjxJQdHnNH6Shmx4vYYrOTLCHtRI5i1XZ9l2Zcg==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", "dev": true, "hasInstallScript": true, "bin": { @@ -2568,28 +2571,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.17.16", - "@esbuild/android-arm64": "0.17.16", - "@esbuild/android-x64": "0.17.16", - "@esbuild/darwin-arm64": "0.17.16", - "@esbuild/darwin-x64": "0.17.16", - "@esbuild/freebsd-arm64": "0.17.16", - "@esbuild/freebsd-x64": "0.17.16", - "@esbuild/linux-arm": "0.17.16", - "@esbuild/linux-arm64": "0.17.16", - "@esbuild/linux-ia32": "0.17.16", - "@esbuild/linux-loong64": "0.17.16", - "@esbuild/linux-mips64el": "0.17.16", - "@esbuild/linux-ppc64": "0.17.16", - "@esbuild/linux-riscv64": "0.17.16", - "@esbuild/linux-s390x": "0.17.16", - "@esbuild/linux-x64": "0.17.16", - "@esbuild/netbsd-x64": "0.17.16", - "@esbuild/openbsd-x64": "0.17.16", - "@esbuild/sunos-x64": "0.17.16", - "@esbuild/win32-arm64": "0.17.16", - "@esbuild/win32-ia32": "0.17.16", - "@esbuild/win32-x64": "0.17.16" + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" } }, "node_modules/escalade": { @@ -2614,15 +2617,15 @@ } }, "node_modules/eslint": { - "version": "8.38.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz", - "integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==", + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.40.0.tgz", + "integrity": "sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.2", - "@eslint/js": "8.38.0", + "@eslint/eslintrc": "^2.0.3", + "@eslint/js": "8.40.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -2632,9 +2635,9 @@ "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-visitor-keys": "^3.4.0", - "espree": "^9.5.1", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.1", + "espree": "^9.5.2", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -2717,9 +2720,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", - "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", + "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2729,9 +2732,9 @@ } }, "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -2739,6 +2742,9 @@ }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint/node_modules/estraverse": { @@ -2751,14 +2757,14 @@ } }, "node_modules/espree": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", - "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", + "version": "9.5.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", + "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", "dev": true, "dependencies": { "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.0" + "eslint-visitor-keys": "^3.4.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4380,9 +4386,9 @@ } }, "node_modules/prettier": { - "version": "2.8.7", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", - "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -4474,9 +4480,9 @@ "dev": true }, "node_modules/qrcode": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.1.tgz", - "integrity": "sha512-nS8NJ1Z3md8uTjKtP+SGGhfqmTCs5flU/xR623oI0JX+Wepz9R8UrRVCTBTJm3qGw3rH6jJ6MUHjkDx15cxSSg==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.3.tgz", + "integrity": "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==", "dev": true, "dependencies": { "dijkstrajs": "^1.0.1", @@ -5643,156 +5649,156 @@ } }, "@esbuild/android-arm": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.16.tgz", - "integrity": "sha512-baLqRpLe4JnKrUXLJChoTN0iXZH7El/mu58GE3WIA6/H834k0XWvLRmGLG8y8arTRS9hJJibPnF0tiGhmWeZgw==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", "dev": true, "optional": true }, "@esbuild/android-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.16.tgz", - "integrity": "sha512-QX48qmsEZW+gcHgTmAj+x21mwTz8MlYQBnzF6861cNdQGvj2jzzFjqH0EBabrIa/WVZ2CHolwMoqxVryqKt8+Q==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", "dev": true, "optional": true }, "@esbuild/android-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.16.tgz", - "integrity": "sha512-G4wfHhrrz99XJgHnzFvB4UwwPxAWZaZBOFXh+JH1Duf1I4vIVfuYY9uVLpx4eiV2D/Jix8LJY+TAdZ3i40tDow==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", "dev": true, "optional": true }, "@esbuild/darwin-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.16.tgz", - "integrity": "sha512-/Ofw8UXZxuzTLsNFmz1+lmarQI6ztMZ9XktvXedTbt3SNWDn0+ODTwxExLYQ/Hod91EZB4vZPQJLoqLF0jvEzA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", "dev": true, "optional": true }, "@esbuild/darwin-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.16.tgz", - "integrity": "sha512-SzBQtCV3Pdc9kyizh36Ol+dNVhkDyIrGb/JXZqFq8WL37LIyrXU0gUpADcNV311sCOhvY+f2ivMhb5Tuv8nMOQ==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", "dev": true, "optional": true }, "@esbuild/freebsd-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.16.tgz", - "integrity": "sha512-ZqftdfS1UlLiH1DnS2u3It7l4Bc3AskKeu+paJSfk7RNOMrOxmeFDhLTMQqMxycP1C3oj8vgkAT6xfAuq7ZPRA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", "dev": true, "optional": true }, "@esbuild/freebsd-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.16.tgz", - "integrity": "sha512-rHV6zNWW1tjgsu0dKQTX9L0ByiJHHLvQKrWtnz8r0YYJI27FU3Xu48gpK2IBj1uCSYhJ+pEk6Y0Um7U3rIvV8g==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", "dev": true, "optional": true }, "@esbuild/linux-arm": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.16.tgz", - "integrity": "sha512-n4O8oVxbn7nl4+m+ISb0a68/lcJClIbaGAoXwqeubj/D1/oMMuaAXmJVfFlRjJLu/ZvHkxoiFJnmbfp4n8cdSw==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", "dev": true, "optional": true }, "@esbuild/linux-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.16.tgz", - "integrity": "sha512-8yoZhGkU6aHu38WpaM4HrRLTFc7/VVD9Q2SvPcmIQIipQt2I/GMTZNdEHXoypbbGao5kggLcxg0iBKjo0SQYKA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", "dev": true, "optional": true }, "@esbuild/linux-ia32": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.16.tgz", - "integrity": "sha512-9ZBjlkdaVYxPNO8a7OmzDbOH9FMQ1a58j7Xb21UfRU29KcEEU3VTHk+Cvrft/BNv0gpWJMiiZ/f4w0TqSP0gLA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", "dev": true, "optional": true }, "@esbuild/linux-loong64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.16.tgz", - "integrity": "sha512-TIZTRojVBBzdgChY3UOG7BlPhqJz08AL7jdgeeu+kiObWMFzGnQD7BgBBkWRwOtKR1i2TNlO7YK6m4zxVjjPRQ==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", "dev": true, "optional": true }, "@esbuild/linux-mips64el": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.16.tgz", - "integrity": "sha512-UPeRuFKCCJYpBbIdczKyHLAIU31GEm0dZl1eMrdYeXDH+SJZh/i+2cAmD3A1Wip9pIc5Sc6Kc5cFUrPXtR0XHA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", "dev": true, "optional": true }, "@esbuild/linux-ppc64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.16.tgz", - "integrity": "sha512-io6yShgIEgVUhExJejJ21xvO5QtrbiSeI7vYUnr7l+v/O9t6IowyhdiYnyivX2X5ysOVHAuyHW+Wyi7DNhdw6Q==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", "dev": true, "optional": true }, "@esbuild/linux-riscv64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.16.tgz", - "integrity": "sha512-WhlGeAHNbSdG/I2gqX2RK2gfgSNwyJuCiFHMc8s3GNEMMHUI109+VMBfhVqRb0ZGzEeRiibi8dItR3ws3Lk+cA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", "dev": true, "optional": true }, "@esbuild/linux-s390x": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.16.tgz", - "integrity": "sha512-gHRReYsJtViir63bXKoFaQ4pgTyah4ruiMRQ6im9YZuv+gp3UFJkNTY4sFA73YDynmXZA6hi45en4BGhNOJUsw==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", "dev": true, "optional": true }, "@esbuild/linux-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.16.tgz", - "integrity": "sha512-mfiiBkxEbUHvi+v0P+TS7UnA9TeGXR48aK4XHkTj0ZwOijxexgMF01UDFaBX7Q6CQsB0d+MFNv9IiXbIHTNd4g==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", "dev": true, "optional": true }, "@esbuild/netbsd-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.16.tgz", - "integrity": "sha512-n8zK1YRDGLRZfVcswcDMDM0j2xKYLNXqei217a4GyBxHIuPMGrrVuJ+Ijfpr0Kufcm7C1k/qaIrGy6eG7wvgmA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", "dev": true, "optional": true }, "@esbuild/openbsd-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.16.tgz", - "integrity": "sha512-lEEfkfsUbo0xC47eSTBqsItXDSzwzwhKUSsVaVjVji07t8+6KA5INp2rN890dHZeueXJAI8q0tEIfbwVRYf6Ew==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", "dev": true, "optional": true }, "@esbuild/sunos-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.16.tgz", - "integrity": "sha512-jlRjsuvG1fgGwnE8Afs7xYDnGz0dBgTNZfgCK6TlvPH3Z13/P5pi6I57vyLE8qZYLrGVtwcm9UbUx1/mZ8Ukag==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", "dev": true, "optional": true }, "@esbuild/win32-arm64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.16.tgz", - "integrity": "sha512-TzoU2qwVe2boOHl/3KNBUv2PNUc38U0TNnzqOAcgPiD/EZxT2s736xfC2dYQbszAwo4MKzzwBV0iHjhfjxMimg==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", "dev": true, "optional": true }, "@esbuild/win32-ia32": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.16.tgz", - "integrity": "sha512-B8b7W+oo2yb/3xmwk9Vc99hC9bNolvqjaTZYEfMQhzdpBsjTvZBlXQ/teUE55Ww6sg//wlcDjOaqldOKyigWdA==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", "dev": true, "optional": true }, "@esbuild/win32-x64": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.16.tgz", - "integrity": "sha512-xJ7OH/nanouJO9pf03YsL9NAFQBHd8AqfrQd7Pf5laGyyTt/gToul6QYOA/i5i/q8y9iaM5DQFNTgpi995VkOg==", + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", "dev": true, "optional": true }, @@ -5812,14 +5818,14 @@ "dev": true }, "@eslint/eslintrc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", - "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", + "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.1", + "espree": "^9.5.2", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -5829,9 +5835,9 @@ } }, "@eslint/js": { - "version": "8.38.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz", - "integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==", + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.40.0.tgz", + "integrity": "sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==", "dev": true }, "@humanwhocodes/config-array": { @@ -5880,9 +5886,9 @@ } }, "@multiversx/sdk-core": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.1.0.tgz", - "integrity": "sha512-WJ+Ox/en4BUUFkT8n/UzdNEVeB1nfetTf2HmifaiTSuoXvBb2KkdhCx37fU3udoildlFTgaWfr/k38C+p4zxqA==", + "version": "12.2.1", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.2.1.tgz", + "integrity": "sha512-jnVwr7ljZ3AD5rN/lifrNq5uZU7CenNVqnCzu8Ks1fVJ/TOZM6VUkVXoSvceweXY0vw7FyH6FBVRUQqWPWbZzg==", "dev": true, "requires": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -5902,9 +5908,9 @@ "dev": true }, "@multiversx/sdk-network-providers": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.3.0.tgz", - "integrity": "sha512-UCoQDcjccwwkTySMGeiG4taW17UEr4oBQ4t3kDeqj704PVEnRKKGAjyYWlwbbXZSTvqtuKeYNYaEeWdSrBcdew==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.4.0.tgz", + "integrity": "sha512-a9vcY6wNM3ZccApULXbTCPp3/dAu4J6uH0go3jHy8YB0iH9nKiTLQLUD+1fM0lJmuC9Tk9Q+EeAj7OJzQqHKkQ==", "dev": true, "requires": { "axios": "0.24.0", @@ -5944,9 +5950,9 @@ } }, "@multiversx/sdk-web-wallet-provider": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-2.3.0.tgz", - "integrity": "sha512-ENaFPKH6wF5XYic/BP3eSjANl0We3HQLUQfNdQi/7secylx1+HCBzg5C/EXLb+53UM+WSsvuz+4lR2fwcoEy0g==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.0.0.tgz", + "integrity": "sha512-JzyOJJKx+vr1kMRHwVx6Y/SBSo/yUeWAHPeUJtvmjyRrTEhniYUhuKgy6U8lkD4djLKf8G/qpUOXwvfu4fbXuw==", "dev": true, "requires": { "qs": "6.10.3" @@ -6258,9 +6264,9 @@ } }, "@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", "dev": true }, "@types/serve-handler": { @@ -6273,15 +6279,15 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.57.1.tgz", - "integrity": "sha512-1MeobQkQ9tztuleT3v72XmY0XuKXVXusAhryoLuU5YZ+mXoYKZP9SQ7Flulh1NX4DTjpGTc2b/eMu4u7M7dhnQ==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz", + "integrity": "sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg==", "dev": true, "requires": { "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/type-utils": "5.57.1", - "@typescript-eslint/utils": "5.57.1", + "@typescript-eslint/scope-manager": "5.59.5", + "@typescript-eslint/type-utils": "5.59.5", + "@typescript-eslint/utils": "5.59.5", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -6291,53 +6297,53 @@ } }, "@typescript-eslint/parser": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.57.1.tgz", - "integrity": "sha512-hlA0BLeVSA/wBPKdPGxoVr9Pp6GutGoY380FEhbVi0Ph4WNe8kLvqIRx76RSQt1lynZKfrXKs0/XeEk4zZycuA==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.5.tgz", + "integrity": "sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/typescript-estree": "5.57.1", + "@typescript-eslint/scope-manager": "5.59.5", + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/typescript-estree": "5.59.5", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.57.1.tgz", - "integrity": "sha512-N/RrBwEUKMIYxSKl0oDK5sFVHd6VI7p9K5MyUlVYAY6dyNb/wHUqndkTd3XhpGlXgnQsBkRZuu4f9kAHghvgPw==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz", + "integrity": "sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==", "dev": true, "requires": { - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/visitor-keys": "5.57.1" + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/visitor-keys": "5.59.5" } }, "@typescript-eslint/type-utils": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.57.1.tgz", - "integrity": "sha512-/RIPQyx60Pt6ga86hKXesXkJ2WOS4UemFrmmq/7eOyiYjYv/MUSHPlkhU6k9T9W1ytnTJueqASW+wOmW4KrViw==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.5.tgz", + "integrity": "sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.57.1", - "@typescript-eslint/utils": "5.57.1", + "@typescript-eslint/typescript-estree": "5.59.5", + "@typescript-eslint/utils": "5.59.5", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.57.1.tgz", - "integrity": "sha512-bSs4LOgyV3bJ08F5RDqO2KXqg3WAdwHCu06zOqcQ6vqbTJizyBhuh1o1ImC69X4bV2g1OJxbH71PJqiO7Y1RuA==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.5.tgz", + "integrity": "sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.57.1.tgz", - "integrity": "sha512-A2MZqD8gNT0qHKbk2wRspg7cHbCDCk2tcqt6ScCFLr5Ru8cn+TCfM786DjPhqwseiS+PrYwcXht5ztpEQ6TFTw==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz", + "integrity": "sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/visitor-keys": "5.57.1", + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/visitor-keys": "5.59.5", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -6346,28 +6352,28 @@ } }, "@typescript-eslint/utils": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.57.1.tgz", - "integrity": "sha512-kN6vzzf9NkEtawECqze6v99LtmDiUJCVpvieTFA1uL7/jDghiJGubGZ5csicYHU1Xoqb3oH/R5cN5df6W41Nfg==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.5.tgz", + "integrity": "sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/typescript-estree": "5.57.1", + "@typescript-eslint/scope-manager": "5.59.5", + "@typescript-eslint/types": "5.59.5", + "@typescript-eslint/typescript-estree": "5.59.5", "eslint-scope": "^5.1.1", "semver": "^7.3.7" } }, "@typescript-eslint/visitor-keys": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.57.1.tgz", - "integrity": "sha512-RjQrAniDU0CEk5r7iphkm731zKlFiUjvcBS2yHAg8WWqFMCaCrD0rKEVOMUyMMcbGPZ0bPp56srkGWrgfZqLRA==", + "version": "5.59.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz", + "integrity": "sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.57.1", + "@typescript-eslint/types": "5.59.5", "eslint-visitor-keys": "^3.3.0" } }, @@ -7641,33 +7647,33 @@ "dev": true }, "esbuild": { - "version": "0.17.16", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.16.tgz", - "integrity": "sha512-aeSuUKr9aFVY9Dc8ETVELGgkj4urg5isYx8pLf4wlGgB0vTFjxJQdHnNH6Shmx4vYYrOTLCHtRI5i1XZ9l2Zcg==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.17.16", - "@esbuild/android-arm64": "0.17.16", - "@esbuild/android-x64": "0.17.16", - "@esbuild/darwin-arm64": "0.17.16", - "@esbuild/darwin-x64": "0.17.16", - "@esbuild/freebsd-arm64": "0.17.16", - "@esbuild/freebsd-x64": "0.17.16", - "@esbuild/linux-arm": "0.17.16", - "@esbuild/linux-arm64": "0.17.16", - "@esbuild/linux-ia32": "0.17.16", - "@esbuild/linux-loong64": "0.17.16", - "@esbuild/linux-mips64el": "0.17.16", - "@esbuild/linux-ppc64": "0.17.16", - "@esbuild/linux-riscv64": "0.17.16", - "@esbuild/linux-s390x": "0.17.16", - "@esbuild/linux-x64": "0.17.16", - "@esbuild/netbsd-x64": "0.17.16", - "@esbuild/openbsd-x64": "0.17.16", - "@esbuild/sunos-x64": "0.17.16", - "@esbuild/win32-arm64": "0.17.16", - "@esbuild/win32-ia32": "0.17.16", - "@esbuild/win32-x64": "0.17.16" + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" } }, "escalade": { @@ -7683,15 +7689,15 @@ "dev": true }, "eslint": { - "version": "8.38.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz", - "integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==", + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.40.0.tgz", + "integrity": "sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.2", - "@eslint/js": "8.38.0", + "@eslint/eslintrc": "^2.0.3", + "@eslint/js": "8.40.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -7701,9 +7707,9 @@ "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-visitor-keys": "^3.4.0", - "espree": "^9.5.1", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.1", + "espree": "^9.5.2", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -7731,9 +7737,9 @@ }, "dependencies": { "eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", "dev": true, "requires": { "esrecurse": "^4.3.0", @@ -7775,20 +7781,20 @@ } }, "eslint-visitor-keys": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", - "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", + "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", "dev": true }, "espree": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", - "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", + "version": "9.5.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", + "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", "dev": true, "requires": { "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.0" + "eslint-visitor-keys": "^3.4.1" } }, "esquery": { @@ -9014,9 +9020,9 @@ "dev": true }, "prettier": { - "version": "2.8.7", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", - "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true }, "prettier-linter-helpers": { @@ -9090,9 +9096,9 @@ "dev": true }, "qrcode": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.1.tgz", - "integrity": "sha512-nS8NJ1Z3md8uTjKtP+SGGhfqmTCs5flU/xR623oI0JX+Wepz9R8UrRVCTBTJm3qGw3rH6jJ6MUHjkDx15cxSSg==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.3.tgz", + "integrity": "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==", "dev": true, "requires": { "dijkstrajs": "^1.0.1", diff --git a/package.json b/package.json index 9da27fa..b1e6653 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elven.js", - "version": "0.9.0", + "version": "0.9.1", "description": "Authenticate, sign and send transactions on the MultiversX blockchain in the browser.", "browser": { ".": "./build/elven.js" @@ -41,22 +41,22 @@ "prepublishOnly": "npm run build" }, "devDependencies": { - "@multiversx/sdk-core": "12.1.0", + "@multiversx/sdk-core": "12.2.1", "@multiversx/sdk-extension-provider": "2.0.7", - "@multiversx/sdk-network-providers": "1.3.0", + "@multiversx/sdk-network-providers": "1.4.0", "@multiversx/sdk-wallet-connect-provider": "3.2.1", - "@multiversx/sdk-web-wallet-provider": "2.3.0", + "@multiversx/sdk-web-wallet-provider": "3.0.0", "@types/qrcode": "1.5.0", "@types/serve-handler": "6.1.1", - "@typescript-eslint/eslint-plugin": "5.57.1", - "@typescript-eslint/parser": "5.57.1", - "esbuild": "0.17.16", - "eslint": "8.38.0", + "@typescript-eslint/eslint-plugin": "5.59.5", + "@typescript-eslint/parser": "5.59.5", + "esbuild": "0.17.19", + "eslint": "8.40.0", "eslint-config-prettier": "8.8.0", "eslint-plugin-prettier": "4.2.1", "node-stdlib-browser": "1.2.0", - "prettier": "2.8.7", - "qrcode": "1.5.1", + "prettier": "2.8.8", + "qrcode": "1.5.3", "rimraf": "5.0.0", "serve-handler": "6.1.5", "typescript": "5.0.4"