diff --git a/build/elven.js b/build/elven.js index 0632a27..61415e3 100644 --- a/build/elven.js +++ b/build/elven.js @@ -1,10 +1,10 @@ -var O4=Object.create;var Ef=Object.defineProperty;var D4=Object.getOwnPropertyDescriptor;var P4=Object.getOwnPropertyNames;var R4=Object.getPrototypeOf,B4=Object.prototype.hasOwnProperty;var _S=(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 Error('Dynamic require of "'+t+'" is not supported')});var he=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)Ef(t,r,{get:e[r],enumerable:!0})},wf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of P4(e))!B4.call(t,i)&&i!==r&&Ef(t,i,{get:()=>e[i],enumerable:!(n=D4(e,i))||n.enumerable});return t},Qt=(t,e,r)=>(wf(t,e,"default"),r&&wf(r,e,"default")),Se=(t,e,r)=>(r=t!=null?O4(R4(t)):{},wf(e||!t||!t.__esModule?Ef(r,"default",{value:t,enumerable:!0}):r,t)),ht=t=>wf(Ef({},"__esModule",{value:!0}),t);var K0=v(vf=>{"use strict";l();vf.byteLength=F4;vf.toByteArray=U4;vf.fromByteArray=H4;var sn=[],Tr=[],L4=typeof Uint8Array<"u"?Uint8Array:Array,$0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Cs=0,SS=$0.length;Cs0)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 F4(t){var e=TS(t),r=e[0],n=e[1];return(r+n)*3/4-n}function M4(t,e,r){return(e+r)*3/4-r}function U4(t){var e,r=TS(t),n=r[0],i=r[1],s=new L4(M4(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=Tr[t.charCodeAt(u)]<<2|Tr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Tr[t.charCodeAt(u)]<<10|Tr[t.charCodeAt(u+1)]<<4|Tr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function q4(t){return sn[t>>18&63]+sn[t>>12&63]+sn[t>>6&63]+sn[t&63]}function V4(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(sn[e>>2]+sn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(sn[e>>10]+sn[e>>4&63]+sn[e<<2&63]+"=")),i.join("")}});var J0=v(Y0=>{l();Y0.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,g=r?-1:1,m=t[e+d];for(d+=g,s=m&(1<<-f)-1,m>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=g,f-=8);if(s===0)s=1-c;else{if(s===u)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(m?-1:1)*o*Math.pow(2,s-n)};Y0.write=function(t,e,r,n,i,s){var o,a,u,c=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,y=n?1:-1,A=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+=g/u:e+=g*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+m]=a&255,m+=y,a/=256,i-=8);for(o=o<0;t[r+m]=o&255,m+=y,o/=256,c-=8);t[r+m-y]|=A*128}});var qS=v(No=>{"use strict";l();var X0=K0(),xo=J0(),CS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;No.Buffer=$;No.SlowBuffer=W4;No.INSPECT_MAX_BYTES=50;var Af=2147483647;No.kMaxLength=Af;$.TYPED_ARRAY_SUPPORT=k4();!$.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 k4(){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($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function zn(t){if(t>Af)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(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 rm(t)}return OS(t,e,r)}$.poolSize=8192;function OS(t,e,r){if(typeof t=="string")return j4(t,e);if(ArrayBuffer.isView(t))return Q4(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(on(t,ArrayBuffer)||t&&on(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(on(t,SharedArrayBuffer)||t&&on(t.buffer,SharedArrayBuffer)))return em(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 $.from(n,e,r);var i=z4(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.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)}$.from=function(t,e,r){return OS(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function DS(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 G4(t,e,r){return DS(t),t<=0?zn(t):e!==void 0?typeof r=="string"?zn(t).fill(e,r):zn(t).fill(e):zn(t)}$.alloc=function(t,e,r){return G4(t,e,r)};function rm(t){return DS(t),zn(t<0?0:nm(t)|0)}$.allocUnsafe=function(t){return rm(t)};$.allocUnsafeSlow=function(t){return rm(t)};function j4(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=PS(t,e)|0,n=zn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Z0(t){for(var e=t.length<0?0:nm(t.length)|0,r=zn(e),n=0;n=Af)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Af.toString(16)+" bytes");return t|0}function W4(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),on(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.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?$.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function PS(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||on(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 tm(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return US(t).length;default:if(i)return n?-1:tm(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=PS;function $4(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 i5(this,e,r);case"utf8":case"utf-8":return BS(this,e,r);case"ascii":return r5(this,e,r);case"latin1":case"binary":return n5(this,e,r);case"base64":return e5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function xs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}$.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+=" ... "),""};CS&&($.prototype[CS]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.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),c=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,im(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=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:xS(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):xS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function xS(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(m,y){return s===1?m[y]:m.readUInt16BE(y*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){for(var d=!0,g=0;gi&&(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 K4(this,e,r,n);case"utf8":case"utf-8":return Y4(this,e,r,n);case"ascii":case"latin1":case"binary":return J4(this,e,r,n);case"base64":return X4(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z4(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function e5(t,e,r){return e===0&&r===t.length?X0.fromByteArray(t):X0.fromByteArray(t.slice(e,r))}function BS(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 t5(n)}var NS=4096;function t5(t){var e=t.length;if(e<=NS)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")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(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};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!1,52,8)};function lr(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.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;lr(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;lr(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};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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 LS(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 FS(t,e,r,n,i){return e=+e,r=r>>>0,i||LS(t,e,r,4,34028234663852886e22,-34028234663852886e22),xo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return FS(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return FS(this,e,r,!1,n)};function MS(t,e,r,n,i){return e=+e,r=r>>>0,i||LS(t,e,r,8,17976931348623157e292,-17976931348623157e292),xo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return MS(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return MS(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.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 u5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function US(t){return X0.toByteArray(a5(t))}function bf(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function on(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function im(t){return t!==t}var l5=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 jS=v((Gse,GS)=>{l();var vt=GS.exports={},an,un;function sm(){throw new Error("setTimeout has not been defined")}function om(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?an=setTimeout:an=sm}catch{an=sm}try{typeof clearTimeout=="function"?un=clearTimeout:un=om}catch{un=om}})();function VS(t){if(an===setTimeout)return setTimeout(t,0);if((an===sm||!an)&&setTimeout)return an=setTimeout,setTimeout(t,0);try{return an(t,0)}catch{try{return an.call(null,t,0)}catch{return an.call(this,t,0)}}}function f5(t){if(un===clearTimeout)return clearTimeout(t);if((un===om||!un)&&clearTimeout)return un=clearTimeout,clearTimeout(t);try{return un(t)}catch{try{return un.call(null,t)}catch{return un.call(this,t)}}}var Wn=[],Oo=!1,Ns,If=-1;function d5(){!Oo||!Ns||(Oo=!1,Ns.length?Wn=Ns.concat(Wn):If=-1,Wn.length&&HS())}function HS(){if(!Oo){var t=VS(d5);Oo=!0;for(var e=Wn.length;e;){for(Ns=Wn,Wn=[];++If1)for(var r=1;r{h=Se(qS()),p=Se(jS()),h5=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=h5});var Yt=v((QS,_f)=>{l();(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,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function m(S){var N,_,T,B=U.prototype={constructor:U,toString:null,valueOf:null},X=new U(1),Q=20,H=4,j=-7,K=21,me=-1e7,ce=1e7,ie=!1,J=1,oe=0,re={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},se="0123456789abcdefghijklmnopqrstuvwxyz";function U(w,E){var I,P,C,D,L,x,F,k,q=this;if(!(q instanceof U))return new U(w,E);if(E==null){if(w&&w._isBigNumber===!0){q.s=w.s,!w.c||w.e>ce?q.c=q.e=null:w.e=10;L/=10,D++);D>ce?q.c=q.e=null:(q.e=D,q.c=[w]);return}k=String(w)}else{if(!r.test(k=String(w)))return T(q,k,x);q.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(D=k.indexOf("."))>-1&&(k=k.replace(".","")),(L=k.search(/e/i))>0?(D<0&&(D=L),D+=+k.slice(L+1),k=k.substring(0,L)):D<0&&(D=k.length)}else{if(R(E,2,se.length,"Base"),E==10)return q=new U(w),ae(q,Q+q.e+1,H);if(k=String(w),x=typeof w=="number"){if(w*0!=0)return T(q,k,x,E);if(q.s=1/w<0?(k=k.slice(1),-1):1,U.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(o+w)}else q.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(I=se.slice(0,E),D=L=0,F=k.length;LD){D=F;continue}}else if(!C&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){C=!0,L=-1,D=0;continue}return T(q,String(w),x,E)}x=!1,k=_(k,E,10,q.s),(D=k.indexOf("."))>-1?k=k.replace(".",""):D=k.length}for(L=0;k.charCodeAt(L)===48;L++);for(F=k.length;k.charCodeAt(--F)===48;);if(k=k.slice(L,++F)){if(F-=L,x&&U.DEBUG&&F>15&&(w>c||w!==i(w)))throw Error(o+q.s*w);if((D=D-L-1)>ce)q.c=q.e=null;else if(D=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(E=(C+1)%u,E<1&&(E+=u),String(P[0]).length==E){for(E=0;E=a||I!==i(I))break e;if(I!==0)return!0}}}else if(P===null&&C===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+w)},U.maximum=U.max=function(){return ue(arguments,B.lt)},U.minimum=U.min=function(){return ue(arguments,B.gt)},U.random=function(){var w=9007199254740992,E=Math.random()*w&2097151?function(){return i(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(I){var P,C,D,L,x,F=0,k=[],q=new U(X);if(I==null?I=Q:R(I,0,g),L=n(I/u),ie)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(k.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(k.push(x%1e14),F+=7);F=L/7}else throw ie=!1,Error(s+"crypto unavailable");if(!ie)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(I,P,C,D,L){var x,F,k,q,ee,Ae,_e,Be,it=I.indexOf("."),dt=Q,De=H;for(it>=0&&(q=oe,oe=0,I=I.replace(".",""),Be=new U(P),Ae=Be.pow(I.length-it),oe=q,Be.c=E(b(A(Ae.c),Ae.e,"0"),10,C,w),Be.e=Be.c.length),_e=E(I,P,C,L?(x=se,w):(x=w,se)),k=q=_e.length;_e[--q]==0;_e.pop());if(!_e[0])return x.charAt(0);if(it<0?--k:(Ae.c=_e,Ae.e=k,Ae.s=D,Ae=N(Ae,Be,dt,De,C),_e=Ae.c,ee=Ae.r,k=Ae.e),F=k+dt+1,it=_e[F],q=C/2,ee=ee||F<0||_e[F+1]!=null,ee=De<4?(it!=null||ee)&&(De==0||De==(Ae.s<0?3:2)):it>q||it==q&&(De==4||ee||De==6&&_e[F-1]&1||De==(Ae.s<0?8:7)),F<1||!_e[0])I=ee?b(x.charAt(1),-dt,x.charAt(0)):x.charAt(0);else{if(_e.length=F,ee)for(--C;++_e[--F]>C;)_e[F]=0,F||(++k,_e=[1].concat(_e));for(q=_e.length;!_e[--q];);for(it=0,I="";it<=q;I+=x.charAt(_e[it++]));I=b(I,k,x.charAt(0))}return I}}(),N=function(){function w(P,C,D){var L,x,F,k,q=0,ee=P.length,Ae=C%d,_e=C/d|0;for(P=P.slice();ee--;)F=P[ee]%d,k=P[ee]/d|0,L=_e*F+k*Ae,x=Ae*F+L%d*d+q,q=(x/D|0)+(L/d|0)+_e*k,P[ee]=x%D;return q&&(P=[q].concat(P)),P}function E(P,C,D,L){var x,F;if(D!=L)F=D>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function I(P,C,D,L){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,C,D,L,x){var F,k,q,ee,Ae,_e,Be,it,dt,De,Ve,Lt,Ei,Ss,Ts,cr,Qn,Kt=P.s==C.s?1:-1,Ft=P.c,Je=C.c;if(!Ft||!Ft[0]||!Je||!Je[0])return new U(!P.s||!C.s||(Ft?Je&&Ft[0]==Je[0]:!Je)?NaN:Ft&&Ft[0]==0||!Je?Kt*0:Kt/0);for(it=new U(Kt),dt=it.c=[],k=P.e-C.e,Kt=D+k+1,x||(x=a,k=y(P.e/u)-y(C.e/u),Kt=Kt/u|0),q=0;Je[q]==(Ft[q]||0);q++);if(Je[q]>(Ft[q]||0)&&k--,Kt<0)dt.push(1),ee=!0;else{for(Ss=Ft.length,cr=Je.length,q=0,Kt+=2,Ae=i(x/(Je[0]+1)),Ae>1&&(Je=w(Je,Ae,x),Ft=w(Ft,Ae,x),cr=Je.length,Ss=Ft.length),Ei=cr,De=Ft.slice(0,cr),Ve=De.length;Ve=x/2&&Ts++;do{if(Ae=0,F=E(Je,De,cr,Ve),F<0){if(Lt=De[0],cr!=Ve&&(Lt=Lt*x+(De[1]||0)),Ae=i(Lt/Ts),Ae>1)for(Ae>=x&&(Ae=x-1),_e=w(Je,Ae,x),Be=_e.length,Ve=De.length;E(_e,De,Be,Ve)==1;)Ae--,I(_e,cr=10;Kt/=10,q++);ae(it,D+(it.e=q+k*u-1)+1,L,ee)}else it.e=k,it.r=+ee;return it}}();function fe(w,E,I,P){var C,D,L,x,F;if(I==null?I=H:R(I,0,8),!w.c)return w.toString();if(C=w.c[0],L=w.e,E==null)F=A(w.c),F=P==1||P==2&&(L<=j||L>=K)?M(F,L):b(F,L,"0");else if(w=ae(new U(w),E,I),D=w.e,F=A(w.c),x=F.length,P==1||P==2&&(E<=D||D<=j)){for(;xx){if(--E>0)for(F+=".";E--;F+="0");}else if(E+=D-x,E>0)for(D+1==x&&(F+=".");E--;F+="0");return w.s<0&&C?"-"+F:F}function ue(w,E){for(var I,P=1,C=new U(w[0]);P=10;C/=10,P++);return(I=P+I*u-1)>ce?w.c=w.e=null:I=10;x/=10,C++);if(D=E-C,D<0)D+=u,L=E,F=ee[k=0],q=F/Ae[C-L-1]%10|0;else if(k=n((D+1)/u),k>=ee.length)if(P){for(;ee.length<=k;ee.push(0));F=q=0,C=1,D%=u,L=D-u+1}else break e;else{for(F=x=ee[k],C=1;x>=10;x/=10,C++);D%=u,L=D-u+C,q=L<0?0:F/Ae[C-L-1]%10|0}if(P=P||E<0||ee[k+1]!=null||(L<0?F:F%Ae[C-L-1]),P=I<4?(q||P)&&(I==0||I==(w.s<0?3:2)):q>5||q==5&&(I==4||P||I==6&&(D>0?L>0?F/Ae[C-L]:0:ee[k-1])%10&1||I==(w.s<0?8:7)),E<1||!ee[0])return ee.length=0,P?(E-=w.e+1,ee[0]=Ae[(u-E%u)%u],w.e=-E||0):ee[0]=w.e=0,w;if(D==0?(ee.length=k,x=1,k--):(ee.length=k+1,x=Ae[u-D],ee[k]=L>0?i(F/Ae[C-L]%Ae[L])*x:0),P)for(;;)if(k==0){for(D=1,L=ee[0];L>=10;L/=10,D++);for(L=ee[0]+=x,x=1;L>=10;L/=10,x++);D!=x&&(w.e++,ee[0]==a&&(ee[0]=1));break}else{if(ee[k]+=x,ee[k]!=a)break;ee[k--]=0,x=1}for(D=ee.length;ee[--D]===0;ee.pop());}w.e>ce?w.c=w.e=null:w.e=K?M(E,I):b(E,I,"0"),w.s<0?"-"+E:E)}return B.absoluteValue=B.abs=function(){var w=new U(this);return w.s<0&&(w.s=1),w},B.comparedTo=function(w,E){return O(this,new U(w,E))},B.decimalPlaces=B.dp=function(w,E){var I,P,C,D=this;if(w!=null)return R(w,0,g),E==null?E=H:R(E,0,8),ae(new U(D),w+D.e+1,E);if(!(I=D.c))return null;if(P=((C=I.length-1)-y(this.e/u))*u,C=I[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},B.dividedBy=B.div=function(w,E){return N(this,new U(w,E),Q,H)},B.dividedToIntegerBy=B.idiv=function(w,E){return N(this,new U(w,E),0,1)},B.exponentiatedBy=B.pow=function(w,E){var I,P,C,D,L,x,F,k,q,ee=this;if(w=new U(w),w.c&&!w.isInteger())throw Error(s+"Exponent not an integer: "+le(w));if(E!=null&&(E=new U(E)),x=w.e>14,!ee.c||!ee.c[0]||ee.c[0]==1&&!ee.e&&ee.c.length==1||!w.c||!w.c[0])return q=new U(Math.pow(+le(ee),x?2-z(w):+le(w))),E?q.mod(E):q;if(F=w.s<0,E){if(E.c?!E.c[0]:!E.s)return new U(NaN);P=!F&&ee.isInteger()&&E.isInteger(),P&&(ee=ee.mod(E))}else{if(w.e>9&&(ee.e>0||ee.e<-1||(ee.e==0?ee.c[0]>1||x&&ee.c[1]>=24e7:ee.c[0]<8e13||x&&ee.c[0]<=9999975e7)))return D=ee.s<0&&z(w)?-0:0,ee.e>-1&&(D=1/D),new U(F?1/D:D);oe&&(D=n(oe/u+2))}for(x?(I=new U(.5),F&&(w.s=1),k=z(w)):(C=Math.abs(+le(w)),k=C%2),q=new U(X);;){if(k){if(q=q.times(ee),!q.c)break;D?q.c.length>D&&(q.c.length=D):P&&(q=q.mod(E))}if(C){if(C=i(C/2),C===0)break;k=C%2}else if(w=w.times(I),ae(w,w.e+1,1),w.e>14)k=z(w);else{if(C=+le(w),C===0)break;k=C%2}ee=ee.times(ee),D?ee.c&&ee.c.length>D&&(ee.c.length=D):P&&(ee=ee.mod(E))}return P?q:(F&&(q=X.div(q)),E?q.mod(E):D?ae(q,oe,H,L):q)},B.integerValue=function(w){var E=new U(this);return w==null?w=H:R(w,0,8),ae(E,E.e+1,w)},B.isEqualTo=B.eq=function(w,E){return O(this,new U(w,E))===0},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(w,E){return O(this,new U(w,E))>0},B.isGreaterThanOrEqualTo=B.gte=function(w,E){return(E=O(this,new U(w,E)))===1||E===0},B.isInteger=function(){return!!this.c&&y(this.e/u)>this.c.length-2},B.isLessThan=B.lt=function(w,E){return O(this,new U(w,E))<0},B.isLessThanOrEqualTo=B.lte=function(w,E){return(E=O(this,new U(w,E)))===-1||E===0},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&this.c[0]==0},B.minus=function(w,E){var I,P,C,D,L=this,x=L.s;if(w=new U(w,E),E=w.s,!x||!E)return new U(NaN);if(x!=E)return w.s=-E,L.plus(w);var F=L.e/u,k=w.e/u,q=L.c,ee=w.c;if(!F||!k){if(!q||!ee)return q?(w.s=-E,w):new U(ee?L:NaN);if(!q[0]||!ee[0])return ee[0]?(w.s=-E,w):new U(q[0]?L:H==3?-0:0)}if(F=y(F),k=y(k),q=q.slice(),x=F-k){for((D=x<0)?(x=-x,C=q):(k=F,C=ee),C.reverse(),E=x;E--;C.push(0));C.reverse()}else for(P=(D=(x=q.length)<(E=ee.length))?x:E,x=E=0;E0)for(;E--;q[I++]=0);for(E=a-1;P>x;){if(q[--P]=0;){for(I=0,Ae=Lt[C]%dt,_e=Lt[C]/dt|0,L=F,D=C+L;D>C;)k=Ve[--L]%dt,q=Ve[L]/dt|0,x=_e*k+q*Ae,k=Ae*k+x%dt*dt+Be[D]+I,I=(k/it|0)+(x/dt|0)+_e*q,Be[D--]=k%it;Be[D]=I}return I?++P:Be.splice(0,1),de(w,Be,P)},B.negated=function(){var w=new U(this);return w.s=-w.s||null,w},B.plus=function(w,E){var I,P=this,C=P.s;if(w=new U(w,E),E=w.s,!C||!E)return new U(NaN);if(C!=E)return w.s=-E,P.minus(w);var D=P.e/u,L=w.e/u,x=P.c,F=w.c;if(!D||!L){if(!x||!F)return new U(C/0);if(!x[0]||!F[0])return F[0]?w:new U(x[0]?P:C*0)}if(D=y(D),L=y(L),x=x.slice(),C=D-L){for(C>0?(L=D,I=F):(C=-C,I=x),I.reverse();C--;I.push(0));I.reverse()}for(C=x.length,E=F.length,C-E<0&&(I=F,F=x,x=I,E=C),C=0;E;)C=(x[--E]=x[E]+F[E]+C)/a|0,x[E]=a===x[E]?0:x[E]%a;return C&&(x=[C].concat(x),++L),de(w,x,L)},B.precision=B.sd=function(w,E){var I,P,C,D=this;if(w!=null&&w!==!!w)return R(w,1,g),E==null?E=H:R(E,0,8),ae(new U(D),w,E);if(!(I=D.c))return null;if(C=I.length-1,P=C*u+1,C=I[C]){for(;C%10==0;C/=10,P--);for(C=I[0];C>=10;C/=10,P++);}return w&&D.e+1>P&&(P=D.e+1),P},B.shiftedBy=function(w){return R(w,-c,c),this.times("1e"+w)},B.squareRoot=B.sqrt=function(){var w,E,I,P,C,D=this,L=D.c,x=D.s,F=D.e,k=Q+4,q=new U("0.5");if(x!==1||!L||!L[0])return new U(!x||x<0&&(!L||L[0])?NaN:L?D:1/0);if(x=Math.sqrt(+le(D)),x==0||x==1/0?(E=A(L),(E.length+F)%2==0&&(E+="0"),x=Math.sqrt(+E),F=y((F+1)/2)-(F<0||F%2),x==1/0?E="5e"+F:(E=x.toExponential(),E=E.slice(0,E.indexOf("e")+1)+F),I=new U(E)):I=new U(x+""),I.c[0]){for(F=I.e,x=F+k,x<3&&(x=0);;)if(C=I,I=q.times(C.plus(N(D,C,k,1))),A(C.c).slice(0,x)===(E=A(I.c)).slice(0,x))if(I.e0&&Be>0){for(D=Be%x||x,q=_e.substr(0,D);D0&&(q+=k+_e.slice(D)),Ae&&(q="-"+q)}P=ee?q+(I.decimalSeparator||"")+((F=+I.fractionGroupSize)?ee.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(I.fractionGroupSeparator||"")):ee):q}return(I.prefix||"")+P+(I.suffix||"")},B.toFraction=function(w){var E,I,P,C,D,L,x,F,k,q,ee,Ae,_e=this,Be=_e.c;if(w!=null&&(x=new U(w),!x.isInteger()&&(x.c||x.s!==1)||x.lt(X)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+le(x));if(!Be)return new U(_e);for(E=new U(X),k=I=new U(X),P=F=new U(X),Ae=A(Be),D=E.e=Ae.length-_e.e-1,E.c[0]=f[(L=D%u)<0?u+L:L],w=!w||x.comparedTo(E)>0?D>0?E:k:x,L=ce,ce=1/0,x=new U(Ae),F.c[0]=0;q=N(x,E,0,1),C=I.plus(q.times(P)),C.comparedTo(w)!=1;)I=P,P=C,k=F.plus(q.times(C=k)),F=C,E=x.minus(q.times(C=E)),x=C;return C=N(w.minus(I),P,0,1),F=F.plus(C.times(k)),I=I.plus(C.times(P)),F.s=k.s=_e.s,D=D*2,ee=N(k,P,D,H).minus(_e).abs().comparedTo(N(F,I,D,H).minus(_e).abs())<1?[k,P]:[F,I],ce=L,ee},B.toNumber=function(){return+le(this)},B.toPrecision=function(w,E){return w!=null&&R(w,1,g),fe(this,w,E,2)},B.toString=function(w){var E,I=this,P=I.s,C=I.e;return C===null?P?(E="Infinity",P<0&&(E="-"+E)):E="NaN":(w==null?E=C<=j||C>=K?M(A(I.c),C):b(A(I.c),C,"0"):w===10?(I=ae(new U(I),Q+C+1,H),E=b(A(I.c),I.e,"0")):(R(w,2,se.length,"Base"),E=_(b(A(I.c),C,"0"),10,w,P,!0)),P<0&&I.c[0]&&(E="-"+E)),E},B.valueOf=B.toJSON=function(){return le(this)},B._isBigNumber=!0,S!=null&&U.set(S),U}function y(S){var N=S|0;return S>0||S===N?N:N-1}function A(S){for(var N,_,T=1,B=S.length,X=S[0]+"";TK^_?1:-1;for(H=(j=B.length)<(K=X.length)?j:K,Q=0;QX[Q]^_?1:-1;return j==K?0:j>K^_?1:-1}function R(S,N,_,T){if(S_||S!==i(S))throw Error(s+(T||"Argument")+(typeof S=="number"?S_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(S))}function z(S){var N=S.c.length-1;return y(S.e/u)==N&&S.c[N]%2!=0}function M(S,N){return(S.length>1?S.charAt(0)+"."+S.slice(1):S)+(N<0?"e":"e+")+N}function b(S,N,_){var T,B;if(N<0){for(B=_+".";++N;B+=_);S=B+S}else if(T=S.length,++N>T){for(B=_,N-=T;--N;B+=_);S+=B}else N{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrIsCompletedFieldIsMissingOnTransaction=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 Pe=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=Pe;var am=class extends Pe{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=am;var um=class extends Pe{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=um;var cm=class extends Pe{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=cm;var lm=class extends Pe{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=lm;var fm=class extends Pe{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=fm;var dm=class extends Pe{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=dm;var hm=class extends Pe{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=hm;var pm=class extends Pe{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=pm;var gm=class extends Pe{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=gm;var ym=class extends Pe{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=ym;var mm=class extends Pe{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=mm;var wm=class extends Pe{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=wm;var Em=class extends Pe{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=Em;var vm=class extends Pe{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=vm;var Am=class extends Pe{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=Am;var bm=class extends Pe{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=bm;var Im=class extends Pe{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=Im;var _m=class extends Pe{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=_m;var Sm=class extends Pe{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=Sm;var Sf=class extends Pe{constructor(e){super(e)}};pe.ErrContract=Sf;var Tm=class extends Sf{constructor(){super(` +var D4=Object.create;var Ef=Object.defineProperty;var P4=Object.getOwnPropertyDescriptor;var R4=Object.getOwnPropertyNames;var B4=Object.getPrototypeOf,L4=Object.prototype.hasOwnProperty;var TS=(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 Error('Dynamic require of "'+t+'" is not supported')});var he=(t,e)=>()=>(t&&(e=t(t=0)),e);var A=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)Ef(t,r,{get:e[r],enumerable:!0})},wf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of R4(e))!L4.call(t,i)&&i!==r&&Ef(t,i,{get:()=>e[i],enumerable:!(n=P4(e,i))||n.enumerable});return t},Qt=(t,e,r)=>(wf(t,e,"default"),r&&wf(r,e,"default")),be=(t,e,r)=>(r=t!=null?D4(B4(t)):{},wf(e||!t||!t.__esModule?Ef(r,"default",{value:t,enumerable:!0}):r,t)),ht=t=>wf(Ef({},"__esModule",{value:!0}),t);var $0=A(vf=>{"use strict";l();vf.byteLength=M4;vf.toByteArray=q4;vf.fromByteArray=k4;var sn=[],Tr=[],F4=typeof Uint8Array<"u"?Uint8Array:Array,W0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Cs=0,CS=W0.length;Cs0)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 M4(t){var e=xS(t),r=e[0],n=e[1];return(r+n)*3/4-n}function U4(t,e,r){return(e+r)*3/4-r}function q4(t){var e,r=xS(t),n=r[0],i=r[1],s=new F4(U4(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=Tr[t.charCodeAt(u)]<<2|Tr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Tr[t.charCodeAt(u)]<<10|Tr[t.charCodeAt(u+1)]<<4|Tr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function V4(t){return sn[t>>18&63]+sn[t>>12&63]+sn[t>>6&63]+sn[t&63]}function H4(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(sn[e>>2]+sn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(sn[e>>10]+sn[e>>4&63]+sn[e<<2&63]+"=")),i.join("")}});var Y0=A(K0=>{l();K0.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,g=r?-1:1,m=t[e+d];for(d+=g,s=m&(1<<-f)-1,m>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=g,f-=8);if(s===0)s=1-c;else{if(s===u)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(m?-1:1)*o*Math.pow(2,s-n)};K0.write=function(t,e,r,n,i,s){var o,a,u,c=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,y=n?1:-1,b=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+=g/u:e+=g*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+m]=a&255,m+=y,a/=256,i-=8);for(o=o<0;t[r+m]=o&255,m+=y,o/=256,c-=8);t[r+m-y]|=b*128}});var HS=A(No=>{"use strict";l();var J0=$0(),xo=Y0(),NS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;No.Buffer=$;No.SlowBuffer=$4;No.INSPECT_MAX_BYTES=50;var Af=2147483647;No.kMaxLength=Af;$.TYPED_ARRAY_SUPPORT=G4();!$.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 G4(){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($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function zn(t){if(t>Af)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(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 tm(t)}return PS(t,e,r)}$.poolSize=8192;function PS(t,e,r){if(typeof t=="string")return Q4(t,e);if(ArrayBuffer.isView(t))return z4(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(on(t,ArrayBuffer)||t&&on(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(on(t,SharedArrayBuffer)||t&&on(t.buffer,SharedArrayBuffer)))return Z0(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 $.from(n,e,r);var i=W4(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.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)}$.from=function(t,e,r){return PS(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function RS(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 j4(t,e,r){return RS(t),t<=0?zn(t):e!==void 0?typeof r=="string"?zn(t).fill(e,r):zn(t).fill(e):zn(t)}$.alloc=function(t,e,r){return j4(t,e,r)};function tm(t){return RS(t),zn(t<0?0:rm(t)|0)}$.allocUnsafe=function(t){return tm(t)};$.allocUnsafeSlow=function(t){return tm(t)};function Q4(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=BS(t,e)|0,n=zn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function X0(t){for(var e=t.length<0?0:rm(t.length)|0,r=zn(e),n=0;n=Af)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Af.toString(16)+" bytes");return t|0}function $4(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),on(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.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?$.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function BS(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||on(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 em(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return VS(t).length;default:if(i)return n?-1:em(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=BS;function K4(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 s5(this,e,r);case"utf8":case"utf-8":return FS(this,e,r);case"ascii":return n5(this,e,r);case"latin1":case"binary":return i5(this,e,r);case"base64":return t5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function xs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}$.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+=" ... "),""};NS&&($.prototype[NS]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.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),c=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,nm(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=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:OS(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):OS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function OS(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(m,y){return s===1?m[y]:m.readUInt16BE(y*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){for(var d=!0,g=0;gi&&(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 Y4(this,e,r,n);case"utf8":case"utf-8":return J4(this,e,r,n);case"ascii":case"latin1":case"binary":return X4(this,e,r,n);case"base64":return Z4(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function t5(t,e,r){return e===0&&r===t.length?J0.fromByteArray(t):J0.fromByteArray(t.slice(e,r))}function FS(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 r5(n)}var DS=4096;function r5(t){var e=t.length;if(e<=DS)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")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(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};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!1,52,8)};function lr(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.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;lr(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;lr(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};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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 MS(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 US(t,e,r,n,i){return e=+e,r=r>>>0,i||MS(t,e,r,4,34028234663852886e22,-34028234663852886e22),xo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return US(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return US(this,e,r,!1,n)};function qS(t,e,r,n,i){return e=+e,r=r>>>0,i||MS(t,e,r,8,17976931348623157e292,-17976931348623157e292),xo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return qS(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return qS(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.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 c5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function VS(t){return J0.toByteArray(u5(t))}function bf(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function on(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function nm(t){return t!==t}var f5=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 zS=A(($se,QS)=>{l();var vt=QS.exports={},an,un;function im(){throw new Error("setTimeout has not been defined")}function sm(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?an=setTimeout:an=im}catch{an=im}try{typeof clearTimeout=="function"?un=clearTimeout:un=sm}catch{un=sm}})();function kS(t){if(an===setTimeout)return setTimeout(t,0);if((an===im||!an)&&setTimeout)return an=setTimeout,setTimeout(t,0);try{return an(t,0)}catch{try{return an.call(null,t,0)}catch{return an.call(this,t,0)}}}function d5(t){if(un===clearTimeout)return clearTimeout(t);if((un===sm||!un)&&clearTimeout)return un=clearTimeout,clearTimeout(t);try{return un(t)}catch{try{return un.call(null,t)}catch{return un.call(this,t)}}}var Wn=[],Oo=!1,Ns,If=-1;function h5(){!Oo||!Ns||(Oo=!1,Ns.length?Wn=Ns.concat(Wn):If=-1,Wn.length&&GS())}function GS(){if(!Oo){var t=kS(h5);Oo=!0;for(var e=Wn.length;e;){for(Ns=Wn,Wn=[];++If1)for(var r=1;r{h=be(HS()),p=be(zS()),p5=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=p5});var Yt=A((WS,_f)=>{l();(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,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function m(S){var N,_,T,B=U.prototype={constructor:U,toString:null,valueOf:null},X=new U(1),Q=20,H=4,j=-7,K=21,me=-1e7,ce=1e7,ie=!1,J=1,oe=0,re={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},se="0123456789abcdefghijklmnopqrstuvwxyz";function U(w,v){var I,P,C,D,L,x,F,k,q=this;if(!(q instanceof U))return new U(w,v);if(v==null){if(w&&w._isBigNumber===!0){q.s=w.s,!w.c||w.e>ce?q.c=q.e=null:w.e=10;L/=10,D++);D>ce?q.c=q.e=null:(q.e=D,q.c=[w]);return}k=String(w)}else{if(!r.test(k=String(w)))return T(q,k,x);q.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(D=k.indexOf("."))>-1&&(k=k.replace(".","")),(L=k.search(/e/i))>0?(D<0&&(D=L),D+=+k.slice(L+1),k=k.substring(0,L)):D<0&&(D=k.length)}else{if(R(v,2,se.length,"Base"),v==10)return q=new U(w),ae(q,Q+q.e+1,H);if(k=String(w),x=typeof w=="number"){if(w*0!=0)return T(q,k,x,v);if(q.s=1/w<0?(k=k.slice(1),-1):1,U.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(o+w)}else q.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(I=se.slice(0,v),D=L=0,F=k.length;LD){D=F;continue}}else if(!C&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){C=!0,L=-1,D=0;continue}return T(q,String(w),x,v)}x=!1,k=_(k,v,10,q.s),(D=k.indexOf("."))>-1?k=k.replace(".",""):D=k.length}for(L=0;k.charCodeAt(L)===48;L++);for(F=k.length;k.charCodeAt(--F)===48;);if(k=k.slice(L,++F)){if(F-=L,x&&U.DEBUG&&F>15&&(w>c||w!==i(w)))throw Error(o+q.s*w);if((D=D-L-1)>ce)q.c=q.e=null;else if(D=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||I!==i(I))break e;if(I!==0)return!0}}}else if(P===null&&C===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+w)},U.maximum=U.max=function(){return ue(arguments,B.lt)},U.minimum=U.min=function(){return ue(arguments,B.gt)},U.random=function(){var w=9007199254740992,v=Math.random()*w&2097151?function(){return i(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(I){var P,C,D,L,x,F=0,k=[],q=new U(X);if(I==null?I=Q:R(I,0,g),L=n(I/u),ie)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(k.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(k.push(x%1e14),F+=7);F=L/7}else throw ie=!1,Error(s+"crypto unavailable");if(!ie)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(I,P,C,D,L){var x,F,k,q,ee,Ae,Se,Be,it=I.indexOf("."),dt=Q,De=H;for(it>=0&&(q=oe,oe=0,I=I.replace(".",""),Be=new U(P),Ae=Be.pow(I.length-it),oe=q,Be.c=v(E(b(Ae.c),Ae.e,"0"),10,C,w),Be.e=Be.c.length),Se=v(I,P,C,L?(x=se,w):(x=w,se)),k=q=Se.length;Se[--q]==0;Se.pop());if(!Se[0])return x.charAt(0);if(it<0?--k:(Ae.c=Se,Ae.e=k,Ae.s=D,Ae=N(Ae,Be,dt,De,C),Se=Ae.c,ee=Ae.r,k=Ae.e),F=k+dt+1,it=Se[F],q=C/2,ee=ee||F<0||Se[F+1]!=null,ee=De<4?(it!=null||ee)&&(De==0||De==(Ae.s<0?3:2)):it>q||it==q&&(De==4||ee||De==6&&Se[F-1]&1||De==(Ae.s<0?8:7)),F<1||!Se[0])I=ee?E(x.charAt(1),-dt,x.charAt(0)):x.charAt(0);else{if(Se.length=F,ee)for(--C;++Se[--F]>C;)Se[F]=0,F||(++k,Se=[1].concat(Se));for(q=Se.length;!Se[--q];);for(it=0,I="";it<=q;I+=x.charAt(Se[it++]));I=E(I,k,x.charAt(0))}return I}}(),N=function(){function w(P,C,D){var L,x,F,k,q=0,ee=P.length,Ae=C%d,Se=C/d|0;for(P=P.slice();ee--;)F=P[ee]%d,k=P[ee]/d|0,L=Se*F+k*Ae,x=Ae*F+L%d*d+q,q=(x/D|0)+(L/d|0)+Se*k,P[ee]=x%D;return q&&(P=[q].concat(P)),P}function v(P,C,D,L){var x,F;if(D!=L)F=D>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function I(P,C,D,L){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,C,D,L,x){var F,k,q,ee,Ae,Se,Be,it,dt,De,Ve,Lt,Ei,Ss,Ts,cr,Qn,Kt=P.s==C.s?1:-1,Ft=P.c,Je=C.c;if(!Ft||!Ft[0]||!Je||!Je[0])return new U(!P.s||!C.s||(Ft?Je&&Ft[0]==Je[0]:!Je)?NaN:Ft&&Ft[0]==0||!Je?Kt*0:Kt/0);for(it=new U(Kt),dt=it.c=[],k=P.e-C.e,Kt=D+k+1,x||(x=a,k=y(P.e/u)-y(C.e/u),Kt=Kt/u|0),q=0;Je[q]==(Ft[q]||0);q++);if(Je[q]>(Ft[q]||0)&&k--,Kt<0)dt.push(1),ee=!0;else{for(Ss=Ft.length,cr=Je.length,q=0,Kt+=2,Ae=i(x/(Je[0]+1)),Ae>1&&(Je=w(Je,Ae,x),Ft=w(Ft,Ae,x),cr=Je.length,Ss=Ft.length),Ei=cr,De=Ft.slice(0,cr),Ve=De.length;Ve=x/2&&Ts++;do{if(Ae=0,F=v(Je,De,cr,Ve),F<0){if(Lt=De[0],cr!=Ve&&(Lt=Lt*x+(De[1]||0)),Ae=i(Lt/Ts),Ae>1)for(Ae>=x&&(Ae=x-1),Se=w(Je,Ae,x),Be=Se.length,Ve=De.length;v(Se,De,Be,Ve)==1;)Ae--,I(Se,cr=10;Kt/=10,q++);ae(it,D+(it.e=q+k*u-1)+1,L,ee)}else it.e=k,it.r=+ee;return it}}();function fe(w,v,I,P){var C,D,L,x,F;if(I==null?I=H:R(I,0,8),!w.c)return w.toString();if(C=w.c[0],L=w.e,v==null)F=b(w.c),F=P==1||P==2&&(L<=j||L>=K)?M(F,L):E(F,L,"0");else if(w=ae(new U(w),v,I),D=w.e,F=b(w.c),x=F.length,P==1||P==2&&(v<=D||D<=j)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=D-x,v>0)for(D+1==x&&(F+=".");v--;F+="0");return w.s<0&&C?"-"+F:F}function ue(w,v){for(var I,P=1,C=new U(w[0]);P=10;C/=10,P++);return(I=P+I*u-1)>ce?w.c=w.e=null:I=10;x/=10,C++);if(D=v-C,D<0)D+=u,L=v,F=ee[k=0],q=F/Ae[C-L-1]%10|0;else if(k=n((D+1)/u),k>=ee.length)if(P){for(;ee.length<=k;ee.push(0));F=q=0,C=1,D%=u,L=D-u+1}else break e;else{for(F=x=ee[k],C=1;x>=10;x/=10,C++);D%=u,L=D-u+C,q=L<0?0:F/Ae[C-L-1]%10|0}if(P=P||v<0||ee[k+1]!=null||(L<0?F:F%Ae[C-L-1]),P=I<4?(q||P)&&(I==0||I==(w.s<0?3:2)):q>5||q==5&&(I==4||P||I==6&&(D>0?L>0?F/Ae[C-L]:0:ee[k-1])%10&1||I==(w.s<0?8:7)),v<1||!ee[0])return ee.length=0,P?(v-=w.e+1,ee[0]=Ae[(u-v%u)%u],w.e=-v||0):ee[0]=w.e=0,w;if(D==0?(ee.length=k,x=1,k--):(ee.length=k+1,x=Ae[u-D],ee[k]=L>0?i(F/Ae[C-L]%Ae[L])*x:0),P)for(;;)if(k==0){for(D=1,L=ee[0];L>=10;L/=10,D++);for(L=ee[0]+=x,x=1;L>=10;L/=10,x++);D!=x&&(w.e++,ee[0]==a&&(ee[0]=1));break}else{if(ee[k]+=x,ee[k]!=a)break;ee[k--]=0,x=1}for(D=ee.length;ee[--D]===0;ee.pop());}w.e>ce?w.c=w.e=null:w.e=K?M(v,I):E(v,I,"0"),w.s<0?"-"+v:v)}return B.absoluteValue=B.abs=function(){var w=new U(this);return w.s<0&&(w.s=1),w},B.comparedTo=function(w,v){return O(this,new U(w,v))},B.decimalPlaces=B.dp=function(w,v){var I,P,C,D=this;if(w!=null)return R(w,0,g),v==null?v=H:R(v,0,8),ae(new U(D),w+D.e+1,v);if(!(I=D.c))return null;if(P=((C=I.length-1)-y(this.e/u))*u,C=I[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},B.dividedBy=B.div=function(w,v){return N(this,new U(w,v),Q,H)},B.dividedToIntegerBy=B.idiv=function(w,v){return N(this,new U(w,v),0,1)},B.exponentiatedBy=B.pow=function(w,v){var I,P,C,D,L,x,F,k,q,ee=this;if(w=new U(w),w.c&&!w.isInteger())throw Error(s+"Exponent not an integer: "+le(w));if(v!=null&&(v=new U(v)),x=w.e>14,!ee.c||!ee.c[0]||ee.c[0]==1&&!ee.e&&ee.c.length==1||!w.c||!w.c[0])return q=new U(Math.pow(+le(ee),x?2-z(w):+le(w))),v?q.mod(v):q;if(F=w.s<0,v){if(v.c?!v.c[0]:!v.s)return new U(NaN);P=!F&&ee.isInteger()&&v.isInteger(),P&&(ee=ee.mod(v))}else{if(w.e>9&&(ee.e>0||ee.e<-1||(ee.e==0?ee.c[0]>1||x&&ee.c[1]>=24e7:ee.c[0]<8e13||x&&ee.c[0]<=9999975e7)))return D=ee.s<0&&z(w)?-0:0,ee.e>-1&&(D=1/D),new U(F?1/D:D);oe&&(D=n(oe/u+2))}for(x?(I=new U(.5),F&&(w.s=1),k=z(w)):(C=Math.abs(+le(w)),k=C%2),q=new U(X);;){if(k){if(q=q.times(ee),!q.c)break;D?q.c.length>D&&(q.c.length=D):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;k=C%2}else if(w=w.times(I),ae(w,w.e+1,1),w.e>14)k=z(w);else{if(C=+le(w),C===0)break;k=C%2}ee=ee.times(ee),D?ee.c&&ee.c.length>D&&(ee.c.length=D):P&&(ee=ee.mod(v))}return P?q:(F&&(q=X.div(q)),v?q.mod(v):D?ae(q,oe,H,L):q)},B.integerValue=function(w){var v=new U(this);return w==null?w=H:R(w,0,8),ae(v,v.e+1,w)},B.isEqualTo=B.eq=function(w,v){return O(this,new U(w,v))===0},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(w,v){return O(this,new U(w,v))>0},B.isGreaterThanOrEqualTo=B.gte=function(w,v){return(v=O(this,new U(w,v)))===1||v===0},B.isInteger=function(){return!!this.c&&y(this.e/u)>this.c.length-2},B.isLessThan=B.lt=function(w,v){return O(this,new U(w,v))<0},B.isLessThanOrEqualTo=B.lte=function(w,v){return(v=O(this,new U(w,v)))===-1||v===0},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&this.c[0]==0},B.minus=function(w,v){var I,P,C,D,L=this,x=L.s;if(w=new U(w,v),v=w.s,!x||!v)return new U(NaN);if(x!=v)return w.s=-v,L.plus(w);var F=L.e/u,k=w.e/u,q=L.c,ee=w.c;if(!F||!k){if(!q||!ee)return q?(w.s=-v,w):new U(ee?L:NaN);if(!q[0]||!ee[0])return ee[0]?(w.s=-v,w):new U(q[0]?L:H==3?-0:0)}if(F=y(F),k=y(k),q=q.slice(),x=F-k){for((D=x<0)?(x=-x,C=q):(k=F,C=ee),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(D=(x=q.length)<(v=ee.length))?x:v,x=v=0;v0)for(;v--;q[I++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(I=0,Ae=Lt[C]%dt,Se=Lt[C]/dt|0,L=F,D=C+L;D>C;)k=Ve[--L]%dt,q=Ve[L]/dt|0,x=Se*k+q*Ae,k=Ae*k+x%dt*dt+Be[D]+I,I=(k/it|0)+(x/dt|0)+Se*q,Be[D--]=k%it;Be[D]=I}return I?++P:Be.splice(0,1),de(w,Be,P)},B.negated=function(){var w=new U(this);return w.s=-w.s||null,w},B.plus=function(w,v){var I,P=this,C=P.s;if(w=new U(w,v),v=w.s,!C||!v)return new U(NaN);if(C!=v)return w.s=-v,P.minus(w);var D=P.e/u,L=w.e/u,x=P.c,F=w.c;if(!D||!L){if(!x||!F)return new U(C/0);if(!x[0]||!F[0])return F[0]?w:new U(x[0]?P:C*0)}if(D=y(D),L=y(L),x=x.slice(),C=D-L){for(C>0?(L=D,I=F):(C=-C,I=x),I.reverse();C--;I.push(0));I.reverse()}for(C=x.length,v=F.length,C-v<0&&(I=F,F=x,x=I,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),de(w,x,L)},B.precision=B.sd=function(w,v){var I,P,C,D=this;if(w!=null&&w!==!!w)return R(w,1,g),v==null?v=H:R(v,0,8),ae(new U(D),w,v);if(!(I=D.c))return null;if(C=I.length-1,P=C*u+1,C=I[C]){for(;C%10==0;C/=10,P--);for(C=I[0];C>=10;C/=10,P++);}return w&&D.e+1>P&&(P=D.e+1),P},B.shiftedBy=function(w){return R(w,-c,c),this.times("1e"+w)},B.squareRoot=B.sqrt=function(){var w,v,I,P,C,D=this,L=D.c,x=D.s,F=D.e,k=Q+4,q=new U("0.5");if(x!==1||!L||!L[0])return new U(!x||x<0&&(!L||L[0])?NaN:L?D:1/0);if(x=Math.sqrt(+le(D)),x==0||x==1/0?(v=b(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=y((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),I=new U(v)):I=new U(x+""),I.c[0]){for(F=I.e,x=F+k,x<3&&(x=0);;)if(C=I,I=q.times(C.plus(N(D,C,k,1))),b(C.c).slice(0,x)===(v=b(I.c)).slice(0,x))if(I.e0&&Be>0){for(D=Be%x||x,q=Se.substr(0,D);D0&&(q+=k+Se.slice(D)),Ae&&(q="-"+q)}P=ee?q+(I.decimalSeparator||"")+((F=+I.fractionGroupSize)?ee.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(I.fractionGroupSeparator||"")):ee):q}return(I.prefix||"")+P+(I.suffix||"")},B.toFraction=function(w){var v,I,P,C,D,L,x,F,k,q,ee,Ae,Se=this,Be=Se.c;if(w!=null&&(x=new U(w),!x.isInteger()&&(x.c||x.s!==1)||x.lt(X)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+le(x));if(!Be)return new U(Se);for(v=new U(X),k=I=new U(X),P=F=new U(X),Ae=b(Be),D=v.e=Ae.length-Se.e-1,v.c[0]=f[(L=D%u)<0?u+L:L],w=!w||x.comparedTo(v)>0?D>0?v:k:x,L=ce,ce=1/0,x=new U(Ae),F.c[0]=0;q=N(x,v,0,1),C=I.plus(q.times(P)),C.comparedTo(w)!=1;)I=P,P=C,k=F.plus(q.times(C=k)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(w.minus(I),P,0,1),F=F.plus(C.times(k)),I=I.plus(C.times(P)),F.s=k.s=Se.s,D=D*2,ee=N(k,P,D,H).minus(Se).abs().comparedTo(N(F,I,D,H).minus(Se).abs())<1?[k,P]:[F,I],ce=L,ee},B.toNumber=function(){return+le(this)},B.toPrecision=function(w,v){return w!=null&&R(w,1,g),fe(this,w,v,2)},B.toString=function(w){var v,I=this,P=I.s,C=I.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(w==null?v=C<=j||C>=K?M(b(I.c),C):E(b(I.c),C,"0"):w===10?(I=ae(new U(I),Q+C+1,H),v=E(b(I.c),I.e,"0")):(R(w,2,se.length,"Base"),v=_(E(b(I.c),C,"0"),10,w,P,!0)),P<0&&I.c[0]&&(v="-"+v)),v},B.valueOf=B.toJSON=function(){return le(this)},B._isBigNumber=!0,S!=null&&U.set(S),U}function y(S){var N=S|0;return S>0||S===N?N:N-1}function b(S){for(var N,_,T=1,B=S.length,X=S[0]+"";TK^_?1:-1;for(H=(j=B.length)<(K=X.length)?j:K,Q=0;QX[Q]^_?1:-1;return j==K?0:j>K^_?1:-1}function R(S,N,_,T){if(S_||S!==i(S))throw Error(s+(T||"Argument")+(typeof S=="number"?S_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(S))}function z(S){var N=S.c.length-1;return y(S.e/u)==N&&S.c[N]%2!=0}function M(S,N){return(S.length>1?S.charAt(0)+"."+S.slice(1):S)+(N<0?"e":"e+")+N}function E(S,N,_){var T,B;if(N<0){for(B=_+".";++N;B+=_);S=B+S}else if(T=S.length,++N>T){for(B=_,N-=T;--N;B+=_);S+=B}else N{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrIsCompletedFieldIsMissingOnTransaction=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 Pe=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=Pe;var om=class extends Pe{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=om;var am=class extends Pe{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=am;var um=class extends Pe{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=um;var cm=class extends Pe{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=cm;var lm=class extends Pe{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=lm;var fm=class extends Pe{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=fm;var dm=class extends Pe{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=dm;var hm=class extends Pe{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=hm;var pm=class extends Pe{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=pm;var gm=class extends Pe{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=gm;var ym=class extends Pe{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=ym;var mm=class extends Pe{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=mm;var wm=class extends Pe{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=wm;var Em=class extends Pe{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=Em;var vm=class extends Pe{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=vm;var Am=class extends Pe{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=Am;var bm=class extends Pe{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=bm;var Im=class extends Pe{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=Im;var _m=class extends Pe{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=_m;var Sf=class extends Pe{constructor(e){super(e)}};pe.ErrContract=Sf;var Sm=class extends Sf{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). -`)}};pe.ErrContractHasNoAddress=Tm;var Cm=class extends Pe{constructor(e){super(e)}};pe.ErrMock=Cm;var xm=class extends Pe{constructor(e){super(e)}};pe.ErrTypingSystem=xm;var Nm=class extends Pe{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=Nm;var Om=class extends Pe{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=Om;var Dm=class extends Pe{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Dm;var Pm=class extends Pe{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=Pm;var Rm=class extends Pe{constructor(e){super(e)}};pe.ErrCodec=Rm;var Bm=class extends Pe{constructor(e){super(e)}};pe.ErrContractInteraction=Bm;var Lm=class extends Pe{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Lm;var Fm=class extends Pe{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Fm;var Mm=class extends Pe{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=Mm;var Um=class extends Pe{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=Um;var qm=class extends Pe{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};pe.ErrIsCompletedFieldIsMissingOnTransaction=qm});var Hm=v(vi=>{"use strict";l();var p5=vi&&vi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vi,"__esModule",{value:!0});vi.TokenPayment=vi.TokenTransfer=void 0;var ju=p5(Yt()),g5=Le(),zS="EGLD",WS=18;ju.default.set({ROUNDING_MODE:1});var Tf=class t{constructor(e){let r=new ju.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new g5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new ju.default(e).shiftedBy(WS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:zS,nonce:0,amountAsBigInteger:e,numDecimals:WS})}static fungibleFromAmount(e,r,n){let i=new ju.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new ju.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({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==zS}isFungible(){return this.nonce==0}};vi.TokenTransfer=Tf;var Vm=class extends Tf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};vi.TokenPayment=Vm});var Os=v(Xe=>{"use strict";l();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ARGUMENTS_SEPARATOR=Xe.ESDT_TRANSFER_VALUE=Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_GAS_LIMIT=Xe.TRANSACTION_VERSION_WITH_OPTIONS=Xe.TRANSACTION_VERSION_DEFAULT=Xe.TRANSACTION_OPTIONS_TX_GUARDED=Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=Xe.TRANSACTION_OPTIONS_DEFAULT=Xe.TRANSACTION_MIN_GAS_PRICE=void 0;Xe.TRANSACTION_MIN_GAS_PRICE=1e9;Xe.TRANSACTION_OPTIONS_DEFAULT=0;Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;Xe.TRANSACTION_OPTIONS_TX_GUARDED=2;Xe.TRANSACTION_VERSION_DEFAULT=1;Xe.TRANSACTION_VERSION_WITH_OPTIONS=2;Xe.ESDT_TRANSFER_GAS_LIMIT=5e5;Xe.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";Xe.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";Xe.ESDT_TRANSFER_VALUE="0";Xe.ARGUMENTS_SEPARATOR="@"});var br=v(ot=>{"use strict";l();var y5=ot&&ot.__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]}),m5=ot&&ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w5=ot&&ot.__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)&&y5(e,t,r);return m5(e,t),e};Object.defineProperty(ot,"__esModule",{value:!0});ot.isEmpty=ot.guardEmpty=ot.guardNotEmpty=ot.guardLength=ot.guardSameLength=ot.guardValueIsSetWithMessage=ot.guardValueIsSet=ot.guardTrue=void 0;var Do=w5(Le());function E5(t,e){if(!t)throw new Do.ErrInvariantFailed(`[<${e}>] isn't true`)}ot.guardTrue=E5;function v5(t,e){$S(`${t} isn't set (null or undefined)`,e)}ot.guardValueIsSet=v5;function $S(t,e){if(e==null||e===void 0)throw new Do.ErrInvariantFailed(t)}ot.guardValueIsSetWithMessage=$S;function A5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Do.ErrInvariantFailed("arrays do not have the same length")}ot.guardSameLength=A5;function b5(t,e){let r=t.length||0;if(r!=e)throw new Do.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}ot.guardLength=b5;function I5(t,e){if(km(t))throw new Do.ErrInvariantFailed(`${e} is empty`)}ot.guardNotEmpty=I5;function _5(t,e){if(!km(t))throw new Do.ErrInvariantFailed(`${e} is not empty`)}ot.guardEmpty=_5;function km(t){return t.isEmpty?t.isEmpty():t.length===0}ot.isEmpty=km});var KS=v(Cf=>{"use strict";l();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.getJavascriptPrototypesInHierarchy=void 0;function S5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Cf.getJavascriptPrototypesInHierarchy=S5});var Ct=v(Tt=>{"use strict";l();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.NullType=Tt.TypePlaceholder=Tt.isTyped=Tt.PrimitiveValue=Tt.TypedValue=Tt.CustomType=Tt.PrimitiveType=Tt.TypeCardinality=Tt.Type=void 0;var Gm=KS(),YS=br(),Ai=class t{constructor(e,r=[],n=Qu.fixed(1)){YS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return Gm.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 YS.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 t.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(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Gm.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(){}};Tt.Type=Ai;Ai.ClassName="Type";var Qu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(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||t.MaxCardinality}};Tt.TypeCardinality=Qu;Qu.MaxCardinality=4096;var xf=class t extends Ai{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveType=xf;xf.ClassName="PrimitiveType";var Nf=class t extends Ai{getClassName(){return t.ClassName}};Tt.CustomType=Nf;Nf.ClassName="CustomType";var zu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return Gm.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(){}};Tt.TypedValue=zu;zu.ClassName="TypedValue";var Of=class t extends zu{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveValue=Of;Of.ClassName="PrimitiveValue";function T5(t){return t.belongsToTypesystem!==void 0}Tt.isTyped=T5;var Df=class t extends Ai{constructor(){super("...")}getClassName(){return t.ClassName}};Tt.TypePlaceholder=Df;Df.ClassName="TypePlaceholder";var Pf=class t extends Ai{constructor(){super("?")}getClassName(){return t.ClassName}};Tt.NullType=Pf;Pf.ClassName="NullType"});var JS=v((Po,Ro)=>{l();(function(t){var e=typeof Po=="object"&&Po&&!Po.nodeType&&Po,r=typeof Ro=="object"&&Ro&&!Ro.nodeType&&Ro,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,c=38,f=700,d=72,g=128,m="-",y=/^xn--/,A=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=o-a,M=Math.floor,b=String.fromCharCode,S;function N(J){throw new RangeError(R[J])}function _(J,oe){for(var re=J.length,se=[];re--;)se[re]=oe(J[re]);return se}function T(J,oe){var re=J.split("@"),se="";re.length>1&&(se=re[0]+"@",J=re[1]),J=J.replace(O,".");var U=J.split("."),fe=_(U,oe).join(".");return se+fe}function B(J){for(var oe=[],re=0,se=J.length,U,fe;re=55296&&U<=56319&&re65535&&(oe-=65536,re+=b(oe>>>10&1023|55296),oe=56320|oe&1023),re+=b(oe),re}).join("")}function Q(J){return J-48<10?J-22:J-65<26?J-65:J-97<26?J-97:o}function H(J,oe){return J+22+75*(J<26)-((oe!=0)<<5)}function j(J,oe,re){var se=0;for(J=re?M(J/f):J>>1,J+=M(J/oe);J>z*u>>1;se+=o)J=M(J/z);return M(se+(z+1)*J/(J+c))}function K(J){var oe=[],re=J.length,se,U=0,fe=g,ue=d,de,ae,le,w,E,I,P,C,D;for(de=J.lastIndexOf(m),de<0&&(de=0),ae=0;ae=128&&N("not-basic"),oe.push(J.charCodeAt(ae));for(le=de>0?de+1:0;le=re&&N("invalid-input"),P=Q(J.charCodeAt(le++)),(P>=o||P>M((s-U)/E))&&N("overflow"),U+=P*E,C=I<=ue?a:I>=ue+u?u:I-ue,!(PM(s/D)&&N("overflow"),E*=D;se=oe.length+1,ue=j(U-w,se,w==0),M(U/se)>s-fe&&N("overflow"),fe+=M(U/se),U%=se,oe.splice(U++,0,fe)}return X(oe)}function me(J){var oe,re,se,U,fe,ue,de,ae,le,w,E,I=[],P,C,D,L;for(J=B(J),P=J.length,oe=g,re=0,fe=d,ue=0;ue=oe&&EM((s-re)/C)&&N("overflow"),re+=(de-oe)*C,oe=de,ue=0;ues&&N("overflow"),E==oe){for(ae=re,le=o;w=le<=fe?a:le>=fe+u?u:le-fe,!(ae{"use strict";l();var ZS=JS();function C5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function jm(t){return t>="0"&&t<="7"}function x5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function XS(t){return t=parseInt(t,16),ZS.ucs2.encode([t])}function eT(t,e,r){var n=!1,i=[];function s(u){var c=t[u];if(!x5(c))throw new C5(u,"Unexpected token ILLEGAL");return c}for(;e{l();var iT=tT();aT.exports={validate:N5,parse:O5};function N5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Rf(t,0,e,!1)}catch(n){r=n.message}return r}function O5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Rf(t,0,e,!0);return r.value}function sT(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function B5(t,e,r,n){for(var i=e,s=",",o=[],a=e;Ds(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Rf(t,i,r,n),c=sT(t,u.end);n&&o.push(u.value),i=c.end,s=c.value}return{start:e,end:i,value:o}}function L5(t,e){return t.substr(e,4)==="true"}function F5(t,e){return t.substr(e,5)==="false"}function M5(t,e){return t.substr(e,4)==="null"}var U5=new RegExp(/^\s$/);function Ds(t){return U5.test(t)}var q5=new RegExp(/^\d$/);function rT(t){return q5.test(t)}function Kn(t,e,r){var n=10,i;t.length{"use strict";l();var V5=cn&&cn.__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]}),H5=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k5=cn&&cn.__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)&&V5(e,t,r);return H5(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.TypeExpressionParser=void 0;var cT=k5(Le()),G5=Ct(),j5=uT(),zm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new cT.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return j5.parse(r)}catch{throw new cT.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 G5.Type(e,n)}};cn.TypeExpressionParser=zm});var $m=v(bi=>{"use strict";l();Object.defineProperty(bi,"__esModule",{value:!0});bi.EndpointParameterDefinition=bi.EndpointModifiers=bi.EndpointDefinition=void 0;var Q5=Wu(),lT="?",z5="N / A",Wm=class t{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?lT:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>$u.fromJSON(s)),n=e.outputs.map(s=>$u.fromJSON(s)),i=new Bf(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};bi.EndpointDefinition=Wm;var Bf=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}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"}isOnlyOwner(){return this.onlyOwner}};bi.EndpointModifiers=Bf;var $u=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Q5.TypeExpressionParser().parse(e.type);return new t(e.name||lT,e.description||z5,r)}};bi.EndpointParameterDefinition=$u});var Bo=v(fr=>{"use strict";l();var W5=fr&&fr.__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]}),$5=fr&&fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K5=fr&&fr.__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)&&W5(e,t,r);return $5(e,t),e};Object.defineProperty(fr,"__esModule",{value:!0});fr.Fields=fr.Field=fr.FieldDefinition=void 0;var Km=K5(Le()),Y5=Wu(),Ym=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Y5.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};fr.FieldDefinition=Ym;var Jm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Km.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Km.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};fr.Field=Jm;var Xm=class{static checkTyping(e,r){if(e.length!=r.length)throw new Km.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";l();Object.defineProperty(Ii,"__esModule",{value:!0});Ii.EnumValue=Ii.EnumVariantDefinition=Ii.EnumType=void 0;var J5=Le(),Zm=br(),Lf=Bo(),dT=Ct(),fT=256,Ff=class t extends dT.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>Mf.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>Object.assign(Object.assign({},n),{discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Zm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Zm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};Ii.EnumType=Ff;Ff.ClassName="EnumType";var Mf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Zm.guardTrue(rLf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Lf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ii.EnumVariantDefinition=Mf;var Uf=class t extends dT.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();Lf.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(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=Lf.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 J5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};Ii.EnumValue=Uf;Uf.ClassName="EnumValue"});var pT=v(Lo=>{"use strict";l();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.EventTopicDefinition=Lo.EventDefinition=void 0;var X5=Wu(),hT="?",ew=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?hT:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>qf.fromJSON(n));return new t(e.identifier,r)}};Lo.EventDefinition=ew;var qf=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new X5.TypeExpressionParser().parse(e.type);return new t({name:e.name||hT,type:r,indexed:e.indexed})}};Lo.EventTopicDefinition=qf});var Mo=v(Fo=>{"use strict";l();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Struct=Fo.StructType=void 0;var Z5=Le(),Vf=Bo(),gT=Ct(),Hf=class t extends gT.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Vf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Vf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Fo.StructType=Hf;Hf.ClassName="StructType";var kf=class t extends gT.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Vf.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 Z5.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 Vf.Fields.equals(r,n)}};Fo.Struct=kf;kf.ClassName="Struct"});var rw=v((boe,wT)=>{"use strict";l();var jf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tw={};for(Yu=0;Yu>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 yT(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Uo(e)^n>>5}for(e=Uo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=yT(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=Uo(n)^o,i+=jf.charAt(o)}for(s=0;s<6;++s)n=Uo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=jf.charAt(a)}return i}function mT(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=yT(s);if(typeof a=="string")return a;for(var u=[],c=0;c=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function tq(){var t=mT.apply(null,arguments);if(typeof t=="object")return t}function rq(t){var e=mT.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Qf(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";l();var aq=ln&&ln.__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]}),uq=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ET=ln&&ln.__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)&&aq(e,t,r);return uq(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.Address=void 0;var qo=ET(rw()),Vo=ET(Le()),zf="erd",Wf=32,cq="0".repeat(16),nw=class t{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 Vo.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!=Wf)throw new Vo.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==Wf}static fromHex(e){if(!t.isValidHex(e))throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=qo.decode(e)}catch(s){throw new Vo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=zf)throw new Vo.ErrAddressBadHrp(zf,n);let i=h.Buffer.from(qo.fromWords(r.words));if(i.length!=Wf)throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}static isValid(e){let r=qo.decodeUnsafe(e),n=r?.prefix,i=r?h.Buffer.from(qo.fromWords(r.words)):void 0;return!(n!==zf||i?.length!==Wf)}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=qo.toWords(this.pubkey());return qo.encode(zf,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(cq)}};ln.Address=nw});var ko=v(Ho=>{"use strict";l();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.AddressValue=Ho.AddressType=void 0;var lq=pt(),vT=Ct(),Ju=class t extends vT.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Ho.AddressType=Ju;Ju.ClassName="AddressType";var $f=class t extends vT.PrimitiveValue{constructor(e){super(new Ju),this.value=new lq.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ho.AddressValue=$f;$f.ClassName="AddressValue"});var Yf=v(Go=>{"use strict";l();Object.defineProperty(Go,"__esModule",{value:!0});Go.OptionalValue=Go.OptionalType=void 0;var fq=br(),Xu=Ct(),Zu=class t extends Xu.Type{constructor(e){super("Optional",[e],Xu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Xu.NullType.ClassName);return r||n}};Go.OptionalType=Zu;Zu.ClassName="OptionalType";var Kf=class t extends Xu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Zu(new Xu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return fq.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}};Go.OptionalValue=Kf;Kf.ClassName="OptionalValue"});var tc=v(jo=>{"use strict";l();Object.defineProperty(jo,"__esModule",{value:!0});jo.BooleanValue=jo.BooleanType=void 0;var AT=Ct(),ec=class t extends AT.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};jo.BooleanType=ec;ec.ClassName="BooleanType";var Jf=class t extends AT.PrimitiveValue{constructor(e){super(new ec),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};jo.BooleanValue=Jf;Jf.ClassName="BooleanValue"});var _i=v(Qo=>{"use strict";l();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.BytesValue=Qo.BytesType=void 0;var bT=Ct(),rc=class t extends bT.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Qo.BytesType=rc;rc.ClassName="BytesType";var Xf=class t extends bT.PrimitiveValue{constructor(e){super(new rc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new t(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()}};Qo.BytesValue=Xf;Xf.ClassName="BytesValue"});var _T=v(zo=>{"use strict";l();Object.defineProperty(zo,"__esModule",{value:!0});zo.CodeMetadataValue=zo.CodeMetadataType=void 0;var IT=Ct(),Zf=class extends IT.PrimitiveType{constructor(){super("CodeMetadata")}};zo.CodeMetadataType=Zf;var iw=class extends IT.PrimitiveValue{constructor(e){super(new Zf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};zo.CodeMetadataValue=iw});var td=v(Wo=>{"use strict";l();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.CompositeValue=Wo.CompositeType=void 0;var dq=br(),sw=Ct(),nc=class t extends sw.Type{constructor(...e){super("Composite",e,sw.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Wo.CompositeType=nc;nc.ClassName="CompositeType";var ed=class t extends sw.TypedValue{constructor(e,r){super(e),dq.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new nc(...r);return new t(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";l();Object.defineProperty(rd,"__esModule",{value:!0});rd.CollectionOfTypedValues=void 0;var ow=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";l();Object.defineProperty(fn,"__esModule",{value:!0});fn.List=fn.OptionValue=fn.ListType=fn.OptionType=void 0;var hq=br(),pq=aw(),Rs=Ct(),Ps=class t extends Rs.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Rs.NullType.ClassName);return r||n}};fn.OptionType=Ps;Ps.ClassName="OptionType";var ic=class t extends Rs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};fn.ListType=ic;ic.ClassName="ListType";var nd=class t extends Rs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Ps(new Rs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Ps(e))}static newProvided(e){let r=new Ps(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return hq.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}};fn.OptionValue=nd;nd.ClassName="OptionValue";var id=class t extends Rs.TypedValue{constructor(e,r){super(e),this.backingCollection=new pq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Rs.TypePlaceholder,[]);let r=e[0].getType(),n=new ic(r);return new t(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)}};fn.List=id;id.ClassName="List"});var ad=v($o=>{"use strict";l();Object.defineProperty($o,"__esModule",{value:!0});$o.ArrayVec=$o.ArrayVecType=void 0;var ST=br(),gq=aw(),TT=Ct(),sd=class t extends TT.Type{constructor(e,r){super("Array",[r]),ST.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};$o.ArrayVecType=sd;sd.ClassName="ArrayVecType";var od=class t extends TT.TypedValue{constructor(e,r){super(e),ST.guardLength(r,e.length),this.backingCollection=new gq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};$o.ArrayVec=od;od.ClassName="ArrayVec"});var ac=v(Ko=>{"use strict";l();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.H256Value=Ko.H256Type=void 0;var CT=Ct(),oc=class t extends CT.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Ko.H256Type=oc;oc.ClassName="H256Type";var ud=class t extends CT.PrimitiveValue{constructor(e){super(new oc),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ko.H256Value=ud;ud.ClassName="H256Value"});var ld=v(Yo=>{"use strict";l();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.NothingValue=Yo.NothingType=void 0;var xT=Ct(),uc=class t extends xT.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Yo.NothingType=uc;uc.ClassName="NothingType";var cd=class t extends xT.PrimitiveValue{constructor(){super(new uc)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Yo.NothingValue=cd;cd.ClassName="NothingValue"});var Ec=v(Ce=>{"use strict";l();var yq=Ce&&Ce.__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]}),mq=Ce&&Ce.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wq=Ce&&Ce.__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)&&yq(e,t,r);return mq(e,t),e},Eq=Ce&&Ce.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.BigIntValue=Ce.BigUIntValue=Ce.I64Value=Ce.U64Value=Ce.I32Value=Ce.U32Value=Ce.I16Value=Ce.U16Value=Ce.I8Value=Ce.U8Value=Ce.NumericalValue=Ce.BigIntType=Ce.BigUIntType=Ce.I64Type=Ce.U64Type=Ce.I32Type=Ce.U32Type=Ce.I16Type=Ce.U16Type=Ce.I8Type=Ce.U8Type=Ce.NumericalType=void 0;var NT=wq(Le()),OT=Ct(),Bs=Eq(Yt()),dr=class t extends OT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ce.NumericalType=dr;dr.ClassName="NumericalType";var cc=class t extends dr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ce.U8Type=cc;cc.ClassName="U8Type";var lc=class t extends dr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ce.I8Type=lc;lc.ClassName="I8Type";var fc=class t extends dr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ce.U16Type=fc;fc.ClassName="U16Type";var dc=class t extends dr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ce.I16Type=dc;dc.ClassName="I16Type";var hc=class t extends dr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ce.U32Type=hc;hc.ClassName="U32Type";var pc=class t extends dr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ce.I32Type=pc;pc.ClassName="I32Type";var gc=class t extends dr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ce.U64Type=gc;gc.ClassName="U64Type";var yc=class t extends dr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ce.I64Type=yc;yc.ClassName="I64Type";var mc=class t extends dr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ce.BigUIntType=mc;mc.ClassName="BigUIntType";var wc=class t extends dr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ce.BigIntType=wc;wc.ClassName="BigIntType";var hr=class t extends OT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Bs.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new NT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new NT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ce.NumericalValue=hr;hr.ClassName="NumericalValue";var fd=class t extends hr{constructor(e){super(new cc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U8Value=fd;fd.ClassName="U8Value";var dd=class t extends hr{constructor(e){super(new lc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I8Value=dd;dd.ClassName="I8Value";var hd=class t extends hr{constructor(e){super(new fc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U16Value=hd;hd.ClassName="U16Value";var pd=class t extends hr{constructor(e){super(new dc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I16Value=pd;pd.ClassName="I16Value";var gd=class t extends hr{constructor(e){super(new hc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U32Value=gd;gd.ClassName="U32Value";var yd=class t extends hr{constructor(e){super(new pc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I32Value=yd;yd.ClassName="I32Value";var md=class t extends hr{constructor(e){super(new gc,e)}getClassName(){return t.ClassName}};Ce.U64Value=md;md.ClassName="U64Value";var wd=class t extends hr{constructor(e){super(new yc,e)}getClassName(){return t.ClassName}};Ce.I64Value=wd;wd.ClassName="I64Value";var Ed=class t extends hr{constructor(e){super(new mc,e)}getClassName(){return t.ClassName}};Ce.BigUIntValue=Ed;Ed.ClassName="BigUIntValue";var vd=class t extends hr{constructor(e){super(new wc,e)}getClassName(){return t.ClassName}};Ce.BigIntValue=vd;vd.ClassName="BigIntValue"});var bd=v(Jo=>{"use strict";l();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.StringValue=Jo.StringType=void 0;var DT=Ct(),vc=class t extends DT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Jo.StringType=vc;vc.ClassName="StringType";var Ad=class t extends DT.PrimitiveValue{constructor(e){super(new vc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Jo.StringValue=Ad;Ad.ClassName="StringValue"});var Zo=v(Xo=>{"use strict";l();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.TokenIdentifierValue=Xo.TokenIdentifierType=void 0;var PT=Ct(),vq="EGLD",Ac=class t extends PT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Xo.TokenIdentifierType=Ac;Ac.ClassName="TokenIdentifierType";var Id=class t extends PT.PrimitiveValue{constructor(e){super(new Ac),this.value=e}static egld(){return new t(vq)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.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()}};Xo.TokenIdentifierValue=Id;Id.ClassName="TokenIdentifierValue"});var Sd=v(Cr=>{"use strict";l();var Aq=Cr&&Cr.__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]}),bq=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iq=Cr&&Cr.__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)&&Aq(e,t,r);return bq(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Tuple=Cr.TupleType=void 0;var _q=Iq(Le()),RT=Bo(),BT=Mo(),bc=class t extends BT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new RT.FieldDefinition(LT(i),"anonymous tuple field",n))}};Cr.TupleType=bc;bc.ClassName="TupleType";function LT(t){return`field${t}`}var _d=class t extends BT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new _q.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new bc(...r),i=e.map((s,o)=>new RT.Field(s,LT(o)));return new t(n,i)}};Cr.Tuple=_d;_d.ClassName="Tuple"});var xd=v(Si=>{"use strict";l();Object.defineProperty(Si,"__esModule",{value:!0});Si.VariadicValue=Si.CountedVariadicType=Si.VariadicType=void 0;var ea=Ct(),Ls=class t extends ea.Type{constructor(e,r=!1){super("Variadic",[e],ea.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};Si.VariadicType=Ls;Ls.ClassName="VariadicType";var Td=class extends ea.Type{constructor(e){super("Variadic",[e],ea.TypeCardinality.variable())}getClassName(){return Ls.ClassName}};Si.CountedVariadicType=Td;Td.ClassName="VariadicType";var Cd=class t extends ea.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Ls(new ea.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Ls(n,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";l();var Sq=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]}),Tq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cq=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)&&Sq(e,t,r);return Tq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.TypeMapper=void 0;var FT=Cq(Le()),xq=ko(),uw=Yf(),Nq=tc(),Oq=_i(),Dq=_T(),Nd=td(),cw=Ku(),Pq=Bo(),MT=sc(),dn=ad(),Rq=ac(),UT=ld(),xr=Ec(),Bq=bd(),qT=Mo(),VT=Zo(),Ti=Sd(),Od=xd(),lw=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new MT.OptionType(r[0])],["List",(...r)=>new MT.ListType(r[0])],["VarArgs",(...r)=>new Od.VariadicType(r[0])],["MultiResultVec",(...r)=>new Od.VariadicType(r[0])],["variadic",(...r)=>new Od.VariadicType(r[0])],["counted-variadic",(...r)=>new Od.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new uw.OptionalType(r[0])],["optional",(...r)=>new uw.OptionalType(r[0])],["OptionalResult",(...r)=>new uw.OptionalType(r[0])],["multi",(...r)=>new Nd.CompositeType(...r)],["MultiArg",(...r)=>new Nd.CompositeType(...r)],["MultiResult",(...r)=>new Nd.CompositeType(...r)],["multi",(...r)=>new Nd.CompositeType(...r)],["tuple",(...r)=>new Ti.TupleType(...r)],["tuple2",(...r)=>new Ti.TupleType(...r)],["tuple3",(...r)=>new Ti.TupleType(...r)],["tuple4",(...r)=>new Ti.TupleType(...r)],["tuple5",(...r)=>new Ti.TupleType(...r)],["tuple6",(...r)=>new Ti.TupleType(...r)],["tuple7",(...r)=>new Ti.TupleType(...r)],["tuple8",(...r)=>new Ti.TupleType(...r)],["array2",(...r)=>new dn.ArrayVecType(2,r[0])],["array8",(...r)=>new dn.ArrayVecType(8,r[0])],["array16",(...r)=>new dn.ArrayVecType(16,r[0])],["array20",(...r)=>new dn.ArrayVecType(20,r[0])],["array32",(...r)=>new dn.ArrayVecType(32,r[0])],["array46",(...r)=>new dn.ArrayVecType(46,r[0])],["array48",(...r)=>new dn.ArrayVecType(48,r[0])],["array64",(...r)=>new dn.ArrayVecType(64,r[0])],["array128",(...r)=>new dn.ArrayVecType(128,r[0])],["array256",(...r)=>new dn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new xr.U8Type],["u16",new xr.U16Type],["u32",new xr.U32Type],["u64",new xr.U64Type],["U64",new xr.U64Type],["BigUint",new xr.BigUIntType],["i8",new xr.I8Type],["i16",new xr.I16Type],["i32",new xr.I32Type],["i64",new xr.I64Type],["Bigint",new xr.BigIntType],["BigInt",new xr.BigIntType],["bool",new Nq.BooleanType],["bytes",new Oq.BytesType],["Address",new xq.AddressType],["H256",new Rq.H256Type],["utf-8 string",new Bq.StringType],["TokenIdentifier",new VT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new VT.TokenIdentifierType],["CodeMetadata",new Dq.CodeMetadataType],["nothing",new UT.NothingType],["AsyncCall",new UT.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 FT.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(cw.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(qT.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 qT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new cw.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new cw.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new Pq.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 FT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};hn.TypeMapper=lw});var QT=v(pn=>{"use strict";l();var Lq=pn&&pn.__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]}),Fq=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mq=pn&&pn.__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)&&Lq(e,t,r);return Fq(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.AbiRegistry=void 0;var HT=Mq(Le()),Ic=br(),_c=$m(),kT=Ku(),dw=pT(),GT=Mo(),Uq=fw(),qq="?",hw=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||qq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=e.events||[],a=_c.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),u=i.map(m=>_c.EndpointDefinition.fromJSON(m)),c=[];for(let m in s){let y=s[m];if(y.type=="struct")c.push(GT.StructType.fromJSON({name:m,fields:y.fields}));else if(y.type=="enum"||y.type=="explicit-enum")c.push(kT.EnumType.fromJSON({name:m,variants:y.variants}));else throw new HT.ErrTypingSystem(`Cannot handle custom type: ${m}`)}let f=o.map(m=>dw.EventDefinition.fromJSON(m));return new t({name:r,constructorDefinition:a,endpoints:u,customTypes:c,events:f}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Ic.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(GT.StructType.ClassName));return Ic.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(kT.EnumType.ClassName));return Ic.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 Ic.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Ic.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new Uq.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new HT.ErrTypingSystem("Did not re-map all custom types");let n=jT(this.constructorDefinition,e),i=[];for(let a of this.endpoints)i.push(jT(a,e));let s=this.events.map(a=>Vq(a,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r,events:s})}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(c=>c.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};pn.AbiRegistry=hw;function jT(t,e){let r=t.input.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new _c.EndpointDefinition(t.name,r,n,t.modifiers)}function Vq(t,e){let r=t.inputs.map(n=>new dw.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new dw.EventDefinition(t.identifier,r)}});var WT=v(ta=>{"use strict";l();Object.defineProperty(ta,"__esModule",{value:!0});ta.createListOfTokenIdentifiers=ta.createListOfAddresses=void 0;var Hq=ko(),zT=sc(),kq=Zo();function Gq(t){let e=t.map(n=>new Hq.AddressValue(n));return zT.List.fromItems(e)}ta.createListOfAddresses=Gq;function jq(t){let e=t.map(n=>new kq.TokenIdentifierValue(n));return zT.List.fromItems(e)}ta.createListOfTokenIdentifiers=jq});var aC=v(Jt=>{"use strict";l();var Qq=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]}),zq=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wq=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)&&Qq(e,t,r);return zq(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.onPrimitiveTypeSelect=Jt.onPrimitiveValueSelect=Jt.onTypedValueSelect=Jt.onTypeSelect=void 0;var Pd=Wq(Le()),$T=ko(),KT=tc(),YT=_i(),JT=Ku(),Dd=sc(),XT=ac(),ZT=Ec(),eC=ld(),tC=Mo(),rC=Zo(),nC=Sd(),iC=Ct(),sC=ad(),oC=bd();function $q(t,e){if(t.hasExactClass(Dd.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Dd.ListType.ClassName))return e.onList();if(t.hasExactClass(sC.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(iC.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(tC.StructType.ClassName))return e.onStruct();if(t.hasExactClass(nC.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(JT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't known: ${t}`)}Jt.onTypeSelect=$q;function Kq(t,e){if(t.hasClassOrSuperclass(iC.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Dd.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Dd.List.ClassName))return e.onList();if(t.hasExactClass(sC.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(tC.Struct.ClassName))return e.onStruct();if(t.hasExactClass(nC.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(JT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't typed: ${t}`)}Jt.onTypedValueSelect=Kq;function Yq(t,e){if(t.hasExactClass(KT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(ZT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass($T.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(YT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(oC.StringValue.ClassName))return e.onString();if(t.hasExactClass(XT.H256Value.ClassName))return e.onH256();if(t.hasExactClass(rC.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(eC.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Jt.onPrimitiveValueSelect=Yq;function Jq(t,e){if(t.hasExactClass(KT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(ZT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass($T.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(YT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(oC.StringType.ClassName))return e.onString();if(t.hasExactClass(XT.H256Type.ClassName))return e.onH256();if(t.hasExactClass(rC.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(eC.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Jt.onPrimitiveTypeSelect=Jq});var xt=v(He=>{"use strict";l();var Xq=He&&He.__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]}),at=He&&He.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xq(e,t,r)};Object.defineProperty(He,"__esModule",{value:!0});at(QT(),He);at(ko(),He);at(Yf(),He);at(tc(),He);at(_i(),He);at(td(),He);at($m(),He);at(Ku(),He);at(WT(),He);at(Bo(),He);at(sc(),He);at(ad(),He);at(ac(),He);at(aC(),He);at(ld(),He);at(Ec(),He);at(bd(),He);at(Mo(),He);at(Zo(),He);at(Sd(),He);at(Wu(),He);at(fw(),He);at(Ct(),He);at(xd(),He)});var cC=v(gn=>{"use strict";l();var Zq=gn&&gn.__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]}),eV=gn&&gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tV=gn&&gn.__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)&&Zq(e,t,r);return eV(e,t),e};Object.defineProperty(gn,"__esModule",{value:!0});gn.OptionValueBinaryCodec=void 0;var uC=tV(Le()),Rd=xt(),pw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Rd.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new uC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Rd.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Rd.OptionValue(r);if(e[0]!=1)throw new uC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Rd.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([])}};gn.OptionValueBinaryCodec=pw});var lC=v(Bd=>{"use strict";l();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.AddressBinaryCodec=void 0;var rV=pt(),nV=xt(),gw=class{decodeNested(e){let r=e.slice(0,32),n=new rV.Address(r);return[new nV.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()}};Bd.AddressBinaryCodec=gw});var dC=v(yn=>{"use strict";l();var iV=yn&&yn.__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]}),sV=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oV=yn&&yn.__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)&&iV(e,t,r);return sV(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.BooleanBinaryCodec=void 0;var aV=oV(Le()),fC=xt(),Sc=class t{decodeNested(e){let r=e.readUInt8(0);return[new fC.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new aV.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new fC.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([])}};yn.BooleanBinaryCodec=Sc;Sc.TRUE=1;Sc.FALSE=0});var Fd=v(Ld=>{"use strict";l();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.SizeOfU32=void 0;Ld.SizeOfU32=4});var Md=v(mn=>{"use strict";l();var uV=mn&&mn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mn,"__esModule",{value:!0});mn.zeroPadStringIfOddLength=mn.isPaddedHex=mn.numberToPaddedHex=void 0;var cV=uV(Yt());function lV(t){let e=new cV.default(t).toString(16);return hC(e)}mn.numberToPaddedHex=lV;function fV(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}mn.isPaddedHex=fV;function hC(t){return t=t||"",t.length%2==1?"0"+t:t}mn.zeroPadStringIfOddLength=hC});var Tc=v(Nt=>{"use strict";l();var dV=Nt&&Nt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.prependByteToBuffer=Nt.flipBufferBitsInPlace=Nt.getHexMagnitudeOfBigInt=Nt.bigIntToBuffer=Nt.bufferToBigInt=Nt.cloneBuffer=Nt.isMsbZero=Nt.isMsbOne=void 0;var yw=dV(Yt()),hV=Md();function pC(t,e=0){return t[e]>>7==1}Nt.isMsbOne=pC;function pV(t,e=0){return!pC(t,e)}Nt.isMsbZero=pV;function gV(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Nt.cloneBuffer=gV;function yV(t){let e=t.toString("hex");return new yw.default(`0x${e}`,16)}Nt.bufferToBigInt=yV;function mV(t){let e=gC(t);return h.Buffer.from(e,"hex")}Nt.bigIntToBuffer=mV;function gC(t){return t=new yw.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new yw.default(-1))),hV.numberToPaddedHex(t)):""}Nt.getHexMagnitudeOfBigInt=gC;function wV(t){for(let e=0;e{"use strict";l();var vV=ra&&ra.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ra,"__esModule",{value:!0});ra.NumericalBinaryCodec=void 0;var Cc=vV(Yt()),mw=xt(),yC=Fd(),At=Tc(),ww=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=yC.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=At.cloneBuffer(e);if(e.length==0)return new mw.NumericalValue(r,new Cc.default(0));if(!r.withSign||At.isMsbZero(n)){let c=At.bufferToBigInt(n);return new mw.NumericalValue(r,c)}At.flipBufferBitsInPlace(n);let u=At.bufferToBigInt(n).multipliedBy(new Cc.default(-1)).minus(new Cc.default(1));return new mw.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(yC.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=At.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=At.bigIntToBuffer(e.value);At.isMsbOne(o)&&(o=At.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new Cc.default(1)),i=At.bigIntToBuffer(n);At.flipBufferBitsInPlace(i),At.isMsbZero(i)&&(i=At.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):At.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=At.bigIntToBuffer(e.value);return At.isMsbOne(i)&&(i=At.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Cc.default(1)),n=At.bigIntToBuffer(r);return At.flipBufferBitsInPlace(n),At.isMsbZero(n)&&(n=At.prependByteToBuffer(n,255)),n}};ra.NumericalBinaryCodec=ww});var wC=v(Ud=>{"use strict";l();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.H256BinaryCodec=void 0;var AV=ac(),Ew=class{decodeNested(e){let r=e.slice(0,32);return[new AV.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Ud.H256BinaryCodec=Ew});var Hd=v(Vd=>{"use strict";l();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.BytesBinaryCodec=void 0;var EC=_i(),qd=Fd(),vw=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(qd.SizeOfU32,qd.SizeOfU32+r);return[new EC.BytesValue(n),qd.SizeOfU32+r]}decodeTopLevel(e){return new EC.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(qd.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Vd.BytesBinaryCodec=vw});var AC=v(kd=>{"use strict";l();Object.defineProperty(kd,"__esModule",{value:!0});kd.TokenIdentifierCodec=void 0;var bV=_i(),vC=Zo(),IV=Hd(),Aw=class{constructor(){this.bytesCodec=new IV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new vC.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new vC.TokenIdentifierValue(r.toString())}encodeNested(e){let r=bV.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};kd.TokenIdentifierCodec=Aw});var IC=v(Gd=>{"use strict";l();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.NothingCodec=void 0;var bC=xt(),bw=class{decodeNested(){return[new bC.NothingValue,0]}decodeTopLevel(){return new bC.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Gd.NothingCodec=bw});var SC=v(jd=>{"use strict";l();Object.defineProperty(jd,"__esModule",{value:!0});jd.StringBinaryCodec=void 0;var _C=xt(),_V=_i(),SV=Hd(),Iw=class{constructor(){this.bytesBinaryCodec=new SV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new _C.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new _C.StringValue(e.toString())}encodeNested(e){let r=_V.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};jd.StringBinaryCodec=Iw});var TC=v(zd=>{"use strict";l();Object.defineProperty(zd,"__esModule",{value:!0});zd.PrimitiveBinaryCodec=void 0;var Qd=xt(),TV=lC(),CV=dC(),xV=mC(),NV=wC(),OV=Hd(),DV=AC(),PV=IC(),RV=SC(),_w=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new CV.BooleanBinaryCodec,this.numericalCodec=new xV.NumericalBinaryCodec,this.addressCodec=new TV.AddressBinaryCodec,this.h256Codec=new NV.H256BinaryCodec,this.bytesCodec=new OV.BytesBinaryCodec,this.stringCodec=new RV.StringBinaryCodec,this.tokenIdentifierCodec=new DV.TokenIdentifierCodec,this.nothingCodec=new PV.NothingCodec}decodeNested(e,r){return Qd.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 Qd.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 Qd.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 Qd.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()})}};zd.PrimitiveBinaryCodec=_w});var NC=v(Wd=>{"use strict";l();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.ListBinaryCodec=void 0;var CC=xt(),xC=Fd(),Sw=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=xC.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 CC.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(xC.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)}};Wd.ListBinaryCodec=Sw});var Cw=v($d=>{"use strict";l();Object.defineProperty($d,"__esModule",{value:!0});$d.FieldsBinaryCodec=void 0;var BV=xt(),Tw=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 BV.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)}};$d.FieldsBinaryCodec=Tw});var Nw=v(Kd=>{"use strict";l();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.StructBinaryCodec=void 0;var LV=xt(),FV=Cw(),xw=class{constructor(e){this.fieldsCodec=new FV.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 LV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Kd.StructBinaryCodec=xw});var OC=v(Jd=>{"use strict";l();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.EnumBinaryCodec=void 0;var Yd=xt(),MV=Cw(),Ow=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new MV.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 Yd.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Yd.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Yd.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 Yd.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};Jd.EnumBinaryCodec=Ow});var DC=v(Xd=>{"use strict";l();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TupleBinaryCodec=void 0;var UV=Nw(),Dw=class{constructor(e){this.structCodec=new UV.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)}};Xd.TupleBinaryCodec=Dw});var PC=v(Zd=>{"use strict";l();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ArrayVecBinaryCodec=void 0;var qV=xt(),Pw=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";l();var VV=Nr&&Nr.__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]}),HV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kV=Nr&&Nr.__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)&&VV(e,t,r);return HV(e,t),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.BinaryCodecConstraints=Nr.BinaryCodec=void 0;var RC=kV(Le()),eh=xt(),BC=br(),GV=cC(),jV=TC(),QV=NC(),zV=Nw(),WV=OC(),$V=DC(),KV=PC(),Rw=class{constructor(e=null){this.constraints=e||new th,this.optionCodec=new GV.OptionValueBinaryCodec(this),this.listCodec=new QV.ListBinaryCodec(this),this.arrayCodec=new KV.ArrayVecBinaryCodec(this),this.primitiveCodec=new jV.PrimitiveBinaryCodec(this),this.structCodec=new zV.StructBinaryCodec(this),this.tupleCodec=new $V.TupleBinaryCodec(this),this.enumCodec=new WV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),eh.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]=eh.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 BC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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 BC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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)})}};Nr.BinaryCodec=Rw;var th=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new RC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new RC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Nr.BinaryCodecConstraints=th});var LC=v(Or=>{"use strict";l();var YV=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var JV=YV(Yt()),rh=xt(),XV=Bw(),nh=new XV.BinaryCodec;function ZV(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=ZV;function eH(t){return!!nh.decodeTopLevel(t,new rh.BooleanType).valueOf()}Or.decodeBool=eH;function tH(t){let e=nh.decodeTopLevel(t,new rh.BytesType);return String(e.valueOf())}Or.decodeString=tH;function rH(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return new JV.default(e.valueOf())}Or.decodeBigNumber=rH});var Lw=v(Ci=>{"use strict";l();var nH=Ci&&Ci.__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]}),FC=Ci&&Ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nH(e,t,r)};Object.defineProperty(Ci,"__esModule",{value:!0});FC(Bw(),Ci);FC(LC(),Ci)});var na=v(ih=>{"use strict";l();Object.defineProperty(ih,"__esModule",{value:!0});ih.ArgSerializer=void 0;var MC=Os(),iH=Lw(),UC=xt(),Fw=Yf(),Mw=td(),Uw=xd(),sH={codec:new iH.BinaryCodec},qw=class{constructor(e){e=Object.assign(Object.assign({},sH),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(MC.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 d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(MC.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 o of e)i(o);function i(o){if(o.hasExactClass(Fw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(Uw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(Mw.CompositeValue.ClassName)){let u=o;for(let c of u.getItems())i(c);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new UC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};ih.ArgSerializer=qw});var ah=v(oh=>{"use strict";l();Object.defineProperty(oh,"__esModule",{value:!0});oh.Compatibility=void 0;var oH=pt(),sh=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()==oH.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.`))}};oh.Compatibility=sh;sh.areWarningsEnabled=!0});var qC=v(wn=>{"use strict";l();var aH=wn&&wn.__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]}),uH=wn&&wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cH=wn&&wn.__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)&&aH(e,t,r);return uH(e,t),e};Object.defineProperty(wn,"__esModule",{value:!0});wn.Hash=void 0;var lH=cH(Le()),Vw=class t{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 lH.ErrBadType("hash","buffer | string",e)}static empty(){return new t(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};wn.Hash=Vw});var xc=v(Dr=>{"use strict";l();var fH=Dr&&Dr.__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]}),dH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hH=Dr&&Dr.__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)&&fH(e,t,r);return dH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionOptions=Dr.TransactionVersion=void 0;var Wr=Os(),VC=hH(Le()),Hw=class t{constructor(e){if(e=Number(e),e<1)throw new VC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Wr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Wr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Dr.TransactionVersion=Hw;var kw=class t{constructor(e){if(e=Number(e),e<0)throw new VC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Wr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Wr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_GUARDED)==Wr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Wr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dr.TransactionOptions=kw});var kC=v((due,HC)=>{"use strict";l();HC.exports=pH;function pH(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";l();var uh=QC;uh.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 ia=new Array(64),jC=new Array(123);for($r=0;$r<64;)jC[ia[$r]=$r<26?$r+65:$r<52?$r+71:$r<62?$r-4:$r-59|43]=$r++;var $r;uh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=ia[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=ia[u|c>>6],s[o++]=ia[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ia[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 GC="invalid encoding";uh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=jC[u])===void 0)throw Error(GC);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(GC);return n-i};uh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var $C=v((yue,WC)=>{"use strict";l();WC.exports=ch;function ch(){this._listeners={}}ch.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};ch.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";l();ex.exports=KC(KC);function KC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(u,c,f){e[0]=u,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],e[0]}function a(u,c){return r[3]=u[c],r[2]=u[c+1],r[1]=u[c+2],r[0]=u[c+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),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,YC),t.writeFloatBE=e.bind(null,JC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}t.readFloatLE=r.bind(null,XC),t.readFloatBE=r.bind(null,ZC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(u,c,f){e[0]=u,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],r[4]=u[c+4],r[5]=u[c+5],r[6]=u[c+6],r[7]=u[c+7],e[0]}function a(u,c){return r[7]=u[c],r[6]=u[c+1],r[5]=u[c+2],r[4]=u[c+3],r[3]=u[c+4],r[2]=u[c+5],r[1]=u[c+6],r[0]=u[c+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(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((c<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((c<<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((c<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,YC,0,4),t.writeDoubleBE=e.bind(null,JC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),f=(c>>31)*2+1,d=c>>>20&2047,g=4294967296*(c&1048575)+u;return d===2047?g?NaN:f*(1/0):d===0?f*5e-324*g:f*Math.pow(2,d-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,XC,0,4),t.readDoubleBE=r.bind(null,ZC,4,0)}(),t}function YC(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 JC(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 XC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function ZC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var rx=v((exports,module)=>{"use strict";l();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 ix=v(nx=>{"use strict";l();var Gw=nx;Gw.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))};Gw.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 ox=v((Iue,sx)=>{"use strict";l();sx.exports=gH;function gH(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 c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var ux=v((Sue,ax)=>{"use strict";l();ax.exports=qt;var Nc=Ni();function qt(t,e){this.lo=t>>>0,this.hi=e>>>0}var Fs=qt.zero=new qt(0,0);Fs.toNumber=function(){return 0};Fs.zzEncode=Fs.zzDecode=function(){return this};Fs.length=function(){return 1};var yH=qt.zeroHash="\0\0\0\0\0\0\0\0";qt.fromNumber=function(e){if(e===0)return Fs;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 qt(n,i)};qt.from=function(e){if(typeof e=="number")return qt.fromNumber(e);if(Nc.isString(e))if(Nc.Long)e=Nc.Long.fromString(e);else return qt.fromNumber(parseInt(e,10));return e.low||e.high?new qt(e.low>>>0,e.high>>>0):Fs};qt.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};qt.prototype.toLong=function(e){return Nc.Long?new Nc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var xi=String.prototype.charCodeAt;qt.fromHash=function(e){return e===yH?Fs:new qt((xi.call(e,0)|xi.call(e,1)<<8|xi.call(e,2)<<16|xi.call(e,3)<<24)>>>0,(xi.call(e,4)|xi.call(e,5)<<8|xi.call(e,6)<<16|xi.call(e,7)<<24)>>>0)};qt.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)};qt.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};qt.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};qt.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 Ni=v(jw=>{"use strict";l();var be=jw;be.asPromise=kC();be.base64=zC();be.EventEmitter=$C();be.float=tx();be.inquire=rx();be.utf8=ix();be.pool=ox();be.LongBits=ux();be.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);be.global=be.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||jw;be.emptyArray=Object.freeze?Object.freeze([]):[];be.emptyObject=Object.freeze?Object.freeze({}):{};be.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};be.isString=function(e){return typeof e=="string"||e instanceof String};be.isObject=function(e){return e&&typeof e=="object"};be.isset=be.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};be.Buffer=function(){try{var t=be.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();be._Buffer_from=null;be._Buffer_allocUnsafe=null;be.newBuffer=function(e){return typeof e=="number"?be.Buffer?be._Buffer_allocUnsafe(e):new be.Array(e):be.Buffer?be._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};be.Array=typeof Uint8Array<"u"?Uint8Array:Array;be.Long=be.global.dcodeIO&&be.global.dcodeIO.Long||be.global.Long||be.inquire("long");be.key2Re=/^true|false|0|1$/;be.key32Re=/^-?(?:0|[1-9][0-9]*)$/;be.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;be.longToHash=function(e){return e?be.LongBits.from(e).toHash():be.LongBits.zeroHash};be.longFromHash=function(e,r){var n=be.LongBits.fromHash(e);return be.Long?be.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function cx(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]}};be.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";l();px.exports=Ue;var Pr=Ni(),Qw,lh=Pr.LongBits,fx=Pr.base64,dx=Pr.utf8;function Oc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Ww(){}function mH(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ue(){this.len=0,this.head=new Oc(Ww,0,0),this.tail=this.head,this.states=null}var hx=function(){return Pr.Buffer?function(){return(Ue.create=function(){return new Qw})()}:function(){return new Ue}};Ue.create=hx();Ue.alloc=function(e){return new Pr.Array(e)};Pr.Array!==Array&&(Ue.alloc=Pr.pool(Ue.alloc,Pr.Array.prototype.subarray));Ue.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Oc(e,r,n),this.len+=r,this};function $w(t,e,r){e[r]=t&255}function wH(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Kw(t,e){this.len=t,this.next=void 0,this.val=e}Kw.prototype=Object.create(Oc.prototype);Kw.prototype.fn=wH;Ue.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Kw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ue.prototype.int32=function(e){return e<0?this._push(Yw,10,lh.fromNumber(e)):this.uint32(e)};Ue.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Yw(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}Ue.prototype.uint64=function(e){var r=lh.from(e);return this._push(Yw,r.length(),r)};Ue.prototype.int64=Ue.prototype.uint64;Ue.prototype.sint64=function(e){var r=lh.from(e).zzEncode();return this._push(Yw,r.length(),r)};Ue.prototype.bool=function(e){return this._push($w,1,e?1:0)};function zw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ue.prototype.fixed32=function(e){return this._push(zw,4,e>>>0)};Ue.prototype.sfixed32=Ue.prototype.fixed32;Ue.prototype.fixed64=function(e){var r=lh.from(e);return this._push(zw,4,r.lo)._push(zw,4,r.hi)};Ue.prototype.sfixed64=Ue.prototype.fixed64;Ue.prototype.float=function(e){return this._push(Pr.float.writeFloatLE,4,e)};Ue.prototype.double=function(e){return this._push(Pr.float.writeDoubleLE,8,e)};var EH=Pr.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($w,1,0);if(Pr.isString(e)){var n=Ue.alloc(r=fx.length(e));fx.decode(e,n,0),e=n}return this.uint32(r)._push(EH,r,e)};Ue.prototype.string=function(e){var r=dx.length(e);return r?this.uint32(r)._push(dx.write,r,e):this._push($w,1,0)};Ue.prototype.fork=function(){return this.states=new mH(this),this.head=this.tail=new Oc(Ww,0,0),this.len=0,this};Ue.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 Oc(Ww,0,0),this.len=0),this};Ue.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};Ue.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};Ue._configure=function(t){Qw=t,Ue.create=hx(),Qw._configure()}});var mx=v((Due,yx)=>{"use strict";l();yx.exports=En;var gx=Jw();(En.prototype=Object.create(gx.prototype)).constructor=En;var Oi=Ni();function En(){gx.call(this)}En._configure=function(){En.alloc=Oi._Buffer_allocUnsafe,En.writeBytesBuffer=Oi.Buffer&&Oi.Buffer.prototype instanceof Uint8Array&&Oi.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(En.writeBytesBuffer,r,e),this};function vH(t,e,r){t.length<40?Oi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}En.prototype.string=function(e){var r=Oi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(vH,r,e),this};En._configure()});var eE=v((Rue,bx)=>{"use strict";l();bx.exports=bt;var vn=Ni(),Zw,vx=vn.LongBits,AH=vn.utf8;function Kr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function bt(t){this.buf=t,this.pos=0,this.len=t.length}var wx=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new bt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new bt(e);throw Error("illegal buffer")},Ax=function(){return vn.Buffer?function(r){return(bt.create=function(i){return vn.Buffer.isBuffer(i)?new Zw(i):wx(i)})(r)}:wx};bt.create=Ax();bt.prototype._slice=vn.Array.prototype.subarray||vn.Array.prototype.slice;bt.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,Kr(this,10);return e}}();bt.prototype.int32=function(){return this.uint32()|0};bt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Xw(){var t=new vx(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 Kr(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 Kr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}bt.prototype.bool=function(){return this.uint32()!==0};function fh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}bt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)};bt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)|0};function Ex(){if(this.pos+8>this.len)throw Kr(this,8);return new vx(fh(this.buf,this.pos+=4),fh(this.buf,this.pos+=4))}bt.prototype.float=function(){if(this.pos+4>this.len)throw Kr(this,4);var e=vn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};bt.prototype.double=function(){if(this.pos+8>this.len)throw Kr(this,4);var e=vn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};bt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Kr(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)};bt.prototype.string=function(){var e=this.bytes();return AH.read(e,0,e.length)};bt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Kr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Kr(this);while(this.buf[this.pos++]&128);return this};bt.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};bt._configure=function(t){Zw=t,bt.create=Ax(),Zw._configure();var e=vn.Long?"toLong":"toNumber";vn.merge(bt.prototype,{int64:function(){return Xw.call(this)[e](!1)},uint64:function(){return Xw.call(this)[e](!0)},sint64:function(){return Xw.call(this).zzDecode()[e](!1)},fixed64:function(){return Ex.call(this)[e](!0)},sfixed64:function(){return Ex.call(this)[e](!1)}})}});var Tx=v((Lue,Sx)=>{"use strict";l();Sx.exports=Ms;var _x=eE();(Ms.prototype=Object.create(_x.prototype)).constructor=Ms;var Ix=Ni();function Ms(t){_x.call(this,t)}Ms._configure=function(){Ix.Buffer&&(Ms.prototype._slice=Ix.Buffer.prototype.slice)};Ms.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))};Ms._configure()});var xx=v((Mue,Cx)=>{"use strict";l();Cx.exports=Dc;var tE=Ni();(Dc.prototype=Object.create(tE.EventEmitter.prototype)).constructor=Dc;function Dc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");tE.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Dc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return tE.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,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Dc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Ox=v(Nx=>{"use strict";l();var bH=Nx;bH.Service=xx()});var Px=v((Hue,Dx)=>{"use strict";l();Dx.exports={}});var Lx=v(Bx=>{"use strict";l();var pr=Bx;pr.build="minimal";pr.Writer=Jw();pr.BufferWriter=mx();pr.Reader=eE();pr.BufferReader=Tx();pr.util=Ni();pr.rpc=Ox();pr.roots=Px();pr.configure=Rx;function Rx(){pr.util._configure(),pr.Writer._configure(pr.BufferWriter),pr.Reader._configure(pr.BufferReader)}Rx()});var Mx=v((Que,Fx)=>{"use strict";l();Fx.exports=Lx()});var qx=v((Wue,Ux)=>{"use strict";l();var sa=Mx(),dh=sa.Reader,IH=sa.Writer,Z=sa.util,Pc=sa.roots.default||(sa.roots.default={});Pc.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 dh||(n=new dh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!Z.isInteger(n.Nonce)&&!(n.Nonce&&Z.isInteger(n.Nonce.low)&&Z.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||Z.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||Z.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||Z.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||Z.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||Z.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!Z.isInteger(n.GasPrice)&&!(n.GasPrice&&Z.isInteger(n.GasPrice.low)&&Z.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!Z.isInteger(n.GasLimit)&&!(n.GasLimit&&Z.isInteger(n.GasLimit.low)&&Z.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||Z.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||Z.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!Z.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||Z.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!Z.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||Z.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||Z.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Pc.proto.Transaction)return n;var i=new Pc.proto.Transaction;return n.Nonce!=null&&(Z.Long?(i.Nonce=Z.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 Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?Z.base64.decode(n.Value,i.Value=Z.newBuffer(Z.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?Z.base64.decode(n.RcvAddr,i.RcvAddr=Z.newBuffer(Z.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?Z.base64.decode(n.RcvUserName,i.RcvUserName=Z.newBuffer(Z.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?Z.base64.decode(n.SndAddr,i.SndAddr=Z.newBuffer(Z.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?Z.base64.decode(n.SndUserName,i.SndUserName=Z.newBuffer(Z.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(Z.Long?(i.GasPrice=Z.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 Z.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(Z.Long?(i.GasLimit=Z.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 Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?Z.base64.decode(n.Data,i.Data=Z.newBuffer(Z.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?Z.base64.decode(n.ChainID,i.ChainID=Z.newBuffer(Z.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"?Z.base64.decode(n.Signature,i.Signature=Z.newBuffer(Z.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"?Z.base64.decode(n.GuardAddr,i.GuardAddr=Z.newBuffer(Z.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?Z.base64.decode(n.GuardSignature,i.GuardSignature=Z.newBuffer(Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=Z.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=Z.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=Z.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=Z.newBuffer(s.SndUserName))),Z.Long){var o=new Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=Z.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=Z.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=Z.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=Z.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?Z.Long.prototype.toString.call(n.Nonce):i.longs===Number?new Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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?Z.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new Z.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?Z.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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,sa.util.toJSONOptions)},e}(),t}();Ux.exports=Pc});var Vx=v(Rr=>{"use strict";l();var _H=Rr&&Rr.__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]}),SH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TH=Rr&&Rr.__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)&&_H(e,t,r);return SH(e,t),e},CH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var xH=CH(Yt()),rE=pt(),NH=Os(),OH=TH(Le()),DH=Tc(),nE=class{serializeTransaction(e){let r=qx().proto,n=new rE.Address(e.getReceiver().bech32()).pubkey(),i=new rE.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:e.getReceiverUsername()?h.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?h.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,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()!==NH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new rE.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 xH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=DH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new OH.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=nE});var Hx=v(Us=>{"use strict";l();var PH=Us&&Us.__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]}),RH=Us&&Us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&PH(e,t,r)};Object.defineProperty(Us,"__esModule",{value:!0});RH(Vx(),Us)});var Rc=v(Br=>{"use strict";l();var BH=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]}),LH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FH=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)&&BH(e,t,r);return LH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.interpretSignatureAsBuffer=Br.Signature=void 0;var kx=FH(Le()),Gx=64,iE=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof h.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new kx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Gx}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Gx)throw new kx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Br.Signature=iE;function MH(t){if(ArrayBuffer.isView(t))return h.Buffer.from(t);if(t.hex!=null)return h.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Br.interpretSignatureAsBuffer=MH});var Yn=v(hh=>{"use strict";l();Object.defineProperty(hh,"__esModule",{value:!0});hh.TransactionPayload=void 0;var sE=class t{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=h.Buffer.from(e,"base64").toString();return new t(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}};hh.TransactionPayload=sE});var oE=v((nce,jx)=>{l();Jn.notEqual=qH;Jn.notOk=VH;Jn.equal=UH;Jn.ok=Jn;jx.exports=Jn;function UH(t,e,r){Jn(t==e,r)}function qH(t,e,r){Jn(t!=e,r)}function VH(t,e){Jn(!t,e)}function Jn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Vs=v(ca=>{"use strict";l();var aE=K0(),aa=J0(),Qx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ca.Buffer=W;ca.SlowBuffer=zH;ca.INSPECT_MAX_BYTES=50;var ph=2147483647;ca.kMaxLength=ph;W.TYPED_ARRAY_SUPPORT=HH();!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 HH(){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(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 Xn(t){if(t>ph)throw new RangeError('The value "'+t+'" is invalid for option "size"');let 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 fE(t)}return Kx(t,e,r)}W.poolSize=8192;function Kx(t,e,r){if(typeof t=="string")return GH(t,e);if(ArrayBuffer.isView(t))return jH(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(An(t,ArrayBuffer)||t&&An(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(An(t,SharedArrayBuffer)||t&&An(t.buffer,SharedArrayBuffer)))return cE(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 W.from(n,e,r);let i=QH(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 Kx(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function Yx(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 kH(t,e,r){return Yx(t),t<=0?Xn(t):e!==void 0?typeof r=="string"?Xn(t).fill(e,r):Xn(t).fill(e):Xn(t)}W.alloc=function(t,e,r){return kH(t,e,r)};function fE(t){return Yx(t),Xn(t<0?0:dE(t)|0)}W.allocUnsafe=function(t){return fE(t)};W.allocUnsafeSlow=function(t){return fE(t)};function GH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Jx(t,e)|0,n=Xn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function uE(t){let e=t.length<0?0:dE(t.length)|0,r=Xn(e);for(let n=0;n=ph)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ph.toString(16)+" bytes");return t|0}function zH(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(An(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),An(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;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(W.isBuffer(o)||(o=W.from(o)),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 Jx(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||An(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 lE(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oN(t).length;default:if(i)return n?-1:lE(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=Jx;function WH(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 nk(this,e,r);case"utf8":case"utf-8":return Zx(this,e,r);case"ascii":return tk(this,e,r);case"latin1":case"binary":return rk(this,e,r);case"base64":return ZH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ik(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function qs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}W.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+=" ... "),""};Qx&&(W.prototype[Qx]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(An(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;let o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,pE(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:zx(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):zx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function zx(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 c;if(i){let f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){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 $H(this,e,r,n);case"utf8":case"utf-8":return KH(this,e,r,n);case"ascii":case"latin1":case"binary":return YH(this,e,r,n);case"base64":return JH(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XH(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 ZH(t,e,r){return e===0&&r===t.length?aE.fromByteArray(t):aE.fromByteArray(t.slice(e,r))}function Zx(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 ek(n)}var Wx=4096;function ek(t){let e=t.length;if(e<=Wx)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")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e+--r],s=1;for(;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||Vt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readBigUInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(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};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Vt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readBigInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Vt(e,4,this.length),aa.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),aa.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!1,52,8)};function gr(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){let a=Math.pow(2,8*n)-1;gr(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;gr(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};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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 eN(t,e,r,n,i){sN(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 tN(t,e,r,n,i){sN(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}W.prototype.writeBigUInt64LE=Di(function(e,r=0){return eN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeBigUInt64BE=Di(function(e,r=0){return tN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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};W.prototype.writeBigInt64LE=Di(function(e,r=0){return eN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W.prototype.writeBigInt64BE=Di(function(e,r=0){return tN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rN(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 nN(t,e,r,n,i){return e=+e,r=r>>>0,i||rN(t,e,r,4,34028234663852886e22,-34028234663852886e22),aa.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return nN(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return nN(this,e,r,!1,n)};function iN(t,e,r,n,i){return e=+e,r=r>>>0,i||rN(t,e,r,8,17976931348623157e292,-17976931348623157e292),aa.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return iN(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return iN(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);let s;if(typeof e=="number")for(s=r;s2**32?i=$x(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=$x(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function $x(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 sk(t,e,r){ua(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Bc(e,t.length-(r+1))}function sN(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 oa.ERR_OUT_OF_RANGE("value",a,t)}sk(n,i,s)}function ua(t,e){if(typeof t!="number")throw new oa.ERR_INVALID_ARG_TYPE(e,"number",t)}function Bc(t,e,r){throw Math.floor(t)!==t?(ua(t,r),new oa.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new oa.ERR_BUFFER_OUT_OF_BOUNDS:new oa.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ok=/[^+/0-9A-Za-z-_]/g;function ak(t){if(t=t.split("=")[0],t=t.trim().replace(ok,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function lE(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 uk(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function oN(t){return aE.toByteArray(ak(t))}function gh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function An(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function pE(t){return t!==t}var lk=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 Di(t){return typeof BigInt>"u"?fk:t}function fk(){throw new Error("BigInt not supported")}});var uN=v((uce,aN)=>{l();aN.exports=gE;gE.supported=typeof WebAssembly<"u";function gE(t){if(!gE.supported)return null;var e=t&&t.imports,r=dk("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 dk(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(hk)):new(Vs()).Buffer(t,"base64")}function hk(t){return t.charCodeAt(0)}});var gN=v((dce,In)=>{l();var bn=oE(),Ze=uN()(),Zn=64,yh=[];In.exports=Lr;var cN=In.exports.BYTES_MIN=16,lN=In.exports.BYTES_MAX=64,lce=In.exports.BYTES=32,fN=In.exports.KEYBYTES_MIN=16,dN=In.exports.KEYBYTES_MAX=64,fce=In.exports.KEYBYTES=32,hN=In.exports.SALTBYTES=16,pN=In.exports.PERSONALBYTES=16;function Lr(t,e,r,n,i){if(!(this instanceof Lr))return new Lr(t,e,r,n,i);if(!(Ze&&Ze.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(bn(t>=cN,"digestLength must be at least "+cN+", was given "+t),bn(t<=lN,"digestLength must be at most "+lN+", was given "+t),e!=null&&bn(e.length>=fN,"key must be at least "+fN+", was given "+e.length),e!=null&&bn(e.length<=dN,"key must be at least "+dN+", was given "+e.length),r!=null&&bn(r.length===hN,"salt must be exactly "+hN+", was given "+r.length),n!=null&&bn(n.length===pN,"personal must be exactly "+pN+", was given "+n.length)),yh.length||(yh.push(Zn),Zn+=216),this.digestLength=t,this.finalized=!1,this.pointer=yh.pop(),Ze.memory.fill(0,0,64),Ze.memory[0]=this.digestLength,Ze.memory[1]=e?e.length:0,Ze.memory[2]=1,Ze.memory[3]=1,r&&Ze.memory.set(r,32),n&&Ze.memory.set(n,48),this.pointer+216>Ze.memory.length&&Ze.realloc(this.pointer+216),Ze.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ze.memory.fill(0,Zn,Zn+e.length),Ze.memory[this.pointer+200]=128)}Lr.prototype.update=function(t){return bn(this.finalized===!1,"Hash instance finalized"),bn(t,"input must be TypedArray or Buffer"),Zn+t.length>Ze.memory.length&&Ze.realloc(Zn+t.length),Ze.memory.set(t,Zn),Ze.exports.blake2b_update(this.pointer,Zn,Zn+t.length),this};Lr.prototype.digest=function(t){if(bn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,yh.push(this.pointer),Ze.exports.blake2b_final(this.pointer),!t||t==="binary")return Ze.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return gk(Ze.memory,this.pointer+128,this.digestLength);bn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Bi=oE(),Fc=gN();function mh(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 yN(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 IN(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Pi(t,e,r,n,i,s){var o=Lc[i],a=Lc[i+1],u=Lc[s],c=Lc[s+1];mh(xe,t,e),yN(xe,t,o,a);var f=xe[n]^xe[t],d=xe[n+1]^xe[t+1];xe[n]=d,xe[n+1]=f,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=f>>>24^d<<8,xe[e+1]=d>>>24^f<<8,mh(xe,t,e),yN(xe,t,u,c),f=xe[n]^xe[t],d=xe[n+1]^xe[t+1],xe[n]=f>>>16^d<<16,xe[n+1]=d>>>16^f<<16,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=d>>>31^f<<1,xe[e+1]=f>>>31^d<<1}var _N=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),mk=[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],Xt=new Uint8Array(mk.map(function(t){return t*2})),xe=new Uint32Array(32),Lc=new Uint32Array(32);function SN(t,e){var r=0;for(r=0;r<16;r++)xe[r]=t.h[r],xe[r+16]=_N[r];for(xe[24]=xe[24]^t.t,xe[25]=xe[25]^t.t/4294967296,e&&(xe[28]=~xe[28],xe[29]=~xe[29]),r=0;r<32;r++)Lc[r]=IN(t.b,4*r);for(r=0;r<12;r++)Pi(0,8,16,24,Xt[r*16+0],Xt[r*16+1]),Pi(2,10,18,26,Xt[r*16+2],Xt[r*16+3]),Pi(4,12,20,28,Xt[r*16+4],Xt[r*16+5]),Pi(6,14,22,30,Xt[r*16+6],Xt[r*16+7]),Pi(0,10,20,30,Xt[r*16+8],Xt[r*16+9]),Pi(2,12,22,24,Xt[r*16+10],Xt[r*16+11]),Pi(4,14,16,26,Xt[r*16+12],Xt[r*16+13]),Pi(6,8,18,28,Xt[r*16+14],Xt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^xe[r]^xe[r+16]}var Ri=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 la(t,e,r,n){Ri.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ri[0]=t,e&&(Ri[1]=e.length),Ri[2]=1,Ri[3]=1,r&&Ri.set(r,32),n&&Ri.set(n,48);for(var i=0;i<16;i++)this.h[i]=_N[i]^IN(Ri,i*4);e&&(TN(this,e),this.c=128)}la.prototype.update=function(t){return Bi(t!=null,"input must be Uint8Array or Buffer"),TN(this,t),this};la.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Bi(e.length>=this.outlen,"out must have at least outlen bytes of space"),wk(this,e),t==="hex"?Ek(e):e};la.prototype.final=la.prototype.digest;la.ready=function(t){Fc.ready(function(){t()})};function TN(t,e){for(var r=0;r>2]>>8*(r&3);return e}function Ek(t){for(var e="",r=0;r=mN,"outlen must be at least "+mN+", was given "+e),Bi(e<=wN,"outlen must be at most "+wN+", was given "+e),r!=null&&Bi(r.length>=EN,"key must be at least "+EN+", was given "+r.length),r!=null&&Bi(r.length<=vN,"key must be at most "+vN+", was given "+r.length),n!=null&&Bi(n.length===AN,"salt must be exactly "+AN+", was given "+n.length),i!=null&&Bi(i.length===bN,"personal must be exactly "+bN+", was given "+i.length)),new CN(e,r,n,i)};yr.exports.ready=function(t){Fc.ready(function(){t()})};yr.exports.WASM_SUPPORTED=Fc.SUPPORTED;yr.exports.WASM_LOADED=!1;var mN=yr.exports.BYTES_MIN=16,wN=yr.exports.BYTES_MAX=64,pce=yr.exports.BYTES=32,EN=yr.exports.KEYBYTES_MIN=16,vN=yr.exports.KEYBYTES_MAX=64,gce=yr.exports.KEYBYTES=32,AN=yr.exports.SALTBYTES=16,bN=yr.exports.PERSONALBYTES=16;Fc.ready(function(t){t||(yr.exports.WASM_LOADED=!0,CN=Fc)})});var Yr=v(Fr=>{"use strict";l();var Ak=Fr&&Fr.__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]}),bk=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ik=Fr&&Fr.__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)&&Ak(e,t,r);return bk(e,t),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var fa=Yt(),Mc=pt(),_k=ah(),Sk=Os(),Tk=Ik(Le()),Ck=qC(),ei=xc(),xk=Hx(),wh=Rc(),xN=Yn(),Nk=br(),Ok=yE(),Dk=32,mE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:c,chainID:f,version:d,options:g,guardian:m}){this.nonce=e||0,this.value=r?new fa.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||Sk.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=c||new xN.TransactionPayload,this.chainID=f,this.version=d?new ei.TransactionVersion(d.valueOf()):ei.TransactionVersion.withDefaultVersion(),this.options=g?new ei.TransactionOptions(g.valueOf()):ei.TransactionOptions.withDefaultOptions(),this.guardian=m||Mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=da.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}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}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 ei.TransactionVersion(e.valueOf())}getOptions(){return new ei.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new ei.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return Nk.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(),senderUsername:this.senderUsername?h.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?h.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().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 _k.Compatibility.guardAddressIsSetAndNonZero(new Mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new fa.BigNumber(e.value).toFixed(0),receiver:Mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:Mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?Mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new xN.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new ei.TransactionVersion(e.version),options:e.options!=null?new ei.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new wh.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new wh.Signature(e.guardianSignature)),r}applySignature(e){this.signature=wh.interpretSignatureAsBuffer(e),this.hash=da.compute(this)}applyGuardianSignature(e){this.guardianSignature=wh.interpretSignatureAsBuffer(e),this.hash=da.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 Tk.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new fa.BigNumber(this.gasPrice.valueOf()),i=new fa.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new fa.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new fa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Fr.Transaction=mE;var da=class t extends Ck.Hash{constructor(e){super(e)}static compute(e){let n=new xk.ProtoSerializer().serializeTransaction(e),i=Ok(Dk).update(n).digest("hex");return new t(i)}};Fr.TransactionHash=da});var AE=v(vh=>{"use strict";l();Object.defineProperty(vh,"__esModule",{value:!0});vh.TransferTransactionsFactory=void 0;var wE=na(),Jr=xt(),Eh=Yr(),EE=Yn(),vE=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 Eh.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 wE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new EE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Eh.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 wE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.U64Value(e.tokenTransfer.nonce),new Jr.BigUIntValue(e.tokenTransfer.valueOf()),new Jr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new EE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Eh.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 Jr.AddressValue(e.destination),new Jr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Jr.BytesValue.fromUTF8(u.tokenIdentifier),new Jr.U64Value(u.nonce),new Jr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new wE.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new EE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Eh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};vh.TransferTransactionsFactory=vE});var IE=v(Hs=>{"use strict";l();Object.defineProperty(Hs,"__esModule",{value:!0});Hs.GasEstimator=Hs.DefaultGasConfiguration=void 0;Hs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Pk=1e5,NN=8e5,bE=class{constructor(e){this.gasConfiguration=e||Hs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Pk}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+NN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+NN)*r+this.gasConfiguration.gasPerDataByte*e}};Hs.GasEstimator=bE});var ha=v(Ah=>{"use strict";l();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.Account=void 0;var Rk=pt(),_E=class{constructor(e){this.address=new Rk.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()}}};Ah.Account=_E});var pa=v(Gs=>{"use strict";l();Object.defineProperty(Gs,"__esModule",{value:!0});Gs.Logger=Gs.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=Gs.LogLevel||(Gs.LogLevel={}));var bh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=ks.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=ks.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=ks.Error||console.error(e,r)}};Gs.Logger=bh;bh.logLevel=ks.Debug});var CE=v(_n=>{"use strict";l();var Bk=_n&&_n.__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]}),Lk=_n&&_n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fk=_n&&_n.__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)&&Bk(e,t,r);return Lk(e,t),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.AsyncTimer=void 0;var Mk=Fk(Le()),Uk=Le(),SE=pa(),TE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new Mk.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,SE.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(){SE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new Uk.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(SE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_n.AsyncTimer=TE});var Ih=v(ga=>{"use strict";l();var Mr=ga&&ga.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(ga,"__esModule",{value:!0});ga.TransactionWatcher=void 0;var xE=CE(),Li=Le(),ON=pa(),Fi=class t{constructor(e,r={}){this.fetcher=new NE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Mr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Mr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new Li.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>a.includes(c))},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>a.includes(c))!=null},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Mr(this,void 0,void 0,function*(){let n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Mr(this,void 0,void 0,function*(){let i=new xE.AsyncTimer("watcher:periodic"),s=new xE.AsyncTimer("watcher:patience"),o=new xE.AsyncTimer("watcher:timeout"),a=!1,u,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),c=e(u),c||a)break}catch(f){if(ON.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Li.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Li.Err))throw f}}if(c&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!c)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}};ga.TransactionWatcher=Fi;Fi.DefaultPollingInterval=6e3;Fi.DefaultTimeout=Fi.DefaultPollingInterval*15;Fi.DefaultPatience=0;Fi.NoopOnStatusReceived=t=>{};var NE=class{constructor(e){this.fetcher=e}getTransaction(e){return Mr(this,void 0,void 0,function*(){return ON.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var OE=v(_h=>{"use strict";l();Object.defineProperty(_h,"__esModule",{value:!0});_h.CodeMetadata=void 0;var Uc=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBuffer(e){if(e.length<2)throw new Error("Buffer is too short.");let r=e[0],n=e[1],i=(r&t.ByteZero.Upgradeable)!==0,s=(r&t.ByteZero.Readable)!==0,o=(n&t.ByteOne.Payable)!==0,a=(n&t.ByteOne.PayableBySc)!==0;return new t(i,s,o,a)}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|=t.ByteZero.Upgradeable),this.readable&&(e|=t.ByteZero.Readable),this.payable&&(r|=t.ByteOne.Payable),this.payableBySc&&(r|=t.ByteOne.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}};_h.CodeMetadata=Uc;Uc.ByteZero={Upgradeable:1,Reserved2:2,Readable:4};Uc.ByteOne={Reserved1:1,Payable:2,PayableBySc:4}});var qc=v(Sn=>{"use strict";l();var qk=Sn&&Sn.__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]}),Vk=Sn&&Sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hk=Sn&&Sn.__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)&&qk(e,t,r);return Vk(e,t),e};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ContractFunction=void 0;var kk=Hk(Le()),DE=class t{constructor(e){if(this.name=e,e==null)throw new kk.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Sn.ContractFunction=DE});var BE=v(Ur=>{"use strict";l();var Gk=Ur&&Ur.__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]}),jk=Ur&&Ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qk=Ur&&Ur.__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)&&Gk(e,t,r);return jk(e,t),e},zk=Ur&&Ur.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.InteractionChecker=void 0;var PE=Qk(Le()),Wk=zk(Yt()),RE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new Wk.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new PE.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 PE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";l();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Query=void 0;var $k=pt(),Kk=na(),LE=class{constructor(e){this.caller=e.caller||new $k.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new Kk.ArgSerializer().valuesToStrings(this.args)}};Sh.Query=LE});var qE=v(Th=>{"use strict";l();Object.defineProperty(Th,"__esModule",{value:!0});Th.Interaction=void 0;var DN=pt(),Yk=ah(),FE=Os(),ME=qc(),Jk=BE(),Xk=Vc(),ya=xt(),UE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new DN.Address,this.sender=new DN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ma([],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(){Yk.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 ME.ContractFunction(FE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new ME.ContractFunction(FE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new ME.ContractFunction(FE.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 Xk.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 ma([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ma([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ma(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 Jk.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Th.Interaction=UE;var ma=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 ya.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ya.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ya.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ya.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ya.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ya.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var PN=v(Ch=>{"use strict";l();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArgumentErrorContext=void 0;var Zk=Le(),VE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new Zk.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)})`)}};Ch.ArgumentErrorContext=VE});var kE=v(js=>{"use strict";l();var eG=js&&js.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(js,"__esModule",{value:!0});js.NativeSerializer=void 0;var tG=eG(Yt()),rG=pt(),HE=Le(),nG=Md(),iG=PN(),Ie=xt(),sG;(function(t){function e(b,S){b=b||[],r(b,S),n(S)&&(b=i(b,S));let N=S.input,_=[];for(let T=0;T0&&S[0].type.getCardinality().isComposite()&&(_=1/0,T=!0);for(let B of S){if(B.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:T}}function o(b,S,N){if(b&&b.belongsToTypesystem)return b;if(S instanceof Ie.OptionType)return a(b,S,N);if(S instanceof Ie.OptionalType)return u(b,S,N);if(S instanceof Ie.VariadicType)return c(b,S,N);if(S instanceof Ie.CompositeType)return d(b,S,N);if(S instanceof Ie.TupleType)return g(b,S,N);if(S instanceof Ie.StructType)return m(b,S,N);if(S instanceof Ie.ListType)return f(b,S,N);if(S instanceof Ie.PrimitiveType)return y(b,S,N);if(S instanceof Ie.EnumType)return A(b,S,N);N.throwError(`convertToTypedValue: unhandled type ${S}`)}function a(b,S,N){if(b==null)return Ie.OptionValue.newMissing();let _=o(b,S.getFirstTypeParameter(),N);return Ie.OptionValue.newProvided(_)}function u(b,S,N){if(b==null)return new Ie.OptionalValue(S);let _=o(b,S.getFirstTypeParameter(),N);return new Ie.OptionalValue(S,_)}function c(b,S,N){if(S.isCounted)throw new HE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');b==null&&(b=[]),b.map===void 0&&N.convertError(b,"Variadic");let _=b.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new Ie.VariadicValue(S,_)}function f(b,S,N){b.map===void 0&&N.convertError(b,"List");let _=b.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new Ie.List(S,_)}function d(b,S,N){let _=[],T=S.getTypeParameters();N.guardSameLength(b,T);for(let B=0;B{"use strict";l();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.ContractCallPayloadBuilder=Xr.ContractUpgradePayloadBuilder=Xr.ContractDeployPayloadBuilder=Xr.ArwenVirtualMachine=void 0;var zE=Yn(),WE=br(),oG=na();Xr.ArwenVirtualMachine="0500";var GE=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(){WE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Xr.ArwenVirtualMachine}@${r}`;return n=$E(n,this.arguments),new zE.TransactionPayload(n)}};Xr.ContractDeployPayloadBuilder=GE;var jE=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(){WE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=$E(n,this.arguments),new zE.TransactionPayload(n)}};Xr.ContractUpgradePayloadBuilder=jE;var QE=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(){WE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=$E(e,this.arguments),new zE.TransactionPayload(e)}};Xr.ContractCallPayloadBuilder=QE;function $E(t,e){let{argumentsString:r,count:n}=new oG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var ti=v(($ce,YE)=>{"use strict";l();var wa=typeof Reflect=="object"?Reflect:null,RN=wa&&typeof wa.apply=="function"?wa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},xh;wa&&typeof wa.ownKeys=="function"?xh=wa.ownKeys:Object.getOwnPropertySymbols?xh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xh=function(e){return Object.getOwnPropertyNames(e)};function aG(t){console&&console.warn&&console.warn(t)}var LN=Number.isNaN||function(e){return e!==e};function We(){We.init.call(this)}YE.exports=We;YE.exports.once=fG;We.EventEmitter=We;We.prototype._events=void 0;We.prototype._eventsCount=0;We.prototype._maxListeners=void 0;var BN=10;function Nh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(We,"defaultMaxListeners",{enumerable:!0,get:function(){return BN},set:function(t){if(typeof t!="number"||t<0||LN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");BN=t}});We.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};We.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||LN(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 FN(t){return t._maxListeners===void 0?We.defaultMaxListeners:t._maxListeners}We.prototype.getMaxListeners=function(){return FN(this)};We.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")RN(u,this,r);else for(var c=u.length,f=HN(u,c),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,aG(a)}return t}We.prototype.addListener=function(e,r){return MN(this,e,r,!1)};We.prototype.on=We.prototype.addListener;We.prototype.prependListener=function(e,r){return MN(this,e,r,!0)};function uG(){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 UN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=uG.bind(n);return i.listener=r,n.wrapFn=i,i}We.prototype.once=function(e,r){return Nh(r),this.on(e,UN(this,e,r)),this};We.prototype.prependOnceListener=function(e,r){return Nh(r),this.prependListener(e,UN(this,e,r)),this};We.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Nh(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():cG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};We.prototype.off=We.prototype.removeListener;We.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 qN(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?lG(i):HN(i,i.length)}We.prototype.listeners=function(e){return qN(this,e,!0)};We.prototype.rawListeners=function(e){return qN(this,e,!1)};We.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):VN.call(t,e)};We.prototype.listenerCount=VN;function VN(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}We.prototype.eventNames=function(){return this._eventsCount>0?xh(this._events):[]};function HN(t,e){for(var r=new Array(e),n=0;n{l();GN.exports=ti().EventEmitter});var XE=v(()=>{l()});var KN=v((tle,$N)=>{"use strict";l();function jN(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 QN(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 Oh.alloc(0);for(var n=Oh.allocUnsafe(r>>>0),i=this.head,s=0;i;)vG(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=Oh.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:EG,value:function(r,n){return ZE(this,QN(QN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var tv=v((nle,JN)=>{"use strict";l();function AG(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(ev,this,t)):p.default.nextTick(ev,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(Dh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(YN,r,s)):p.default.nextTick(YN,r,s):e?(p.default.nextTick(Dh,r),e(s)):p.default.nextTick(Dh,r)}),this)}function YN(t,e){ev(t,e),Dh(t)}function Dh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function bG(){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 ev(t,e){t.emit("error",e)}function IG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}JN.exports={destroy:AG,undestroy:bG,errorOrDestroy:IG}});var Qs=v((sle,eO)=>{"use strict";l();function _G(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var ZN={};function qr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){_G(o,s);function o(a,u,c){return s.call(this,n(a,u,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,ZN[t]=i}function XN(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 SG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function TG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function CG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}qr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);qr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&SG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(TG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(XN(e,"type"));else{var s=CG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(XN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);qr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");qr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});qr("ERR_STREAM_PREMATURE_CLOSE","Premature close");qr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});qr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");qr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");qr("ERR_STREAM_WRITE_AFTER_END","write after end");qr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);qr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");eO.exports.codes=ZN});var rv=v((ale,tO)=>{"use strict";l();var xG=Qs().codes.ERR_INVALID_OPT_VALUE;function NG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function OG(t,e,r,n){var i=NG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new xG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}tO.exports={getHighWaterMark:OG}});var Ea=v((cle,nv)=>{l();typeof Object.create=="function"?nv.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:nv.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 nO=v((fle,rO)=>{l();rO.exports=DG;function DG(t,e){if(iv("noDeprecation"))return t;var r=!1;function n(){if(!r){if(iv("throwDeprecation"))throw new Error(e);iv("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function iv(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var av=v((hle,cO)=>{"use strict";l();cO.exports=gt;function sO(t){var e=this;this.next=null,this.entry=null,this.finish=function(){ij(e,t)}}var va;gt.WritableState=kc;var PG={deprecate:nO()},oO=JE(),Rh=Vs().Buffer,RG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function BG(t){return Rh.from(t)}function LG(t){return Rh.isBuffer(t)||t instanceof RG}var ov=tv(),FG=rv(),MG=FG.getHighWaterMark,Mi=Qs().codes,UG=Mi.ERR_INVALID_ARG_TYPE,qG=Mi.ERR_METHOD_NOT_IMPLEMENTED,VG=Mi.ERR_MULTIPLE_CALLBACK,HG=Mi.ERR_STREAM_CANNOT_PIPE,kG=Mi.ERR_STREAM_DESTROYED,GG=Mi.ERR_STREAM_NULL_VALUES,jG=Mi.ERR_STREAM_WRITE_AFTER_END,QG=Mi.ERR_UNKNOWN_ENCODING,Aa=ov.errorOrDestroy;Ea()(gt,oO);function zG(){}function kc(t,e,r){va=va||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof va),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=MG(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){ZG(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 sO(this)}kc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(kc.prototype,"buffer",{get:PG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Ph;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ph=Function.prototype[Symbol.hasInstance],Object.defineProperty(gt,Symbol.hasInstance,{value:function(e){return Ph.call(this,e)?!0:this!==gt?!1:e&&e._writableState instanceof kc}})):Ph=function(e){return e instanceof this};function gt(t){va=va||zs();var e=this instanceof va;if(!e&&!Ph.call(gt,this))return new gt(t);this._writableState=new kc(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)),oO.call(this)}gt.prototype.pipe=function(){Aa(this,new HG)};function WG(t,e){var r=new jG;Aa(t,r),p.default.nextTick(e,r)}function $G(t,e,r,n){var i;return r===null?i=new GG:typeof r!="string"&&!e.objectMode&&(i=new UG("chunk",["string","Buffer"],r)),i?(Aa(t,i),p.default.nextTick(n,i),!1):!0}gt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&LG(t);return s&&!Rh.isBuffer(t)&&(t=BG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=zG),n.ending?WG(this,r):(s||$G(this,n,t,r))&&(n.pendingcb++,i=YG(this,n,s,t,e,r)),i};gt.prototype.cork=function(){this._writableState.corked++};gt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&aO(this,t))};gt.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 QG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function KG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Rh.from(e,r)),e}Object.defineProperty(gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function YG(t,e,r,n,i,s){if(!r){var o=KG(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";l();var sj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};fO.exports=Tn;var lO=lv(),cv=av();Ea()(Tn,lO);for(uv=sj(cv.prototype),Bh=0;Bh{l();var Fh=Vs(),Cn=Fh.Buffer;function dO(t,e){for(var r in t)e[r]=t[r]}Cn.from&&Cn.alloc&&Cn.allocUnsafe&&Cn.allocUnsafeSlow?hO.exports=Fh:(dO(Fh,fv),fv.Buffer=Ws);function Ws(t,e,r){return Cn(t,e,r)}Ws.prototype=Object.create(Cn.prototype);dO(Cn,Ws);Ws.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Cn(t,e,r)};Ws.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Cn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ws.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Cn(t)};Ws.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Fh.SlowBuffer(t)}});var pv=v(yO=>{"use strict";l();var hv=pO().Buffer,gO=hv.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 uj(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 cj(t){var e=uj(t);if(typeof e!="string"&&(hv.isEncoding===gO||!gO(t)))throw new Error("Unknown encoding: "+t);return e||t}yO.StringDecoder=Gc;function Gc(t){this.encoding=cj(t);var e;switch(this.encoding){case"utf16le":this.text=gj,this.end=yj,e=4;break;case"utf8":this.fillLast=dj,e=4;break;case"base64":this.text=mj,this.end=wj,e=3;break;default:this.write=Ej,this.end=vj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=hv.allocUnsafe(e)}Gc.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 lj(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 fj(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 dj(t){var e=this.lastTotal-this.lastNeed,r=fj(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 hj(t,e){var r=lj(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 pj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function gj(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 yj(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 mj(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 wj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Ej(t){return t.toString(this.encoding)}function vj(t){return t&&t.length?this.write(t):""}});var Mh=v((vle,EO)=>{"use strict";l();var mO=Qs().codes.ERR_STREAM_PREMATURE_CLOSE;function Aj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";l();var Uh;function Ui(t,e,r){return e=_j(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _j(t){var e=Sj(t,"string");return typeof e=="symbol"?e:String(e)}function Sj(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 Tj=Mh(),qi=Symbol("lastResolve"),$s=Symbol("lastReject"),jc=Symbol("error"),qh=Symbol("ended"),Ks=Symbol("lastPromise"),gv=Symbol("handlePromise"),Ys=Symbol("stream");function Vi(t,e){return{value:t,done:e}}function Cj(t){var e=t[qi];if(e!==null){var r=t[Ys].read();r!==null&&(t[Ks]=null,t[qi]=null,t[$s]=null,e(Vi(r,!1)))}}function xj(t){p.default.nextTick(Cj,t)}function Nj(t,e){return function(r,n){t.then(function(){if(e[qh]){r(Vi(void 0,!0));return}e[gv](r,n)},n)}}var Oj=Object.getPrototypeOf(function(){}),Dj=Object.setPrototypeOf((Uh={get stream(){return this[Ys]},next:function(){var e=this,r=this[jc];if(r!==null)return Promise.reject(r);if(this[qh])return Promise.resolve(Vi(void 0,!0));if(this[Ys].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[jc]?a(e[jc]):o(Vi(void 0,!0))})});var n=this[Ks],i;if(n)i=new Promise(Nj(n,this));else{var s=this[Ys].read();if(s!==null)return Promise.resolve(Vi(s,!1));i=new Promise(this[gv])}return this[Ks]=i,i}},Ui(Uh,Symbol.asyncIterator,function(){return this}),Ui(Uh,"return",function(){var e=this;return new Promise(function(r,n){e[Ys].destroy(null,function(i){if(i){n(i);return}r(Vi(void 0,!0))})})}),Uh),Oj),Pj=function(e){var r,n=Object.create(Dj,(r={},Ui(r,Ys,{value:e,writable:!0}),Ui(r,qi,{value:null,writable:!0}),Ui(r,$s,{value:null,writable:!0}),Ui(r,jc,{value:null,writable:!0}),Ui(r,qh,{value:e._readableState.endEmitted,writable:!0}),Ui(r,gv,{value:function(s,o){var a=n[Ys].read();a?(n[Ks]=null,n[qi]=null,n[$s]=null,s(Vi(a,!1))):(n[qi]=s,n[$s]=o)},writable:!0}),r));return n[Ks]=null,Tj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[$s];s!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,s(i)),n[jc]=i;return}var o=n[qi];o!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,o(Vi(void 0,!0))),n[qh]=!0}),e.on("readable",xj.bind(null,n)),n};vO.exports=Pj});var IO=v((_le,bO)=>{l();bO.exports=function(){throw new Error("Readable.from is not available in the browser")}});var lv=v((Cle,RO)=>{"use strict";l();RO.exports=qe;var ba;qe.ReadableState=CO;var Tle=ti().EventEmitter,TO=function(e,r){return e.listeners(r).length},zc=JE(),Vh=Vs().Buffer,Rj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Bj(t){return Vh.from(t)}function Lj(t){return Vh.isBuffer(t)||t instanceof Rj}var yv=XE(),Ne;yv&&yv.debuglog?Ne=yv.debuglog("stream"):Ne=function(){};var Fj=KN(),Iv=tv(),Mj=rv(),Uj=Mj.getHighWaterMark,Hh=Qs().codes,qj=Hh.ERR_INVALID_ARG_TYPE,Vj=Hh.ERR_STREAM_PUSH_AFTER_EOF,Hj=Hh.ERR_METHOD_NOT_IMPLEMENTED,kj=Hh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ia,mv,wv;Ea()(qe,zc);var Qc=Iv.errorOrDestroy,Ev=["error","close","destroy","pause","resume"];function Gj(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 CO(t,e,r){ba=ba||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof ba),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Uj(this,t,"readableHighWaterMark",r),this.buffer=new Fj,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&&(Ia||(Ia=pv().StringDecoder),this.decoder=new Ia(t.encoding),this.encoding=t.encoding)}function qe(t){if(ba=ba||zs(),!(this instanceof qe))return new qe(t);var e=this instanceof ba;this._readableState=new CO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),zc.call(this)}Object.defineProperty(qe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});qe.prototype.destroy=Iv.destroy;qe.prototype._undestroy=Iv.undestroy;qe.prototype._destroy=function(t,e){e(t)};qe.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=Vh.from(t,e),e=""),n=!0),xO(this,t,e,!1,n)};qe.prototype.unshift=function(t){return xO(this,t,null,!0,!1)};function xO(t,e,r,n,i){Ne("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,zj(t,s);else{var o;if(i||(o=jj(s,e)),o)Qc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Vh.prototype&&(e=Bj(e)),n)s.endEmitted?Qc(t,new kj):vv(t,s,e,!0);else if(s.ended)Qc(t,new Vj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?vv(t,s,e,!1):bv(t,s)):vv(t,s,e,!1)}else n||(s.reading=!1,bv(t,s))}return!s.ended&&(s.length=_O?t=_O:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function SO(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=Qj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}qe.prototype.read=function(t){Ne("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 Ne("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Av(this):kh(this),null;if(t=SO(t,e),t===0&&e.ended)return e.length===0&&Av(this),null;var n=e.needReadable;Ne("need readable",n),(e.length===0||e.length-t0?i=DO(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&&Av(this)),i!==null&&this.emit("data",i),i};function zj(t,e){if(Ne("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?kh(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,NO(t)))}}function kh(t){var e=t._readableState;Ne("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ne("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(NO,t))}function NO(t){var e=t._readableState;Ne("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,_v(t)}function bv(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Wj,t,e))}function Wj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&PO(n.pipes,t)!==-1)&&!c&&(Ne("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){Ne("onerror",O),A(),t.removeListener("error",g),TO(t,"error")===0&&Qc(t,O)}Gj(t,"error",g);function m(){t.removeListener("finish",y),A()}t.once("close",m);function y(){Ne("onfinish"),t.removeListener("close",m),A()}t.once("finish",y);function A(){Ne("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ne("pipe resume"),r.resume()),t};function $j(t){return function(){var r=t._readableState;Ne("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&TO(t,"data")&&(r.flowing=!0,_v(t))}}qe.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,Ne("on readable",n.length,n.reading),n.length?kh(this):n.reading||p.default.nextTick(Kj,this)),r};qe.prototype.addListener=qe.prototype.on;qe.prototype.removeListener=function(t,e){var r=zc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(OO,this),r};qe.prototype.removeAllListeners=function(t){var e=zc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(OO,this),e};function OO(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 Kj(t){Ne("readable nexttick read 0"),t.read(0)}qe.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ne("resume"),t.flowing=!t.readableListening,Yj(this,t)),t.paused=!1,this};function Yj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(Jj,t,e))}function Jj(t,e){Ne("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),_v(t),e.flowing&&!e.reading&&t.read(0)}qe.prototype.pause=function(){return Ne("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ne("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function _v(t){var e=t._readableState;for(Ne("flow",e.flowing);e.flowing&&t.read()!==null;);}qe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ne("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(Ne("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 Av(t){var e=t._readableState;Ne("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Xj,e,t))}function Xj(t,e){if(Ne("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"&&(qe.from=function(t,e){return wv===void 0&&(wv=IO()),wv(qe,t,e)});function PO(t,e){for(var r=0,n=t.length;r{"use strict";l();LO.exports=ri;var Gh=Qs().codes,Zj=Gh.ERR_METHOD_NOT_IMPLEMENTED,eQ=Gh.ERR_MULTIPLE_CALLBACK,tQ=Gh.ERR_TRANSFORM_ALREADY_TRANSFORMING,rQ=Gh.ERR_TRANSFORM_WITH_LENGTH_0,jh=zs();Ea()(ri,jh);function nQ(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new eQ);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";l();MO.exports=Wc;var FO=Sv();Ea()(Wc,FO);function Wc(t){if(!(this instanceof Wc))return new Wc(t);FO.call(this,t)}Wc.prototype._transform=function(t,e,r){r(null,t)}});var GO=v((Rle,kO)=>{"use strict";l();var Tv;function sQ(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var HO=Qs().codes,oQ=HO.ERR_MISSING_ARGS,aQ=HO.ERR_STREAM_DESTROYED;function qO(t){if(t)throw t}function uQ(t){return t.setHeader&&typeof t.abort=="function"}function cQ(t,e,r,n){n=sQ(n);var i=!1;t.on("close",function(){i=!0}),Tv===void 0&&(Tv=Mh()),Tv(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,uQ(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new aQ("pipe"))}}}function VO(t){t()}function lQ(t,e){return t.pipe(e)}function fQ(t){return!t.length||typeof t[t.length-1]!="function"?qO:t.pop()}function dQ(){for(var t=arguments.length,e=new Array(t),r=0;r0;return cQ(o,u,c,function(f){i||(i=f),f&&s.forEach(VO),!u&&(s.forEach(VO),n(i))})});return e.reduce(lQ)}kO.exports=dQ});var Cv=v((Vr,jO)=>{l();Vr=jO.exports=lv();Vr.Stream=Vr;Vr.Readable=Vr;Vr.Writable=av();Vr.Duplex=zs();Vr.Transform=Sv();Vr.PassThrough=UO();Vr.finished=Mh();Vr.pipeline=GO()});var WO=v((Fle,zO)=>{l();var{Transform:hQ}=Cv();zO.exports=t=>class QO extends hQ{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 QO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var YO=v((Ule,KO)=>{l();var{Transform:pQ}=Cv();KO.exports=t=>class $O extends pQ{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 $O(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var XO=v((Vle,JO)=>{l();var gQ=WO(),yQ=YO();JO.exports=function(t){let e=gQ(t),r=yQ(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 t2=v(e2=>{l();var ZO=[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];e2.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],c=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],g=f^(i<<1|s>>>31),m=d^(s<<1|i>>>31),y=t[0]^g,A=t[1]^m,O=t[10]^g,R=t[11]^m,z=t[20]^g,M=t[21]^m,b=t[30]^g,S=t[31]^m,N=t[40]^g,_=t[41]^m;g=r^(o<<1|a>>>31),m=n^(a<<1|o>>>31);let T=t[2]^g,B=t[3]^m,X=t[12]^g,Q=t[13]^m,H=t[22]^g,j=t[23]^m,K=t[32]^g,me=t[33]^m,ce=t[42]^g,ie=t[43]^m;g=i^(u<<1|c>>>31),m=s^(c<<1|u>>>31);let J=t[4]^g,oe=t[5]^m,re=t[14]^g,se=t[15]^m,U=t[24]^g,fe=t[25]^m,ue=t[34]^g,de=t[35]^m,ae=t[44]^g,le=t[45]^m;g=o^(f<<1|d>>>31),m=a^(d<<1|f>>>31);let w=t[6]^g,E=t[7]^m,I=t[16]^g,P=t[17]^m,C=t[26]^g,D=t[27]^m,L=t[36]^g,x=t[37]^m,F=t[46]^g,k=t[47]^m;g=u^(r<<1|n>>>31),m=c^(n<<1|r>>>31);let q=t[8]^g,ee=t[9]^m,Ae=t[18]^g,_e=t[19]^m,Be=t[28]^g,it=t[29]^m,dt=t[38]^g,De=t[39]^m,Ve=t[48]^g,Lt=t[49]^m,Ei=y,Ss=A,Ts=R<<4|O>>>28,cr=O<<4|R>>>28,Qn=z<<3|M>>>29,Kt=M<<3|z>>>29,Ft=S<<9|b>>>23,Je=b<<9|S>>>23,o0=N<<18|_>>>14,a0=_<<18|N>>>14,u0=T<<1|B>>>31,c0=B<<1|T>>>31,l0=Q<<12|X>>>20,f0=X<<12|Q>>>20,d0=H<<10|j>>>22,h0=j<<10|H>>>22,p0=me<<13|K>>>19,g0=K<<13|me>>>19,y0=ce<<2|ie>>>30,m0=ie<<2|ce>>>30,w0=oe<<30|J>>>2,E0=J<<30|oe>>>2,v0=re<<6|se>>>26,A0=se<<6|re>>>26,b0=fe<<11|U>>>21,I0=U<<11|fe>>>21,_0=ue<<15|de>>>17,S0=de<<15|ue>>>17,T0=le<<29|ae>>>3,C0=ae<<29|le>>>3,x0=w<<28|E>>>4,N0=E<<28|w>>>4,O0=P<<23|I>>>9,D0=I<<23|P>>>9,P0=C<<25|D>>>7,R0=D<<25|C>>>7,B0=L<<21|x>>>11,L0=x<<21|L>>>11,F0=k<<24|F>>>8,M0=F<<24|k>>>8,U0=q<<27|ee>>>5,q0=ee<<27|q>>>5,V0=Ae<<20|_e>>>12,H0=_e<<20|Ae>>>12,k0=it<<7|Be>>>25,G0=Be<<7|it>>>25,j0=dt<<8|De>>>24,Q0=De<<8|dt>>>24,z0=Ve<<14|Lt>>>18,W0=Lt<<14|Ve>>>18;t[0]=Ei^~l0&b0,t[1]=Ss^~f0&I0,t[10]=x0^~V0&Qn,t[11]=N0^~H0&Kt,t[20]=u0^~v0&P0,t[21]=c0^~A0&R0,t[30]=U0^~Ts&d0,t[31]=q0^~cr&h0,t[40]=w0^~O0&k0,t[41]=E0^~D0&G0,t[2]=l0^~b0&B0,t[3]=f0^~I0&L0,t[12]=V0^~Qn&p0,t[13]=H0^~Kt&g0,t[22]=v0^~P0&j0,t[23]=A0^~R0&Q0,t[32]=Ts^~d0&_0,t[33]=cr^~h0&S0,t[42]=O0^~k0&Ft,t[43]=D0^~G0&Je,t[4]=b0^~B0&z0,t[5]=I0^~L0&W0,t[14]=Qn^~p0&T0,t[15]=Kt^~g0&C0,t[24]=P0^~j0&o0,t[25]=R0^~Q0&a0,t[34]=d0^~_0&F0,t[35]=h0^~S0&M0,t[44]=k0^~Ft&y0,t[45]=G0^~Je&m0,t[6]=B0^~z0&Ei,t[7]=L0^~W0&Ss,t[16]=p0^~T0&x0,t[17]=g0^~C0&N0,t[26]=j0^~o0&u0,t[27]=Q0^~a0&c0,t[36]=_0^~F0&U0,t[37]=S0^~M0&q0,t[46]=Ft^~y0&w0,t[47]=Je^~m0&E0,t[8]=z0^~Ei&l0,t[9]=W0^~Ss&f0,t[18]=T0^~x0&V0,t[19]=C0^~N0&H0,t[28]=o0^~u0&v0,t[29]=a0^~c0&A0,t[38]=F0^~U0&Ts,t[39]=M0^~q0&cr,t[48]=y0^~w0&O0,t[49]=m0^~E0&D0,t[0]^=ZO[e*2],t[1]^=ZO[e*2+1]}}});var n2=v((jle,r2)=>{l();var Qh=t2();function _a(){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}_a.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};_a.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Qh.p1600(this.state),this.count=0);return e};_a.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};r2.exports=_a});var xv=v((zle,i2)=>{l();i2.exports=XO()(n2())});var Pv=v(Sa=>{"use strict";l();var mQ=Sa&&Sa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sa,"__esModule",{value:!0});Sa.SmartContract=void 0;var wQ=mQ(Yt()),$c=pt(),Nv=ah(),EQ=Le(),Ov=Yr(),vQ=br(),AQ=Tc(),s2=OE(),o2=qc(),a2=qE(),bQ=kE(),IQ=Vc(),zh=KE(),_Q=xv(),Dv=class{constructor(e={}){this.address=new $c.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new $c.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 o2.ContractFunction(i);return new a2.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new o2.ContractFunction(i),a=bQ.NativeSerializer.nativeToTypedValues(s||[],n);return new a2.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return vQ.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}){Nv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new s2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Ov.Transaction({receiver:$c.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){Nv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new s2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Ov.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){Nv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let c=new zh.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new Ov.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:c,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new IQ.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new EQ.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new $c.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new wQ.default(r.valueOf().toString(10)),u=AQ.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let c=h.Buffer.concat([i,o]),f=_Q("keccak256").update(c).digest(),d=h.Buffer.from(zh.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new $c.Address(g)}};Sa.SmartContract=Dv});var Wh=v(Js=>{"use strict";l();Object.defineProperty(Js,"__esModule",{value:!0});Js.SignableMessage=Js.MESSAGE_PREFIX=void 0;var SQ=pt(),TQ=Rc(),CQ=xv();Js.MESSAGE_PREFIX=`Elrond Signed Message: -`;var Rv=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new SQ.Address,Object.assign(this,e)}serializeForSigning(){let e=h.Buffer.from(this.message.length.toString()),r=h.Buffer.concat([e,this.message]),n=h.Buffer.concat([h.Buffer.from(Js.MESSAGE_PREFIX),r]);return CQ("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=TQ.interpretSignatureAsBuffer(e)}getMessageSize(){let e=h.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};Js.SignableMessage=Rv});var u2=v(Hi=>{"use strict";l();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.ErrAccountNotConnected=Hi.ErrCannotSignSingleTransaction=Hi.Err=void 0;var Kc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Hi.Err=Kc;var Bv=class extends Kc{constructor(){super("Cannot sign single transaction.")}};Hi.ErrCannotSignSingleTransaction=Bv;var Lv=class extends Kc{constructor(){super("Account is not connected.")}};Hi.ErrAccountNotConnected=Lv});var c2=v(Yc=>{"use strict";l();Object.defineProperty(Yc,"__esModule",{value:!0});Yc.Operation=void 0;var xQ;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(xQ=Yc.Operation||(Yc.Operation={}))});var Fv=v(Ta=>{"use strict";l();var ki=Ta&&Ta.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ta,"__esModule",{value:!0});Ta.ExtensionProvider=void 0;var NQ=Yr(),l2=u2(),Jc=c2(),Xc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return ki(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return ki(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(Jc.Operation.Connect,n),this.account.address})}logout(){return ki(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Jc.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 ki(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 ki(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return ki(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new l2.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new l2.ErrAccountNotConnected}signTransactions(e){return ki(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Jc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>NQ.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return ki(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Jc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Jc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(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)})}};Ta.ExtensionProvider=Xc;Xc._instance=new Xc});function RQ(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){BQ(t);return}return e}function BQ(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zc(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!PQ.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(OQ.test(t)||DQ.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,RQ)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var OQ,DQ,PQ,g2=he(()=>{l();OQ=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,DQ=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,PQ=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function LQ(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mt(t,...e){try{return LQ(t(...e))}catch(r){return Promise.reject(r)}}function FQ(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function MQ(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function el(t){if(FQ(t))return String(t);if(MQ(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return el(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function y2(){if(typeof h.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function m2(t){if(typeof t=="string")return t;y2();let e=h.Buffer.from(t).toString("base64");return Mv+e}function w2(t){return typeof t!="string"||!t.startsWith(Mv)?t:(y2(),h.Buffer.from(t.slice(Mv.length),"base64"))}function ir(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function E2(...t){return ir(t.join(":"))}function tl(t){return t=ir(t),t?t+":":""}var Mv,v2=he(()=>{l();Mv="base64:"});function I2(t={}){let e={mounts:{"":t.driver||qQ()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(d=>d.startsWith(c)||f&&c.startsWith(d)).map(d=>({relativeBase:c.length>d.length?c.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),i=(c,f)=>{if(e.watching){f=ir(f);for(let d of e.watchListeners)d(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await A2(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},a=(c,f,d)=>{let g=new Map,m=y=>{let A=g.get(y.base);return A||(A={driver:y.driver,base:y.base,items:[]},g.set(y.base,A)),A};for(let y of c){let A=typeof y=="string",O=ir(A?y:y.key),R=A?void 0:y.value,z=A||!y.options?f:{...f,...y.options},M=r(O);m(M).items.push({key:O,value:R,relativeKey:M.relativeKey,options:z})}return Promise.all([...g.values()].map(y=>d(y))).then(y=>y.flat())},u={hasItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.hasItem,d,f)},getItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.getItem,d,f).then(m=>Zc(m))},getItems(c,f){return a(c,f,d=>d.driver.getItems?Mt(d.driver.getItems,d.items.map(g=>({key:g.relativeKey,options:g.options})),f).then(g=>g.map(m=>({key:E2(d.base,m.key),value:Zc(m.value)}))):Promise.all(d.items.map(g=>Mt(d.driver.getItem,g.relativeKey,g.options).then(m=>({key:g.key,value:Zc(m)})))))},getItemRaw(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return g.getItemRaw?Mt(g.getItemRaw,d,f):Mt(g.getItem,d,f).then(m=>w2(m))},async setItem(c,f,d={}){if(f===void 0)return u.removeItem(c);c=ir(c);let{relativeKey:g,driver:m}=r(c);m.setItem&&(await Mt(m.setItem,g,el(f),d),m.watch||i("update",c))},async setItems(c,f){await a(c,f,async d=>{d.driver.setItems&&await Mt(d.driver.setItems,d.items.map(g=>({key:g.relativeKey,value:el(g.value),options:g.options})),f),d.driver.setItem&&await Promise.all(d.items.map(g=>Mt(d.driver.setItem,g.relativeKey,el(g.value),g.options)))})},async setItemRaw(c,f,d={}){if(f===void 0)return u.removeItem(c,d);c=ir(c);let{relativeKey:g,driver:m}=r(c);if(m.setItemRaw)await Mt(m.setItemRaw,g,f,d);else if(m.setItem)await Mt(m.setItem,g,m2(f),d);else return;m.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c);g.removeItem&&(await Mt(g.removeItem,d,f),(f.removeMeta||f.removeMata)&&await Mt(g.removeItem,d+"$",f),g.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c),m=Object.create(null);if(g.getMeta&&Object.assign(m,await Mt(g.getMeta,d,f)),!f.nativeOnly){let y=await Mt(g.getItem,d+"$",f).then(A=>Zc(A));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(m,y))}return m},setMeta(c,f,d={}){return this.setItem(c+"$",f,d)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=tl(c);let d=n(c,!0),g=[],m=[];for(let y of d){let O=(await Mt(y.driver.getKeys,y.relativeBase,f)).map(R=>y.mountpoint+ir(R)).filter(R=>!g.some(z=>R.startsWith(z)));m.push(...O),g=[y.mountpoint,...g.filter(R=>!R.startsWith(y.mountpoint))]}return c?m.filter(y=>y.startsWith(c)&&!y.endsWith("$")):m.filter(y=>!y.endsWith("$"))},async clear(c,f={}){c=tl(c),await Promise.all(n(c,!1).map(async d=>{if(d.driver.clear)return Mt(d.driver.clear,d.relativeBase,f);if(d.driver.removeItem){let g=await d.driver.getKeys(d.relativeBase||"",f);return Promise.all(g.map(m=>d.driver.removeItem(m,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>b2(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=tl(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((d,g)=>g.length-d.length)),e.mounts[c]=f,e.watching&&Promise.resolve(A2(f,i,c)).then(d=>{e.unwatch[c]=d}).catch(console.error),u},async unmount(c,f=!0){c=tl(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await b2(e.mounts[c]),e.mountpoints=e.mountpoints.filter(d=>d!==c),delete e.mounts[c])},getMount(c=""){c=ir(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=ir(c),n(c,f.parents).map(g=>({driver:g.driver,base:g.mountpoint}))}};return u}function A2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function b2(t){typeof t.dispose=="function"&&await Mt(t.dispose)}var UQ,qQ,_2=he(()=>{l();g2();v2();UQ="memory",qQ=()=>{let t=new Map;return{name:UQ,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function Xs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function qv(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Xs(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function rl(){return Uv||(Uv=qv("keyval-store","keyval")),Uv}function Vv(t,e=rl()){return e("readonly",r=>Xs(r.get(t)))}function S2(t,e,r=rl()){return r("readwrite",n=>(n.put(e,t),Xs(n.transaction)))}function T2(t,e=rl()){return e("readwrite",r=>(r.delete(t),Xs(r.transaction)))}function C2(t=rl()){return t("readwrite",e=>(e.clear(),Xs(e.transaction)))}function VQ(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xs(t.transaction)}function x2(t=rl()){return t("readonly",e=>{if(e.getAllKeys)return Xs(e.getAllKeys());let r=[];return VQ(e,n=>r.push(n.key)).then(()=>r)})}var Uv,N2=he(()=>{l()});var O2={};ft(O2,{safeJsonParse:()=>ji,safeJsonStringify:()=>Qi});function ji(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return kQ(t)}catch{return t}}function Qi(t){return typeof t=="string"?t:HQ(t)||""}var HQ,kQ,nl=he(()=>{l();HQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),kQ=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 P2={};ft(P2,{KeyValueStorage:()=>jv,default:()=>jv});function WQ(t){var e;return[t[0],ji((e=t[1])!=null?e:"")]}var GQ,jQ,QQ,zQ,kv,Hv,Jh,Gv,$Q,D2,KQ,YQ,jv,R2=he(()=>{l();_2();N2();nl();GQ="idb-keyval",jQ=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=qv(t.dbName,t.storeName)),{name:GQ,options:t,async hasItem(i){return!(typeof await Vv(r(i),n)>"u")},async getItem(i){return await Vv(r(i),n)??null},setItem(i,s){return S2(r(i),s,n)},removeItem(i){return T2(r(i),n)},getKeys(){return x2(n)},clear(){return C2(n)}}},QQ="WALLET_CONNECT_V2_INDEXED_DB",zQ="keyvaluestorage",kv=class{constructor(){this.indexedDb=I2({driver:jQ({dbName:QQ,storeName:zQ})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Qi(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},Hv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Jh={exports:{}};(function(){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 Hv<"u"&&Hv.localStorage?Jh.exports=Hv.localStorage:typeof window<"u"&&window.localStorage?Jh.exports=window.localStorage:Jh.exports=new e})();Gv=class{constructor(){this.localStorage=Jh.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(WQ)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return ji(r)}async setItem(e,r){this.localStorage.setItem(e,Qi(r))}async removeItem(e){this.localStorage.removeItem(e)}},$Q="wc_storage_version",D2=1,KQ=async(t,e,r)=>{let n=$Q,i=await e.getItem(n);if(i&&i>=D2){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let a=s.shift();if(!a)continue;let u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){let c=await t.getItem(a);await e.setItem(a,c),o.push(a)}}await e.setItem(n,D2),r(e),YQ(t,o)},YQ=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},jv=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new Gv;this.storage=e;try{let r=new kv;KQ(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var Zr={};ft(Zr,{__assign:()=>zv,__asyncDelegator:()=>c7,__asyncGenerator:()=>u7,__asyncValues:()=>l7,__await:()=>il,__awaiter:()=>r7,__classPrivateFieldGet:()=>p7,__classPrivateFieldSet:()=>g7,__createBinding:()=>i7,__decorate:()=>ZQ,__exportStar:()=>s7,__extends:()=>JQ,__generator:()=>n7,__importDefault:()=>h7,__importStar:()=>d7,__makeTemplateObject:()=>f7,__metadata:()=>t7,__param:()=>e7,__read:()=>B2,__rest:()=>XQ,__spread:()=>o7,__spreadArrays:()=>a7,__values:()=>Wv});function JQ(t,e){Qv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function XQ(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 e7(t,e){return function(r,n){e(r,n,t)}}function t7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function r7(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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function n7(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(c){return function(f){return u([c,f])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[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 B2(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 o7(){for(var t=[],e=0;e1||a(g,m)})})}function a(g,m){try{u(n[g](m))}catch(y){d(s[0][3],y)}}function u(g){g.value instanceof il?Promise.resolve(g.value.v).then(c,f):d(s[0][2],g)}function c(g){a("next",g)}function f(g){a("throw",g)}function d(g,m){g(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function c7(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:il(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function l7(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 Wv=="function"?Wv(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(c){s({value:c,done:a})},o)}}function f7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function d7(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 h7(t){return t&&t.__esModule?t:{default:t}}function p7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function g7(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 Qv,zv,en=he(()=>{l();Qv=function(t,e){return Qv=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])},Qv(t,e)};zv=function(){return zv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";l();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.delay=void 0;function y7(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Xh.delay=y7});var F2=v(Ca=>{"use strict";l();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ONE_THOUSAND=Ca.ONE_HUNDRED=void 0;Ca.ONE_HUNDRED=100;Ca.ONE_THOUSAND=1e3});var M2=v(ge=>{"use strict";l();Object.defineProperty(ge,"__esModule",{value:!0});ge.ONE_YEAR=ge.FOUR_WEEKS=ge.THREE_WEEKS=ge.TWO_WEEKS=ge.ONE_WEEK=ge.THIRTY_DAYS=ge.SEVEN_DAYS=ge.FIVE_DAYS=ge.THREE_DAYS=ge.ONE_DAY=ge.TWENTY_FOUR_HOURS=ge.TWELVE_HOURS=ge.SIX_HOURS=ge.THREE_HOURS=ge.ONE_HOUR=ge.SIXTY_MINUTES=ge.THIRTY_MINUTES=ge.TEN_MINUTES=ge.FIVE_MINUTES=ge.ONE_MINUTE=ge.SIXTY_SECONDS=ge.THIRTY_SECONDS=ge.TEN_SECONDS=ge.FIVE_SECONDS=ge.ONE_SECOND=void 0;ge.ONE_SECOND=1;ge.FIVE_SECONDS=5;ge.TEN_SECONDS=10;ge.THIRTY_SECONDS=30;ge.SIXTY_SECONDS=60;ge.ONE_MINUTE=ge.SIXTY_SECONDS;ge.FIVE_MINUTES=ge.ONE_MINUTE*5;ge.TEN_MINUTES=ge.ONE_MINUTE*10;ge.THIRTY_MINUTES=ge.ONE_MINUTE*30;ge.SIXTY_MINUTES=ge.ONE_MINUTE*60;ge.ONE_HOUR=ge.SIXTY_MINUTES;ge.THREE_HOURS=ge.ONE_HOUR*3;ge.SIX_HOURS=ge.ONE_HOUR*6;ge.TWELVE_HOURS=ge.ONE_HOUR*12;ge.TWENTY_FOUR_HOURS=ge.ONE_HOUR*24;ge.ONE_DAY=ge.TWENTY_FOUR_HOURS;ge.THREE_DAYS=ge.ONE_DAY*3;ge.FIVE_DAYS=ge.ONE_DAY*5;ge.SEVEN_DAYS=ge.ONE_DAY*7;ge.THIRTY_DAYS=ge.ONE_DAY*30;ge.ONE_WEEK=ge.SEVEN_DAYS;ge.TWO_WEEKS=ge.ONE_WEEK*2;ge.THREE_WEEKS=ge.ONE_WEEK*3;ge.FOUR_WEEKS=ge.ONE_WEEK*4;ge.ONE_YEAR=ge.ONE_DAY*365});var $v=v(Zh=>{"use strict";l();Object.defineProperty(Zh,"__esModule",{value:!0});var U2=(en(),ht(Zr));U2.__exportStar(F2(),Zh);U2.__exportStar(M2(),Zh)});var V2=v(xa=>{"use strict";l();Object.defineProperty(xa,"__esModule",{value:!0});xa.fromMiliseconds=xa.toMiliseconds=void 0;var q2=$v();function m7(t){return t*q2.ONE_THOUSAND}xa.toMiliseconds=m7;function w7(t){return Math.floor(t/q2.ONE_THOUSAND)}xa.fromMiliseconds=w7});var k2=v(ep=>{"use strict";l();Object.defineProperty(ep,"__esModule",{value:!0});var H2=(en(),ht(Zr));H2.__exportStar(L2(),ep);H2.__exportStar(V2(),ep)});var G2=v(sl=>{"use strict";l();Object.defineProperty(sl,"__esModule",{value:!0});sl.Watch=void 0;var tp=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}};sl.Watch=tp;sl.default=tp});var j2=v(rp=>{"use strict";l();Object.defineProperty(rp,"__esModule",{value:!0});rp.IWatch=void 0;var Kv=class{};rp.IWatch=Kv});var Q2=v(Yv=>{"use strict";l();Object.defineProperty(Yv,"__esModule",{value:!0});var E7=(en(),ht(Zr));E7.__exportStar(j2(),Yv)});var Zs=v(Na=>{"use strict";l();Object.defineProperty(Na,"__esModule",{value:!0});var np=(en(),ht(Zr));np.__exportStar(k2(),Na);np.__exportStar(G2(),Na);np.__exportStar(Q2(),Na);np.__exportStar($v(),Na)});var Jv,z2=he(()=>{l();Jv=class{}});var Xv={};ft(Xv,{IEvents:()=>Jv});var Zv=he(()=>{l();z2()});var W2=v(ip=>{"use strict";l();Object.defineProperty(ip,"__esModule",{value:!0});ip.IHeartBeat=void 0;var v7=(Zv(),ht(Xv)),e1=class extends v7.IEvents{constructor(e){super()}};ip.IHeartBeat=e1});var r1=v(t1=>{"use strict";l();Object.defineProperty(t1,"__esModule",{value:!0});var A7=(en(),ht(Zr));A7.__exportStar(W2(),t1)});var $2=v(Oa=>{"use strict";l();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.HEARTBEAT_EVENTS=Oa.HEARTBEAT_INTERVAL=void 0;var b7=Zs();Oa.HEARTBEAT_INTERVAL=b7.FIVE_SECONDS;Oa.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var i1=v(n1=>{"use strict";l();Object.defineProperty(n1,"__esModule",{value:!0});var I7=(en(),ht(Zr));I7.__exportStar($2(),n1)});var K2=v(sp=>{"use strict";l();Object.defineProperty(sp,"__esModule",{value:!0});sp.HeartBeat=void 0;var s1=(en(),ht(Zr)),_7=ti(),S7=Zs(),T7=r1(),o1=i1(),a1=class t extends T7.IHeartBeat{constructor(e){super(e),this.events=new _7.EventEmitter,this.interval=o1.HEARTBEAT_INTERVAL,this.interval=e?.interval||o1.HEARTBEAT_INTERVAL}static init(e){return s1.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return s1.__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 s1.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),S7.toMiliseconds(this.interval))})}pulse(){this.events.emit(o1.HEARTBEAT_EVENTS.pulse)}};sp.HeartBeat=a1});var Y2=v(ol=>{"use strict";l();Object.defineProperty(ol,"__esModule",{value:!0});var u1=(en(),ht(Zr));u1.__exportStar(K2(),ol);u1.__exportStar(r1(),ol);u1.__exportStar(i1(),ol)});var X2=v((lde,J2)=>{"use strict";l();function C7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}J2.exports=x7;function x7(t,e,r){var n=r&&r.stringify||C7,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(m+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=m+2,m++;break}c+=n(e[f]),d=m+2,m++;break;case 115:if(f>=u)break;d{"use strict";l();var Z2=X2();rD.exports=xn;var al=U7().console||{},N7={mapHttpRequest:op,mapHttpResponse:op,wrapRequestSerializer:c1,wrapResponseSerializer:c1,wrapErrorSerializer:c1,req:op,res:op,err:B7};function O7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function xn(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||al;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=O7(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=ul),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:L7(t)};u.levels=xn.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=ul,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=m,e&&(u._logEvent=l1());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,Da(c,u,"error","log"),Da(c,u,"fatal","error"),Da(c,u,"warn","error"),Da(c,u,"info","log"),Da(c,u,"debug","log"),Da(c,u,"trace","log")}function m(y,A){if(!y)throw new Error("missing bindings for child Pino");A=A||{},i&&y.serializers&&(A.serializers=y.serializers);let O=A.serializers;if(i&&O){var R=Object.assign({},n,O),z=t.browser.serialize===!0?Object.keys(R):i;delete y.serializers,ap([y],z,R,this._stdErrSerialize)}function M(b){this._childLevel=(b._childLevel|0)+1,this.error=Pa(b,y,"error"),this.fatal=Pa(b,y,"fatal"),this.warn=Pa(b,y,"warn"),this.info=Pa(b,y,"info"),this.debug=Pa(b,y,"debug"),this.trace=Pa(b,y,"trace"),R&&(this.serializers=R,this._serialize=z),e&&(this._logEvent=l1([].concat(b._logEvent.bindings,y)))}return M.prototype=this,new M(this)}return u}xn.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"}};xn.stdSerializers=N7;xn.stdTimeFunctions=Object.assign({},{nullTime:eD,epochTime:tD,unixTime:F7,isoTime:M7});function Da(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?ul:i[r]?i[r]:al[r]||al[n]||ul,D7(t,e,r)}function D7(t,e,r){!t.transmit&&e[r]===ul||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===al?al:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Pa(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";l();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.PINO_CUSTOM_CONTEXT_KEY=Ra.PINO_LOGGER_DEFAULTS=void 0;Ra.PINO_LOGGER_DEFAULTS={level:"info"};Ra.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var uD=v(mr=>{"use strict";l();Object.defineProperty(mr,"__esModule",{value:!0});mr.generateChildLogger=mr.formatChildLoggerContext=mr.getLoggerContext=mr.setBrowserLoggerContext=mr.getBrowserLoggerContext=mr.getDefaultLoggerOptions=void 0;var Ba=f1();function q7(t){return Object.assign(Object.assign({},t),{level:t?.level||Ba.PINO_LOGGER_DEFAULTS.level})}mr.getDefaultLoggerOptions=q7;function iD(t,e=Ba.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}mr.getBrowserLoggerContext=iD;function sD(t,e,r=Ba.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}mr.setBrowserLoggerContext=sD;function oD(t,e=Ba.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=iD(t,e):r=t.bindings().context||"",r}mr.getLoggerContext=oD;function aD(t,e,r=Ba.PINO_CUSTOM_CONTEXT_KEY){let n=oD(t,r);return n.trim()?`${n}/${e}`:e}mr.formatChildLoggerContext=aD;function V7(t,e,r=Ba.PINO_CUSTOM_CONTEXT_KEY){let n=aD(t,e,r),i=t.child({context:n});return sD(i,n,r)}mr.generateChildLogger=V7});var h1=v(La=>{"use strict";l();Object.defineProperty(La,"__esModule",{value:!0});La.pino=void 0;var d1=(en(),ht(Zr)),H7=d1.__importDefault(nD());Object.defineProperty(La,"pino",{enumerable:!0,get:function(){return H7.default}});d1.__exportStar(f1(),La);d1.__exportStar(uD(),La)});var P1=v(Ot=>{"use strict";l();Object.defineProperty(Ot,"__esModule",{value:!0});var Fa=(Zv(),ht(Xv)),cD=ti();function k7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var G7=k7(cD),p1=class extends Fa.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},g1=class{constructor(e,r,n){this.core=e,this.logger=r}},y1=class extends Fa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},m1=class{constructor(e,r){this.logger=e,this.core=r}},w1=class extends Fa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},E1=class extends Fa.IEvents{constructor(e){super()}},v1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},A1=class{constructor(){this.map=new Map}},b1=class extends Fa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},I1=class{constructor(e,r){this.core=e,this.logger=r}},_1=class extends Fa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},S1=class{constructor(e,r){this.logger=e,this.core=r}},T1=class{constructor(e,r){this.projectId=e,this.logger=r}},C1=class{constructor(e,r){this.projectId=e,this.logger=r}},x1=class extends G7.default{constructor(){super()}},N1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},O1=class extends cD.EventEmitter{constructor(){super()}},D1=class{constructor(e){this.client=e}};Ot.ICore=p1,Ot.ICrypto=g1,Ot.IEchoClient=C1,Ot.IEngine=D1,Ot.IEngineEvents=O1,Ot.IExpirer=_1,Ot.IJsonRpcHistory=y1,Ot.IKeyChain=I1,Ot.IMessageTracker=m1,Ot.IPairing=S1,Ot.IPublisher=w1,Ot.IRelayer=E1,Ot.ISignClient=N1,Ot.ISignClientEvents=x1,Ot.IStore=v1,Ot.ISubscriber=b1,Ot.ISubscriberTopicMap=A1,Ot.IVerify=T1});var fD=v(up=>{"use strict";l();Object.defineProperty(up,"__esModule",{value:!0});up.BrowserRandomSource=void 0;var lD=65536,R1=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";l();Object.defineProperty(B1,"__esModule",{value:!0});function j7(t){for(var e=0;e{l()});var hD=v(cp=>{"use strict";l();Object.defineProperty(cp,"__esModule",{value:!0});cp.NodeRandomSource=void 0;var Q7=Hr(),L1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof _S<"u"){let e=dD();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";l();Object.defineProperty(lp,"__esModule",{value:!0});lp.SystemRandomSource=void 0;var z7=fD(),W7=hD(),F1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new z7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new W7.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)}};lp.SystemRandomSource=F1});var gD=v(Ir=>{"use strict";l();Object.defineProperty(Ir,"__esModule",{value:!0});function $7(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}Ir.mul=Math.imul||$7;function K7(t,e){return t+e|0}Ir.add=K7;function Y7(t,e){return t-e|0}Ir.sub=Y7;function J7(t,e){return t<>>32-e}Ir.rotl=J7;function X7(t,e){return t<<32-e|t>>>e}Ir.rotr=X7;function Z7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ir.isInteger=Number.isInteger||Z7;Ir.MAX_SAFE_INTEGER=9007199254740991;Ir.isSafeInteger=function(t){return Ir.isInteger(t)&&t>=-Ir.MAX_SAFE_INTEGER&&t<=Ir.MAX_SAFE_INTEGER}});var Ma=v(Oe=>{"use strict";l();Object.defineProperty(Oe,"__esModule",{value:!0});var yD=gD();function e9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Oe.readInt16BE=e9;function t9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Oe.readUint16BE=t9;function r9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Oe.readInt16LE=r9;function n9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Oe.readUint16LE=n9;function mD(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}Oe.writeUint16BE=mD;Oe.writeInt16BE=mD;function wD(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}Oe.writeUint16LE=wD;Oe.writeInt16LE=wD;function M1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Oe.readInt32BE=M1;function U1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Oe.readUint32BE=U1;function q1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Oe.readInt32LE=q1;function V1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Oe.readUint32LE=V1;function fp(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}Oe.writeUint32BE=fp;Oe.writeInt32BE=fp;function dp(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}Oe.writeUint32LE=dp;Oe.writeInt32LE=dp;function i9(t,e){e===void 0&&(e=0);var r=M1(t,e),n=M1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Oe.readInt64BE=i9;function s9(t,e){e===void 0&&(e=0);var r=U1(t,e),n=U1(t,e+4);return r*4294967296+n}Oe.readUint64BE=s9;function o9(t,e){e===void 0&&(e=0);var r=q1(t,e),n=q1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Oe.readInt64LE=o9;function a9(t,e){e===void 0&&(e=0);var r=V1(t,e),n=V1(t,e+4);return n*4294967296+r}Oe.readUint64LE=a9;function ED(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fp(t/4294967296>>>0,e,r),fp(t>>>0,e,r+4),e}Oe.writeUint64BE=ED;Oe.writeInt64BE=ED;function vD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),dp(t>>>0,e,r),dp(t/4294967296>>>0,e,r+4),e}Oe.writeUint64LE=vD;Oe.writeInt64LE=vD;function u9(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}Oe.readUintBE=u9;function c9(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}Oe.writeUintBE=l9;function f9(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(!yD.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";l();Object.defineProperty(er,"__esModule",{value:!0});er.randomStringForEntropy=er.randomString=er.randomUint32=er.randomBytes=er.defaultRandomSource=void 0;var v9=pD(),A9=Ma(),AD=Hr();er.defaultRandomSource=new v9.SystemRandomSource;function H1(t,e=er.defaultRandomSource){return e.randomBytes(t)}er.randomBytes=H1;function b9(t=er.defaultRandomSource){let e=H1(4,t),r=(0,A9.readUint32LE)(e);return(0,AD.wipe)(e),r}er.randomUint32=b9;var bD="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function ID(t,e=bD,r=er.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=H1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(ni,"__esModule",{value:!0});var qa=Ma(),Ua=Hr();ni.DIGEST_LENGTH=64;ni.BLOCK_SIZE=128;var SD=function(){function t(){this.digestLength=ni.DIGEST_LENGTH,this.blockSize=ni.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(){Ua.wipe(this._buffer),Ua.wipe(this._tempHi),Ua.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&&(k1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=k1(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){Ua.wipe(e.stateHi),Ua.wipe(e.stateLo),e.buffer&&Ua.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();ni.SHA512=SD;var _D=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 k1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],c=r[2],f=r[3],d=r[4],g=r[5],m=r[6],y=r[7],A=n[0],O=n[1],R=n[2],z=n[3],M=n[4],b=n[5],S=n[6],N=n[7],_,T,B,X,Q,H,j,K;o>=128;){for(var me=0;me<16;me++){var ce=8*me+s;t[me]=qa.readUint32BE(i,ce),e[me]=qa.readUint32BE(i,ce+4)}for(var me=0;me<80;me++){var ie=a,J=u,oe=c,re=f,se=d,U=g,fe=m,ue=y,de=A,ae=O,le=R,w=z,E=M,I=b,P=S,C=N;if(_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(d>>>14|M<<18)^(d>>>18|M<<14)^(M>>>9|d<<23),T=(M>>>14|d<<18)^(M>>>18|d<<14)^(d>>>9|M<<23),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=d&g^~d&m,T=M&b^~M&S,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=_D[me*2],T=_D[me*2+1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=t[me%16],T=e[me%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,B=j&65535|K<<16,X=Q&65535|H<<16,_=B,T=X,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(a>>>28|A<<4)^(A>>>2|a<<30)^(A>>>7|a<<25),T=(A>>>28|a<<4)^(a>>>2|A<<30)^(a>>>7|A<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=a&u^a&c^u&c,T=A&O^A&R^O&R,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,ue=j&65535|K<<16,C=Q&65535|H<<16,_=re,T=w,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=B,T=X,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,re=j&65535|K<<16,w=Q&65535|H<<16,u=ie,c=J,f=oe,d=re,g=se,m=U,y=fe,a=ue,O=de,R=ae,z=le,M=w,b=E,S=I,N=P,A=C,me%16===15)for(var ce=0;ce<16;ce++)_=t[ce],T=e[ce],Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=t[(ce+9)%16],T=e[(ce+9)%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+1)%16],X=e[(ce+1)%16],_=(B>>>1|X<<31)^(B>>>8|X<<24)^B>>>7,T=(X>>>1|B<<31)^(X>>>8|B<<24)^(X>>>7|B<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+14)%16],X=e[(ce+14)%16],_=(B>>>19|X<<13)^(X>>>29|B<<3)^B>>>6,T=(X>>>19|B<<13)^(B>>>29|X<<3)^(X>>>6|B<<26),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,t[ce]=j&65535|K<<16,e[ce]=Q&65535|H<<16}_=a,T=A,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[0],T=n[0],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[0]=a=j&65535|K<<16,n[0]=A=Q&65535|H<<16,_=u,T=O,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[1],T=n[1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[1]=u=j&65535|K<<16,n[1]=O=Q&65535|H<<16,_=c,T=R,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[2],T=n[2],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[2]=c=j&65535|K<<16,n[2]=R=Q&65535|H<<16,_=f,T=z,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[3],T=n[3],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[3]=f=j&65535|K<<16,n[3]=z=Q&65535|H<<16,_=d,T=M,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[4],T=n[4],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[4]=d=j&65535|K<<16,n[4]=M=Q&65535|H<<16,_=g,T=b,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[5],T=n[5],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[5]=g=j&65535|K<<16,n[5]=b=Q&65535|H<<16,_=m,T=S,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[6],T=n[6],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[6]=m=j&65535|K<<16,n[6]=S=Q&65535|H<<16,_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[7],T=n[7],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[7]=y=j&65535|K<<16,n[7]=N=Q&65535|H<<16,s+=128,o-=128}return s}function _9(t){var e=new SD;e.update(t);var r=e.digest();return e.clean(),r}ni.hash=_9});var VD=v(ke=>{"use strict";l();Object.defineProperty(ke,"__esModule",{value:!0});ke.convertSecretKeyToX25519=ke.convertPublicKeyToX25519=ke.verify=ke.sign=ke.extractPublicKeyFromSecretKey=ke.generateKeyPair=ke.generateKeyPairFromSeed=ke.SEED_LENGTH=ke.SECRET_KEY_LENGTH=ke.PUBLIC_KEY_LENGTH=ke.SIGNATURE_LENGTH=void 0;var S9=cl(),ll=TD(),DD=Hr();ke.SIGNATURE_LENGTH=64;ke.PUBLIC_KEY_LENGTH=32;ke.SECRET_KEY_LENGTH=64;ke.SEED_LENGTH=32;function Te(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,PD(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 RD(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function ND(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return fl(r,t),fl(n,e),RD(r,n)}function BD(t){let e=new Uint8Array(32);return fl(e,t),e[0]&1}function O9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function eo(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ro(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $e(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,A=0,O=0,R=0,z=0,M=0,b=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],E=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*E,A+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,b+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,A+=n*E,O+=n*I,R+=n*P,z+=n*C,M+=n*D,b+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,A+=n*w,O+=n*E,R+=n*I,z+=n*P,M+=n*C,b+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,A+=n*le,O+=n*w,R+=n*E,z+=n*I,M+=n*P,b+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,A+=n*ae,O+=n*le,R+=n*w,z+=n*E,M+=n*I,b+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,A+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*E,b+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,A+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,b+=n*E,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,A+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,b+=n*w,S+=n*E,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,A+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,b+=n*le,S+=n*w,N+=n*E,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,A+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,b+=n*ae,S+=n*le,N+=n*w,_+=n*E,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],A+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,b+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*E,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,b+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*E,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,b+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*E,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,b+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*E,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,b+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*E,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],b+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*E,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,A+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=A,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=b}function to(t,e){$e(t,e,e)}function LD(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)to(r,r),n!==2&&n!==4&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function D9(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)to(r,r),n!==1&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function z1(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te(),c=Te(),f=Te();ro(r,t[1],t[0]),ro(f,e[1],e[0]),$e(r,r,f),eo(n,t[0],t[1]),eo(f,e[0],e[1]),$e(n,n,f),$e(i,t[3],e[3]),$e(i,i,x9),$e(s,t[2],e[2]),eo(s,s,s),ro(o,n,r),ro(a,s,i),eo(u,s,i),eo(c,n,r),$e(t[0],o,a),$e(t[1],c,u),$e(t[2],u,a),$e(t[3],o,c)}function OD(t,e,r){for(let n=0;n<4;n++)PD(t[n],e[n],r)}function $1(t,e){let r=Te(),n=Te(),i=Te();LD(i,e[2]),$e(r,e[0],i),$e(n,e[1],i),fl(t,n),t[31]^=BD(r)<<7}function FD(t,e,r){zi(t[0],Q1),zi(t[1],Va),zi(t[2],Va),zi(t[3],Q1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;OD(t,e,i),z1(e,t),z1(t,t),OD(t,e,i)}}function K1(t,e){let r=[Te(),Te(),Te(),Te()];zi(r[0],CD),zi(r[1],xD),zi(r[2],Va),$e(r[3],CD,xD),FD(t,r,e)}function MD(t){if(t.length!==ke.SEED_LENGTH)throw new Error(`ed25519: seed must be ${ke.SEED_LENGTH} bytes`);let e=(0,ll.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Te(),Te(),Te(),Te()];K1(n,e),$1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}ke.generateKeyPairFromSeed=MD;function P9(t){let e=(0,S9.randomBytes)(32,t),r=MD(e);return(0,DD.wipe)(e),r}ke.generateKeyPair=P9;function R9(t){if(t.length!==ke.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${ke.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}ke.extractPublicKeyFromSecretKey=R9;var j1=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 UD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*j1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*j1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function W1(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;UD(t,e)}function B9(t,e){let r=new Float64Array(64),n=[Te(),Te(),Te(),Te()],i=(0,ll.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 ll.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),W1(a),K1(n,a),$1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();W1(u);for(let c=0;c<32;c++)r[c]=a[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=u[c]*i[f];return UD(s.subarray(32),r),s}ke.sign=B9;function qD(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te();return zi(t[2],Va),O9(t[1],e),to(i,t[1]),$e(s,i,C9),ro(i,i,t[2]),eo(s,t[2],s),to(o,s),to(a,o),$e(u,a,o),$e(r,u,i),$e(r,r,s),D9(r,r),$e(r,r,i),$e(r,r,s),$e(r,r,s),$e(t[0],r,s),to(n,t[0]),$e(n,n,s),ND(n,i)&&$e(t[0],t[0],N9),to(n,t[0]),$e(n,n,s),ND(n,i)?-1:(BD(t[0])===e[31]>>7&&ro(t[0],Q1,t[0]),$e(t[3],t[0],t[1]),0)}function L9(t,e,r){let n=new Uint8Array(32),i=[Te(),Te(),Te(),Te()],s=[Te(),Te(),Te(),Te()];if(r.length!==ke.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${ke.SIGNATURE_LENGTH} bytes`);if(qD(s,t))return!1;let o=new ll.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return W1(a),FD(i,s,a),K1(s,r.subarray(32)),z1(i,s),$1(n,i),!RD(r,n)}ke.verify=L9;function F9(t){let e=[Te(),Te(),Te(),Te()];if(qD(e,t))throw new Error("Ed25519: invalid public key");let r=Te(),n=Te(),i=e[1];eo(r,Va,i),ro(n,Va,i),LD(n,n),$e(r,r,n);let s=new Uint8Array(32);return fl(s,r),s}ke.convertPublicKeyToX25519=F9;function M9(t){let e=(0,ll.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,DD.wipe)(e),r}ke.convertSecretKeyToX25519=M9});var hp,pp,no,Ha,gp,dl,yp,mp,wp,ka,Ep,vp,HD,kD,Ap=he(()=>{l();hp="EdDSA",pp="JWT",no=".",Ha="base64url",gp="utf8",dl="utf8",yp=":",mp="did",wp="key",ka="base58btc",Ep="z",vp="K36",HD=32,kD=32});function Wi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var hl=he(()=>{l()});function Ga(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Wi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var bp=he(()=>{l();hl()});function Ip(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ga(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Wi(r)}var Y1=he(()=>{l();bp();hl()});function U9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,b=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,b[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&b[T]===0;)T++;for(var B=u.repeat(A);T>>0,M=new Uint8Array(z);y[A];){var b=r[y.charCodeAt(A)];if(b===255)return;for(var S=0,N=z-1;(b!==0||S>>0,M[N]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");R=S,A++}if(y[A]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var A=g(y);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var q9,V9,GD,jD=he(()=>{l();q9=U9,V9=q9,GD=V9});var nhe,QD,ii,zD,WD,$i=he(()=>{l();nhe=new Uint8Array(0),QD=(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")},zD=t=>new TextEncoder().encode(t),WD=t=>new TextDecoder().decode(t)});var J1,X1,Z1,KD,eA,ja,Ki,H9,k9,yt,tn=he(()=>{l();jD();$i();J1=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")}},X1=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 KD(this,e)}},Z1=class{constructor(e){this.decoders=e}or(e){return KD(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`)}},KD=(t,e)=>new Z1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),eA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new J1(e,r,n),this.decoder=new X1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ja=({name:t,prefix:e,encode:r,decode:n})=>new eA(t,e,r,n),Ki=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=GD(r,e);return ja({prefix:t,name:e,encode:n,decode:s=>ii(i(s))})},H9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},k9=(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<ja({prefix:e,name:t,encode(i){return k9(i,n,r)},decode(i){return H9(i,n,r,t)}})});var tA={};ft(tA,{identity:()=>G9});var G9,YD=he(()=>{l();tn();$i();G9=ja({prefix:"\0",name:"identity",encode:t=>WD(t),decode:t=>zD(t)})});var rA={};ft(rA,{base2:()=>j9});var j9,JD=he(()=>{l();tn();j9=yt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var nA={};ft(nA,{base8:()=>Q9});var Q9,XD=he(()=>{l();tn();Q9=yt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var iA={};ft(iA,{base10:()=>z9});var z9,ZD=he(()=>{l();tn();z9=Ki({prefix:"9",name:"base10",alphabet:"0123456789"})});var sA={};ft(sA,{base16:()=>W9,base16upper:()=>$9});var W9,$9,eP=he(()=>{l();tn();W9=yt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$9=yt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var oA={};ft(oA,{base32:()=>Qa,base32hex:()=>X9,base32hexpad:()=>ez,base32hexpadupper:()=>tz,base32hexupper:()=>Z9,base32pad:()=>Y9,base32padupper:()=>J9,base32upper:()=>K9,base32z:()=>rz});var Qa,K9,Y9,J9,X9,Z9,ez,tz,rz,aA=he(()=>{l();tn();Qa=yt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),K9=yt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Y9=yt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),J9=yt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),X9=yt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Z9=yt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ez=yt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),tz=yt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rz=yt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var uA={};ft(uA,{base36:()=>nz,base36upper:()=>iz});var nz,iz,tP=he(()=>{l();tn();nz=Ki({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),iz=Ki({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var cA={};ft(cA,{base58btc:()=>Nn,base58flickr:()=>sz});var Nn,sz,lA=he(()=>{l();tn();Nn=Ki({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),sz=Ki({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var fA={};ft(fA,{base64:()=>oz,base64pad:()=>az,base64url:()=>uz,base64urlpad:()=>cz});var oz,az,uz,cz,rP=he(()=>{l();tn();oz=yt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),az=yt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),uz=yt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),cz=yt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var dA={};ft(dA,{base256emoji:()=>pz});function dz(t){return t.reduce((e,r)=>(e+=lz[r],e),"")}function hz(t){let e=[];for(let r of t){let n=fz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var nP,lz,fz,pz,iP=he(()=>{l();tn();nP=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}"),lz=nP.reduce((t,e,r)=>(t[r]=e,t),[]),fz=nP.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);pz=ja({prefix:"\u{1F680}",name:"base256emoji",encode:dz,decode:hz})});function aP(t,e,r){e=e||[],r=r||0;for(var n=r;t>=wz;)e[r++]=t&255|sP,t/=128;for(;t&mz;)e[r++]=t&255|sP,t>>>=7;return e[r]=t|0,aP.bytes=r-n+1,e}function hA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw hA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&oP)<=vz);return hA.bytes=s-n,r}var gz,sP,yz,mz,wz,Ez,vz,oP,Az,bz,Iz,_z,Sz,Tz,Cz,xz,Nz,Oz,Dz,Pz,pl,uP=he(()=>{l();gz=aP,sP=128,yz=127,mz=~yz,wz=Math.pow(2,31);Ez=hA,vz=128,oP=127;Az=Math.pow(2,7),bz=Math.pow(2,14),Iz=Math.pow(2,21),_z=Math.pow(2,28),Sz=Math.pow(2,35),Tz=Math.pow(2,42),Cz=Math.pow(2,49),xz=Math.pow(2,56),Nz=Math.pow(2,63),Oz=function(t){return t{l();uP();gl=(t,e=0)=>[pl.decode(t,e),pl.decode.bytes],za=(t,e,r=0)=>(pl.encode(t,e,r),e),Wa=t=>pl.encodingLength(t)});var io,cP,lP,$a,ml=he(()=>{l();$i();Sp();io=(t,e)=>{let r=e.byteLength,n=Wa(t),i=n+Wa(r),s=new Uint8Array(i+r);return za(t,s,0),za(r,s,n),s.set(e,i),new $a(t,r,e,s)},cP=t=>{let e=ii(t),[r,n]=gl(e),[i,s]=gl(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new $a(r,i,o,e)},lP=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&QD(t.bytes,e.bytes),$a=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var gA,pA,yA=he(()=>{l();ml();gA=({name:t,code:e,encode:r})=>new pA(t,e,r),pA=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?io(this.code,r):r.then(n=>io(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var mA={};ft(mA,{sha256:()=>Rz,sha512:()=>Bz});var dP,Rz,Bz,hP=he(()=>{l();yA();dP=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Rz=gA({name:"sha2-256",code:18,encode:dP("SHA-256")}),Bz=gA({name:"sha2-512",code:19,encode:dP("SHA-512")})});var wA={};ft(wA,{identity:()=>Mz});var pP,Lz,gP,Fz,Mz,yP=he(()=>{l();$i();ml();pP=0,Lz="identity",gP=ii,Fz=t=>io(pP,gP(t)),Mz={code:pP,name:Lz,encode:gP,digest:Fz}});var mP=he(()=>{l();$i()});var Ghe,jhe,wP=he(()=>{l();Ghe=new TextEncoder,jhe=new TextDecoder});var xp,Vz,Hz,kz,wl,Gz,EP,vP,Tp,Cp,jz,Qz,zz,AP=he(()=>{l();Sp();ml();lA();aA();$i();xp=class t{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:Cp,byteLength:Cp,code:Tp,version:Tp,multihash:Tp,bytes:Tp,_baseCache:Cp,asCID:Cp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==wl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Gz)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=io(e,r);return t.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&&lP(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return Hz(r,i,e||Nn.encoder);default:return kz(r,i,e||Qa.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 Qz(/^0\.0/,zz),!!(e&&(e[vP]||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 t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||EP(r,n,i.bytes))}else if(e!=null&&e[vP]===!0){let{version:r,multihash:n,code:i}=e,s=cP(n);return t.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!==wl)throw new Error(`Version 0 CID must use dag-pb (code: ${wl}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=EP(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,wl,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=ii(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 $a(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,g]=gl(e.subarray(r));return r+=g,d},i=n(),s=wl;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(),c=r+u,f=c-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=Vz(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Vz=(t,e)=>{switch(t[0]){case"Q":{let r=e||Nn;return[Nn.prefix,r.decode(`${Nn.prefix}${t}`)]}case Nn.prefix:{let r=e||Nn;return[Nn.prefix,r.decode(t)]}case Qa.prefix:{let r=e||Qa;return[Qa.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)]}}},Hz=(t,e,r)=>{let{prefix:n}=r;if(n!==Nn.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},kz=(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},wl=112,Gz=18,EP=(t,e,r)=>{let n=Wa(t),i=n+Wa(e),s=new Uint8Array(i+r.byteLength);return za(t,s,0),za(e,s,n),s.set(r,i),s},vP=Symbol.for("@ipld/js-cid/CID"),Tp={writable:!1,configurable:!1,enumerable:!0},Cp={writable:!1,enumerable:!1,configurable:!1},jz="0.0.0-dev",Qz=(t,e)=>{if(t.test(jz))console.warn(e);else throw new Error(e)},zz=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};pe.ErrContractHasNoAddress=Sm;var Tm=class extends Pe{constructor(e){super(e)}};pe.ErrMock=Tm;var Cm=class extends Pe{constructor(e){super(e)}};pe.ErrTypingSystem=Cm;var xm=class extends Pe{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=xm;var Nm=class extends Pe{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=Nm;var Om=class extends Pe{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Om;var Dm=class extends Pe{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=Dm;var Pm=class extends Pe{constructor(e){super(e)}};pe.ErrCodec=Pm;var Rm=class extends Pe{constructor(e){super(e)}};pe.ErrContractInteraction=Rm;var Bm=class extends Pe{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Bm;var Lm=class extends Pe{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Lm;var Fm=class extends Pe{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=Fm;var Mm=class extends Pe{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=Mm;var Um=class extends Pe{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};pe.ErrIsCompletedFieldIsMissingOnTransaction=Um});var Vm=A(vi=>{"use strict";l();var g5=vi&&vi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vi,"__esModule",{value:!0});vi.TokenPayment=vi.TokenTransfer=void 0;var ju=g5(Yt()),y5=Le(),$S="EGLD",KS=18;ju.default.set({ROUNDING_MODE:1});var Tf=class t{constructor(e){let r=new ju.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new y5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new ju.default(e).shiftedBy(KS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:$S,nonce:0,amountAsBigInteger:e,numDecimals:KS})}static fungibleFromAmount(e,r,n){let i=new ju.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new ju.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({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==$S}isFungible(){return this.nonce==0}};vi.TokenTransfer=Tf;var qm=class extends Tf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};vi.TokenPayment=qm});var Os=A(Xe=>{"use strict";l();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ARGUMENTS_SEPARATOR=Xe.ESDT_TRANSFER_VALUE=Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_GAS_LIMIT=Xe.TRANSACTION_VERSION_WITH_OPTIONS=Xe.TRANSACTION_VERSION_DEFAULT=Xe.TRANSACTION_OPTIONS_TX_GUARDED=Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=Xe.TRANSACTION_OPTIONS_DEFAULT=Xe.TRANSACTION_MIN_GAS_PRICE=void 0;Xe.TRANSACTION_MIN_GAS_PRICE=1e9;Xe.TRANSACTION_OPTIONS_DEFAULT=0;Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;Xe.TRANSACTION_OPTIONS_TX_GUARDED=2;Xe.TRANSACTION_VERSION_DEFAULT=1;Xe.TRANSACTION_VERSION_WITH_OPTIONS=2;Xe.ESDT_TRANSFER_GAS_LIMIT=5e5;Xe.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";Xe.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";Xe.ESDT_TRANSFER_VALUE="0";Xe.ARGUMENTS_SEPARATOR="@"});var br=A(ot=>{"use strict";l();var m5=ot&&ot.__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]}),w5=ot&&ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E5=ot&&ot.__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 w5(e,t),e};Object.defineProperty(ot,"__esModule",{value:!0});ot.isEmpty=ot.guardEmpty=ot.guardNotEmpty=ot.guardLength=ot.guardSameLength=ot.guardValueIsSetWithMessage=ot.guardValueIsSet=ot.guardTrue=void 0;var Do=E5(Le());function v5(t,e){if(!t)throw new Do.ErrInvariantFailed(`[<${e}>] isn't true`)}ot.guardTrue=v5;function A5(t,e){YS(`${t} isn't set (null or undefined)`,e)}ot.guardValueIsSet=A5;function YS(t,e){if(e==null||e===void 0)throw new Do.ErrInvariantFailed(t)}ot.guardValueIsSetWithMessage=YS;function b5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Do.ErrInvariantFailed("arrays do not have the same length")}ot.guardSameLength=b5;function I5(t,e){let r=t.length||0;if(r!=e)throw new Do.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}ot.guardLength=I5;function _5(t,e){if(Hm(t))throw new Do.ErrInvariantFailed(`${e} is empty`)}ot.guardNotEmpty=_5;function S5(t,e){if(!Hm(t))throw new Do.ErrInvariantFailed(`${e} is not empty`)}ot.guardEmpty=S5;function Hm(t){return t.isEmpty?t.isEmpty():t.length===0}ot.isEmpty=Hm});var JS=A(Cf=>{"use strict";l();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.getJavascriptPrototypesInHierarchy=void 0;function T5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Cf.getJavascriptPrototypesInHierarchy=T5});var Ct=A(Tt=>{"use strict";l();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.NullType=Tt.TypePlaceholder=Tt.isTyped=Tt.PrimitiveValue=Tt.TypedValue=Tt.CustomType=Tt.PrimitiveType=Tt.TypeCardinality=Tt.Type=void 0;var km=JS(),XS=br(),Ai=class t{constructor(e,r=[],n=Qu.fixed(1)){XS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return km.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 XS.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 t.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(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return km.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(){}};Tt.Type=Ai;Ai.ClassName="Type";var Qu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(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||t.MaxCardinality}};Tt.TypeCardinality=Qu;Qu.MaxCardinality=4096;var xf=class t extends Ai{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveType=xf;xf.ClassName="PrimitiveType";var Nf=class t extends Ai{getClassName(){return t.ClassName}};Tt.CustomType=Nf;Nf.ClassName="CustomType";var zu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return km.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(){}};Tt.TypedValue=zu;zu.ClassName="TypedValue";var Of=class t extends zu{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveValue=Of;Of.ClassName="PrimitiveValue";function C5(t){return t.belongsToTypesystem!==void 0}Tt.isTyped=C5;var Df=class t extends Ai{constructor(){super("...")}getClassName(){return t.ClassName}};Tt.TypePlaceholder=Df;Df.ClassName="TypePlaceholder";var Pf=class t extends Ai{constructor(){super("?")}getClassName(){return t.ClassName}};Tt.NullType=Pf;Pf.ClassName="NullType"});var ZS=A((Po,Ro)=>{l();(function(t){var e=typeof Po=="object"&&Po&&!Po.nodeType&&Po,r=typeof Ro=="object"&&Ro&&!Ro.nodeType&&Ro,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,c=38,f=700,d=72,g=128,m="-",y=/^xn--/,b=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=o-a,M=Math.floor,E=String.fromCharCode,S;function N(J){throw new RangeError(R[J])}function _(J,oe){for(var re=J.length,se=[];re--;)se[re]=oe(J[re]);return se}function T(J,oe){var re=J.split("@"),se="";re.length>1&&(se=re[0]+"@",J=re[1]),J=J.replace(O,".");var U=J.split("."),fe=_(U,oe).join(".");return se+fe}function B(J){for(var oe=[],re=0,se=J.length,U,fe;re=55296&&U<=56319&&re65535&&(oe-=65536,re+=E(oe>>>10&1023|55296),oe=56320|oe&1023),re+=E(oe),re}).join("")}function Q(J){return J-48<10?J-22:J-65<26?J-65:J-97<26?J-97:o}function H(J,oe){return J+22+75*(J<26)-((oe!=0)<<5)}function j(J,oe,re){var se=0;for(J=re?M(J/f):J>>1,J+=M(J/oe);J>z*u>>1;se+=o)J=M(J/z);return M(se+(z+1)*J/(J+c))}function K(J){var oe=[],re=J.length,se,U=0,fe=g,ue=d,de,ae,le,w,v,I,P,C,D;for(de=J.lastIndexOf(m),de<0&&(de=0),ae=0;ae=128&&N("not-basic"),oe.push(J.charCodeAt(ae));for(le=de>0?de+1:0;le=re&&N("invalid-input"),P=Q(J.charCodeAt(le++)),(P>=o||P>M((s-U)/v))&&N("overflow"),U+=P*v,C=I<=ue?a:I>=ue+u?u:I-ue,!(PM(s/D)&&N("overflow"),v*=D;se=oe.length+1,ue=j(U-w,se,w==0),M(U/se)>s-fe&&N("overflow"),fe+=M(U/se),U%=se,oe.splice(U++,0,fe)}return X(oe)}function me(J){var oe,re,se,U,fe,ue,de,ae,le,w,v,I=[],P,C,D,L;for(J=B(J),P=J.length,oe=g,re=0,fe=d,ue=0;ue=oe&&vM((s-re)/C)&&N("overflow"),re+=(de-oe)*C,oe=de,ue=0;ues&&N("overflow"),v==oe){for(ae=re,le=o;w=le<=fe?a:le>=fe+u?u:le-fe,!(ae{"use strict";l();var tT=ZS();function x5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Gm(t){return t>="0"&&t<="7"}function N5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function eT(t){return t=parseInt(t,16),tT.ucs2.encode([t])}function rT(t,e,r){var n=!1,i=[];function s(u){var c=t[u];if(!N5(c))throw new x5(u,"Unexpected token ILLEGAL");return c}for(;e{l();var oT=nT();cT.exports={validate:O5,parse:D5};function O5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Rf(t,0,e,!1)}catch(n){r=n.message}return r}function D5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Rf(t,0,e,!0);return r.value}function aT(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function L5(t,e,r,n){for(var i=e,s=",",o=[],a=e;Ds(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Rf(t,i,r,n),c=aT(t,u.end);n&&o.push(u.value),i=c.end,s=c.value}return{start:e,end:i,value:o}}function F5(t,e){return t.substr(e,4)==="true"}function M5(t,e){return t.substr(e,5)==="false"}function U5(t,e){return t.substr(e,4)==="null"}var q5=new RegExp(/^\s$/);function Ds(t){return q5.test(t)}var V5=new RegExp(/^\d$/);function iT(t){return V5.test(t)}function Kn(t,e,r){var n=10,i;t.length{"use strict";l();var H5=cn&&cn.__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=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G5=cn&&cn.__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 k5(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.TypeExpressionParser=void 0;var fT=G5(Le()),j5=Ct(),Q5=lT(),Qm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new fT.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return Q5.parse(r)}catch{throw new fT.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 j5.Type(e,n)}};cn.TypeExpressionParser=Qm});var Wm=A(bi=>{"use strict";l();Object.defineProperty(bi,"__esModule",{value:!0});bi.EndpointParameterDefinition=bi.EndpointModifiers=bi.EndpointDefinition=void 0;var z5=Wu(),dT="?",W5="N / A",zm=class t{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?dT:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>$u.fromJSON(s)),n=e.outputs.map(s=>$u.fromJSON(s)),i=new Bf(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};bi.EndpointDefinition=zm;var Bf=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}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"}isOnlyOwner(){return this.onlyOwner}};bi.EndpointModifiers=Bf;var $u=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new z5.TypeExpressionParser().parse(e.type);return new t(e.name||dT,e.description||W5,r)}};bi.EndpointParameterDefinition=$u});var Bo=A(fr=>{"use strict";l();var $5=fr&&fr.__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=fr&&fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y5=fr&&fr.__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)&&$5(e,t,r);return K5(e,t),e};Object.defineProperty(fr,"__esModule",{value:!0});fr.Fields=fr.Field=fr.FieldDefinition=void 0;var $m=Y5(Le()),J5=Wu(),Km=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new J5.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};fr.FieldDefinition=Km;var Ym=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new $m.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new $m.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};fr.Field=Ym;var Jm=class{static checkTyping(e,r){if(e.length!=r.length)throw new $m.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";l();Object.defineProperty(Ii,"__esModule",{value:!0});Ii.EnumValue=Ii.EnumVariantDefinition=Ii.EnumType=void 0;var X5=Le(),Xm=br(),Lf=Bo(),pT=Ct(),hT=256,Ff=class t extends pT.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>Mf.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>Object.assign(Object.assign({},n),{discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Xm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Xm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};Ii.EnumType=Ff;Ff.ClassName="EnumType";var Mf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Xm.guardTrue(rLf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Lf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ii.EnumVariantDefinition=Mf;var Uf=class t extends pT.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();Lf.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(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=Lf.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 X5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};Ii.EnumValue=Uf;Uf.ClassName="EnumValue"});var yT=A(Lo=>{"use strict";l();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.EventTopicDefinition=Lo.EventDefinition=void 0;var Z5=Wu(),gT="?",Zm=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?gT:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>qf.fromJSON(n));return new t(e.identifier,r)}};Lo.EventDefinition=Zm;var qf=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new Z5.TypeExpressionParser().parse(e.type);return new t({name:e.name||gT,type:r,indexed:e.indexed})}};Lo.EventTopicDefinition=qf});var Mo=A(Fo=>{"use strict";l();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Struct=Fo.StructType=void 0;var eq=Le(),Vf=Bo(),mT=Ct(),Hf=class t extends mT.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Vf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Vf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Fo.StructType=Hf;Hf.ClassName="StructType";var kf=class t extends mT.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Vf.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 eq.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 Vf.Fields.equals(r,n)}};Fo.Struct=kf;kf.ClassName="Struct"});var tw=A((Coe,vT)=>{"use strict";l();var jf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ew={};for(Yu=0;Yu>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 wT(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Uo(e)^n>>5}for(e=Uo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=wT(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=Uo(n)^o,i+=jf.charAt(o)}for(s=0;s<6;++s)n=Uo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=jf.charAt(a)}return i}function ET(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=wT(s);if(typeof a=="string")return a;for(var u=[],c=0;c=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function rq(){var t=ET.apply(null,arguments);if(typeof t=="object")return t}function nq(t){var e=ET.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Qf(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";l();var uq=ln&&ln.__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]}),cq=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AT=ln&&ln.__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)&&uq(e,t,r);return cq(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.Address=void 0;var qo=AT(tw()),Vo=AT(Le()),zf="erd",Wf=32,lq="0".repeat(16),rw=class t{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 Vo.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!=Wf)throw new Vo.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==Wf}static fromHex(e){if(!t.isValidHex(e))throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=qo.decode(e)}catch(s){throw new Vo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=zf)throw new Vo.ErrAddressBadHrp(zf,n);let i=h.Buffer.from(qo.fromWords(r.words));if(i.length!=Wf)throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}static isValid(e){let r=qo.decodeUnsafe(e),n=r?.prefix,i=r?h.Buffer.from(qo.fromWords(r.words)):void 0;return!(n!==zf||i?.length!==Wf)}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=qo.toWords(this.pubkey());return qo.encode(zf,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(lq)}};ln.Address=rw});var ko=A(Ho=>{"use strict";l();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.AddressValue=Ho.AddressType=void 0;var fq=pt(),bT=Ct(),Ju=class t extends bT.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Ho.AddressType=Ju;Ju.ClassName="AddressType";var $f=class t extends bT.PrimitiveValue{constructor(e){super(new Ju),this.value=new fq.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ho.AddressValue=$f;$f.ClassName="AddressValue"});var Yf=A(Go=>{"use strict";l();Object.defineProperty(Go,"__esModule",{value:!0});Go.OptionalValue=Go.OptionalType=void 0;var dq=br(),Xu=Ct(),Zu=class t extends Xu.Type{constructor(e){super("Optional",[e],Xu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Xu.NullType.ClassName);return r||n}};Go.OptionalType=Zu;Zu.ClassName="OptionalType";var Kf=class t extends Xu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Zu(new Xu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return dq.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}};Go.OptionalValue=Kf;Kf.ClassName="OptionalValue"});var tc=A(jo=>{"use strict";l();Object.defineProperty(jo,"__esModule",{value:!0});jo.BooleanValue=jo.BooleanType=void 0;var IT=Ct(),ec=class t extends IT.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};jo.BooleanType=ec;ec.ClassName="BooleanType";var Jf=class t extends IT.PrimitiveValue{constructor(e){super(new ec),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};jo.BooleanValue=Jf;Jf.ClassName="BooleanValue"});var _i=A(Qo=>{"use strict";l();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.BytesValue=Qo.BytesType=void 0;var _T=Ct(),rc=class t extends _T.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Qo.BytesType=rc;rc.ClassName="BytesType";var Xf=class t extends _T.PrimitiveValue{constructor(e){super(new rc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new t(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()}};Qo.BytesValue=Xf;Xf.ClassName="BytesValue"});var TT=A(zo=>{"use strict";l();Object.defineProperty(zo,"__esModule",{value:!0});zo.CodeMetadataValue=zo.CodeMetadataType=void 0;var ST=Ct(),Zf=class extends ST.PrimitiveType{constructor(){super("CodeMetadata")}};zo.CodeMetadataType=Zf;var nw=class extends ST.PrimitiveValue{constructor(e){super(new Zf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};zo.CodeMetadataValue=nw});var td=A(Wo=>{"use strict";l();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.CompositeValue=Wo.CompositeType=void 0;var hq=br(),iw=Ct(),nc=class t extends iw.Type{constructor(...e){super("Composite",e,iw.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Wo.CompositeType=nc;nc.ClassName="CompositeType";var ed=class t extends iw.TypedValue{constructor(e,r){super(e),hq.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new nc(...r);return new t(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";l();Object.defineProperty(rd,"__esModule",{value:!0});rd.CollectionOfTypedValues=void 0;var sw=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";l();Object.defineProperty(fn,"__esModule",{value:!0});fn.List=fn.OptionValue=fn.ListType=fn.OptionType=void 0;var pq=br(),gq=ow(),Rs=Ct(),Ps=class t extends Rs.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Rs.NullType.ClassName);return r||n}};fn.OptionType=Ps;Ps.ClassName="OptionType";var ic=class t extends Rs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};fn.ListType=ic;ic.ClassName="ListType";var nd=class t extends Rs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Ps(new Rs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Ps(e))}static newProvided(e){let r=new Ps(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return pq.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}};fn.OptionValue=nd;nd.ClassName="OptionValue";var id=class t extends Rs.TypedValue{constructor(e,r){super(e),this.backingCollection=new gq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Rs.TypePlaceholder,[]);let r=e[0].getType(),n=new ic(r);return new t(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)}};fn.List=id;id.ClassName="List"});var ad=A($o=>{"use strict";l();Object.defineProperty($o,"__esModule",{value:!0});$o.ArrayVec=$o.ArrayVecType=void 0;var CT=br(),yq=ow(),xT=Ct(),sd=class t extends xT.Type{constructor(e,r){super("Array",[r]),CT.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};$o.ArrayVecType=sd;sd.ClassName="ArrayVecType";var od=class t extends xT.TypedValue{constructor(e,r){super(e),CT.guardLength(r,e.length),this.backingCollection=new yq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};$o.ArrayVec=od;od.ClassName="ArrayVec"});var ac=A(Ko=>{"use strict";l();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.H256Value=Ko.H256Type=void 0;var NT=Ct(),oc=class t extends NT.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Ko.H256Type=oc;oc.ClassName="H256Type";var ud=class t extends NT.PrimitiveValue{constructor(e){super(new oc),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ko.H256Value=ud;ud.ClassName="H256Value"});var ld=A(Yo=>{"use strict";l();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.NothingValue=Yo.NothingType=void 0;var OT=Ct(),uc=class t extends OT.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Yo.NothingType=uc;uc.ClassName="NothingType";var cd=class t extends OT.PrimitiveValue{constructor(){super(new uc)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Yo.NothingValue=cd;cd.ClassName="NothingValue"});var Ec=A(Ce=>{"use strict";l();var mq=Ce&&Ce.__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]}),wq=Ce&&Ce.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eq=Ce&&Ce.__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)&&mq(e,t,r);return wq(e,t),e},vq=Ce&&Ce.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.BigIntValue=Ce.BigUIntValue=Ce.I64Value=Ce.U64Value=Ce.I32Value=Ce.U32Value=Ce.I16Value=Ce.U16Value=Ce.I8Value=Ce.U8Value=Ce.NumericalValue=Ce.BigIntType=Ce.BigUIntType=Ce.I64Type=Ce.U64Type=Ce.I32Type=Ce.U32Type=Ce.I16Type=Ce.U16Type=Ce.I8Type=Ce.U8Type=Ce.NumericalType=void 0;var DT=Eq(Le()),PT=Ct(),Bs=vq(Yt()),dr=class t extends PT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ce.NumericalType=dr;dr.ClassName="NumericalType";var cc=class t extends dr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ce.U8Type=cc;cc.ClassName="U8Type";var lc=class t extends dr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ce.I8Type=lc;lc.ClassName="I8Type";var fc=class t extends dr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ce.U16Type=fc;fc.ClassName="U16Type";var dc=class t extends dr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ce.I16Type=dc;dc.ClassName="I16Type";var hc=class t extends dr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ce.U32Type=hc;hc.ClassName="U32Type";var pc=class t extends dr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ce.I32Type=pc;pc.ClassName="I32Type";var gc=class t extends dr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ce.U64Type=gc;gc.ClassName="U64Type";var yc=class t extends dr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ce.I64Type=yc;yc.ClassName="I64Type";var mc=class t extends dr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ce.BigUIntType=mc;mc.ClassName="BigUIntType";var wc=class t extends dr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ce.BigIntType=wc;wc.ClassName="BigIntType";var hr=class t extends PT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Bs.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new DT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new DT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ce.NumericalValue=hr;hr.ClassName="NumericalValue";var fd=class t extends hr{constructor(e){super(new cc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U8Value=fd;fd.ClassName="U8Value";var dd=class t extends hr{constructor(e){super(new lc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I8Value=dd;dd.ClassName="I8Value";var hd=class t extends hr{constructor(e){super(new fc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U16Value=hd;hd.ClassName="U16Value";var pd=class t extends hr{constructor(e){super(new dc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I16Value=pd;pd.ClassName="I16Value";var gd=class t extends hr{constructor(e){super(new hc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U32Value=gd;gd.ClassName="U32Value";var yd=class t extends hr{constructor(e){super(new pc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I32Value=yd;yd.ClassName="I32Value";var md=class t extends hr{constructor(e){super(new gc,e)}getClassName(){return t.ClassName}};Ce.U64Value=md;md.ClassName="U64Value";var wd=class t extends hr{constructor(e){super(new yc,e)}getClassName(){return t.ClassName}};Ce.I64Value=wd;wd.ClassName="I64Value";var Ed=class t extends hr{constructor(e){super(new mc,e)}getClassName(){return t.ClassName}};Ce.BigUIntValue=Ed;Ed.ClassName="BigUIntValue";var vd=class t extends hr{constructor(e){super(new wc,e)}getClassName(){return t.ClassName}};Ce.BigIntValue=vd;vd.ClassName="BigIntValue"});var bd=A(Jo=>{"use strict";l();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.StringValue=Jo.StringType=void 0;var RT=Ct(),vc=class t extends RT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Jo.StringType=vc;vc.ClassName="StringType";var Ad=class t extends RT.PrimitiveValue{constructor(e){super(new vc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Jo.StringValue=Ad;Ad.ClassName="StringValue"});var Zo=A(Xo=>{"use strict";l();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.TokenIdentifierValue=Xo.TokenIdentifierType=void 0;var BT=Ct(),Aq="EGLD",Ac=class t extends BT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Xo.TokenIdentifierType=Ac;Ac.ClassName="TokenIdentifierType";var Id=class t extends BT.PrimitiveValue{constructor(e){super(new Ac),this.value=e}static egld(){return new t(Aq)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.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()}};Xo.TokenIdentifierValue=Id;Id.ClassName="TokenIdentifierValue"});var Sd=A(Cr=>{"use strict";l();var bq=Cr&&Cr.__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]}),Iq=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_q=Cr&&Cr.__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)&&bq(e,t,r);return Iq(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Tuple=Cr.TupleType=void 0;var Sq=_q(Le()),LT=Bo(),FT=Mo(),bc=class t extends FT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new LT.FieldDefinition(MT(i),"anonymous tuple field",n))}};Cr.TupleType=bc;bc.ClassName="TupleType";function MT(t){return`field${t}`}var _d=class t extends FT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new Sq.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new bc(...r),i=e.map((s,o)=>new LT.Field(s,MT(o)));return new t(n,i)}};Cr.Tuple=_d;_d.ClassName="Tuple"});var xd=A(Si=>{"use strict";l();Object.defineProperty(Si,"__esModule",{value:!0});Si.VariadicValue=Si.CountedVariadicType=Si.VariadicType=void 0;var ea=Ct(),Ls=class t extends ea.Type{constructor(e,r=!1){super("Variadic",[e],ea.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};Si.VariadicType=Ls;Ls.ClassName="VariadicType";var Td=class extends ea.Type{constructor(e){super("Variadic",[e],ea.TypeCardinality.variable())}getClassName(){return Ls.ClassName}};Si.CountedVariadicType=Td;Td.ClassName="VariadicType";var Cd=class t extends ea.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Ls(new ea.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Ls(n,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";l();var Tq=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]}),Cq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xq=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)&&Tq(e,t,r);return Cq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.TypeMapper=void 0;var UT=xq(Le()),Nq=ko(),aw=Yf(),Oq=tc(),Dq=_i(),Pq=TT(),Nd=td(),uw=Ku(),Rq=Bo(),qT=sc(),dn=ad(),Bq=ac(),VT=ld(),xr=Ec(),Lq=bd(),HT=Mo(),kT=Zo(),Ti=Sd(),Od=xd(),cw=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new qT.OptionType(r[0])],["List",(...r)=>new qT.ListType(r[0])],["VarArgs",(...r)=>new Od.VariadicType(r[0])],["MultiResultVec",(...r)=>new Od.VariadicType(r[0])],["variadic",(...r)=>new Od.VariadicType(r[0])],["counted-variadic",(...r)=>new Od.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new aw.OptionalType(r[0])],["optional",(...r)=>new aw.OptionalType(r[0])],["OptionalResult",(...r)=>new aw.OptionalType(r[0])],["multi",(...r)=>new Nd.CompositeType(...r)],["MultiArg",(...r)=>new Nd.CompositeType(...r)],["MultiResult",(...r)=>new Nd.CompositeType(...r)],["multi",(...r)=>new Nd.CompositeType(...r)],["tuple",(...r)=>new Ti.TupleType(...r)],["tuple2",(...r)=>new Ti.TupleType(...r)],["tuple3",(...r)=>new Ti.TupleType(...r)],["tuple4",(...r)=>new Ti.TupleType(...r)],["tuple5",(...r)=>new Ti.TupleType(...r)],["tuple6",(...r)=>new Ti.TupleType(...r)],["tuple7",(...r)=>new Ti.TupleType(...r)],["tuple8",(...r)=>new Ti.TupleType(...r)],["array2",(...r)=>new dn.ArrayVecType(2,r[0])],["array8",(...r)=>new dn.ArrayVecType(8,r[0])],["array16",(...r)=>new dn.ArrayVecType(16,r[0])],["array20",(...r)=>new dn.ArrayVecType(20,r[0])],["array32",(...r)=>new dn.ArrayVecType(32,r[0])],["array46",(...r)=>new dn.ArrayVecType(46,r[0])],["array48",(...r)=>new dn.ArrayVecType(48,r[0])],["array64",(...r)=>new dn.ArrayVecType(64,r[0])],["array128",(...r)=>new dn.ArrayVecType(128,r[0])],["array256",(...r)=>new dn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new xr.U8Type],["u16",new xr.U16Type],["u32",new xr.U32Type],["u64",new xr.U64Type],["U64",new xr.U64Type],["BigUint",new xr.BigUIntType],["i8",new xr.I8Type],["i16",new xr.I16Type],["i32",new xr.I32Type],["i64",new xr.I64Type],["Bigint",new xr.BigIntType],["BigInt",new xr.BigIntType],["bool",new Oq.BooleanType],["bytes",new Dq.BytesType],["Address",new Nq.AddressType],["H256",new Bq.H256Type],["utf-8 string",new Lq.StringType],["TokenIdentifier",new kT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new kT.TokenIdentifierType],["CodeMetadata",new Pq.CodeMetadataType],["nothing",new VT.NothingType],["AsyncCall",new VT.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 UT.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(uw.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(HT.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 HT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new uw.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new uw.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new Rq.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 UT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};hn.TypeMapper=cw});var WT=A(pn=>{"use strict";l();var Fq=pn&&pn.__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]}),Mq=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uq=pn&&pn.__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)&&Fq(e,t,r);return Mq(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.AbiRegistry=void 0;var GT=Uq(Le()),Ic=br(),_c=Wm(),jT=Ku(),fw=yT(),QT=Mo(),qq=lw(),Vq="?",dw=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||Vq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=e.events||[],a=_c.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),u=i.map(m=>_c.EndpointDefinition.fromJSON(m)),c=[];for(let m in s){let y=s[m];if(y.type=="struct")c.push(QT.StructType.fromJSON({name:m,fields:y.fields}));else if(y.type=="enum"||y.type=="explicit-enum")c.push(jT.EnumType.fromJSON({name:m,variants:y.variants}));else throw new GT.ErrTypingSystem(`Cannot handle custom type: ${m}`)}let f=o.map(m=>fw.EventDefinition.fromJSON(m));return new t({name:r,constructorDefinition:a,endpoints:u,customTypes:c,events:f}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Ic.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(QT.StructType.ClassName));return Ic.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(jT.EnumType.ClassName));return Ic.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 Ic.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Ic.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new qq.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new GT.ErrTypingSystem("Did not re-map all custom types");let n=zT(this.constructorDefinition,e),i=[];for(let a of this.endpoints)i.push(zT(a,e));let s=this.events.map(a=>Hq(a,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r,events:s})}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(c=>c.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};pn.AbiRegistry=dw;function zT(t,e){let r=t.input.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new _c.EndpointDefinition(t.name,r,n,t.modifiers)}function Hq(t,e){let r=t.inputs.map(n=>new fw.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new fw.EventDefinition(t.identifier,r)}});var KT=A(ta=>{"use strict";l();Object.defineProperty(ta,"__esModule",{value:!0});ta.createListOfTokenIdentifiers=ta.createListOfAddresses=void 0;var kq=ko(),$T=sc(),Gq=Zo();function jq(t){let e=t.map(n=>new kq.AddressValue(n));return $T.List.fromItems(e)}ta.createListOfAddresses=jq;function Qq(t){let e=t.map(n=>new Gq.TokenIdentifierValue(n));return $T.List.fromItems(e)}ta.createListOfTokenIdentifiers=Qq});var cC=A(Jt=>{"use strict";l();var zq=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]}),Wq=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$q=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)&&zq(e,t,r);return Wq(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.onPrimitiveTypeSelect=Jt.onPrimitiveValueSelect=Jt.onTypedValueSelect=Jt.onTypeSelect=void 0;var Pd=$q(Le()),YT=ko(),JT=tc(),XT=_i(),ZT=Ku(),Dd=sc(),eC=ac(),tC=Ec(),rC=ld(),nC=Mo(),iC=Zo(),sC=Sd(),oC=Ct(),aC=ad(),uC=bd();function Kq(t,e){if(t.hasExactClass(Dd.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Dd.ListType.ClassName))return e.onList();if(t.hasExactClass(aC.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(oC.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(nC.StructType.ClassName))return e.onStruct();if(t.hasExactClass(sC.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(ZT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't known: ${t}`)}Jt.onTypeSelect=Kq;function Yq(t,e){if(t.hasClassOrSuperclass(oC.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Dd.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Dd.List.ClassName))return e.onList();if(t.hasExactClass(aC.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(nC.Struct.ClassName))return e.onStruct();if(t.hasExactClass(sC.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(ZT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't typed: ${t}`)}Jt.onTypedValueSelect=Yq;function Jq(t,e){if(t.hasExactClass(JT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(YT.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(XT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(uC.StringValue.ClassName))return e.onString();if(t.hasExactClass(eC.H256Value.ClassName))return e.onH256();if(t.hasExactClass(iC.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(rC.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Jt.onPrimitiveValueSelect=Jq;function Xq(t,e){if(t.hasExactClass(JT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(YT.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(XT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(uC.StringType.ClassName))return e.onString();if(t.hasExactClass(eC.H256Type.ClassName))return e.onH256();if(t.hasExactClass(iC.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(rC.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Jt.onPrimitiveTypeSelect=Xq});var xt=A(He=>{"use strict";l();var Zq=He&&He.__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]}),at=He&&He.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Zq(e,t,r)};Object.defineProperty(He,"__esModule",{value:!0});at(WT(),He);at(ko(),He);at(Yf(),He);at(tc(),He);at(_i(),He);at(td(),He);at(Wm(),He);at(Ku(),He);at(KT(),He);at(Bo(),He);at(sc(),He);at(ad(),He);at(ac(),He);at(cC(),He);at(ld(),He);at(Ec(),He);at(bd(),He);at(Mo(),He);at(Zo(),He);at(Sd(),He);at(Wu(),He);at(lw(),He);at(Ct(),He);at(xd(),He)});var fC=A(gn=>{"use strict";l();var eV=gn&&gn.__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]}),tV=gn&&gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rV=gn&&gn.__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)&&eV(e,t,r);return tV(e,t),e};Object.defineProperty(gn,"__esModule",{value:!0});gn.OptionValueBinaryCodec=void 0;var lC=rV(Le()),Rd=xt(),hw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Rd.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new lC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Rd.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Rd.OptionValue(r);if(e[0]!=1)throw new lC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Rd.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([])}};gn.OptionValueBinaryCodec=hw});var dC=A(Bd=>{"use strict";l();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.AddressBinaryCodec=void 0;var nV=pt(),iV=xt(),pw=class{decodeNested(e){let r=e.slice(0,32),n=new nV.Address(r);return[new iV.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()}};Bd.AddressBinaryCodec=pw});var pC=A(yn=>{"use strict";l();var sV=yn&&yn.__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]}),oV=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aV=yn&&yn.__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)&&sV(e,t,r);return oV(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.BooleanBinaryCodec=void 0;var uV=aV(Le()),hC=xt(),Sc=class t{decodeNested(e){let r=e.readUInt8(0);return[new hC.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new uV.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new hC.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([])}};yn.BooleanBinaryCodec=Sc;Sc.TRUE=1;Sc.FALSE=0});var Fd=A(Ld=>{"use strict";l();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.SizeOfU32=void 0;Ld.SizeOfU32=4});var Md=A(mn=>{"use strict";l();var cV=mn&&mn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mn,"__esModule",{value:!0});mn.zeroPadStringIfOddLength=mn.isPaddedHex=mn.numberToPaddedHex=void 0;var lV=cV(Yt());function fV(t){let e=new lV.default(t).toString(16);return gC(e)}mn.numberToPaddedHex=fV;function dV(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}mn.isPaddedHex=dV;function gC(t){return t=t||"",t.length%2==1?"0"+t:t}mn.zeroPadStringIfOddLength=gC});var Tc=A(Nt=>{"use strict";l();var hV=Nt&&Nt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.prependByteToBuffer=Nt.flipBufferBitsInPlace=Nt.getHexMagnitudeOfBigInt=Nt.bigIntToBuffer=Nt.bufferToBigInt=Nt.cloneBuffer=Nt.isMsbZero=Nt.isMsbOne=void 0;var gw=hV(Yt()),pV=Md();function yC(t,e=0){return t[e]>>7==1}Nt.isMsbOne=yC;function gV(t,e=0){return!yC(t,e)}Nt.isMsbZero=gV;function yV(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Nt.cloneBuffer=yV;function mV(t){let e=t.toString("hex");return new gw.default(`0x${e}`,16)}Nt.bufferToBigInt=mV;function wV(t){let e=mC(t);return h.Buffer.from(e,"hex")}Nt.bigIntToBuffer=wV;function mC(t){return t=new gw.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new gw.default(-1))),pV.numberToPaddedHex(t)):""}Nt.getHexMagnitudeOfBigInt=mC;function EV(t){for(let e=0;e{"use strict";l();var AV=ra&&ra.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ra,"__esModule",{value:!0});ra.NumericalBinaryCodec=void 0;var Cc=AV(Yt()),yw=xt(),wC=Fd(),At=Tc(),mw=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=wC.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=At.cloneBuffer(e);if(e.length==0)return new yw.NumericalValue(r,new Cc.default(0));if(!r.withSign||At.isMsbZero(n)){let c=At.bufferToBigInt(n);return new yw.NumericalValue(r,c)}At.flipBufferBitsInPlace(n);let u=At.bufferToBigInt(n).multipliedBy(new Cc.default(-1)).minus(new Cc.default(1));return new yw.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(wC.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=At.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=At.bigIntToBuffer(e.value);At.isMsbOne(o)&&(o=At.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new Cc.default(1)),i=At.bigIntToBuffer(n);At.flipBufferBitsInPlace(i),At.isMsbZero(i)&&(i=At.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):At.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=At.bigIntToBuffer(e.value);return At.isMsbOne(i)&&(i=At.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Cc.default(1)),n=At.bigIntToBuffer(r);return At.flipBufferBitsInPlace(n),At.isMsbZero(n)&&(n=At.prependByteToBuffer(n,255)),n}};ra.NumericalBinaryCodec=mw});var vC=A(Ud=>{"use strict";l();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.H256BinaryCodec=void 0;var bV=ac(),ww=class{decodeNested(e){let r=e.slice(0,32);return[new bV.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Ud.H256BinaryCodec=ww});var Hd=A(Vd=>{"use strict";l();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.BytesBinaryCodec=void 0;var AC=_i(),qd=Fd(),Ew=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(qd.SizeOfU32,qd.SizeOfU32+r);return[new AC.BytesValue(n),qd.SizeOfU32+r]}decodeTopLevel(e){return new AC.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(qd.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Vd.BytesBinaryCodec=Ew});var IC=A(kd=>{"use strict";l();Object.defineProperty(kd,"__esModule",{value:!0});kd.TokenIdentifierCodec=void 0;var IV=_i(),bC=Zo(),_V=Hd(),vw=class{constructor(){this.bytesCodec=new _V.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new bC.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new bC.TokenIdentifierValue(r.toString())}encodeNested(e){let r=IV.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};kd.TokenIdentifierCodec=vw});var SC=A(Gd=>{"use strict";l();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.NothingCodec=void 0;var _C=xt(),Aw=class{decodeNested(){return[new _C.NothingValue,0]}decodeTopLevel(){return new _C.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Gd.NothingCodec=Aw});var CC=A(jd=>{"use strict";l();Object.defineProperty(jd,"__esModule",{value:!0});jd.StringBinaryCodec=void 0;var TC=xt(),SV=_i(),TV=Hd(),bw=class{constructor(){this.bytesBinaryCodec=new TV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new TC.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new TC.StringValue(e.toString())}encodeNested(e){let r=SV.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};jd.StringBinaryCodec=bw});var xC=A(zd=>{"use strict";l();Object.defineProperty(zd,"__esModule",{value:!0});zd.PrimitiveBinaryCodec=void 0;var Qd=xt(),CV=dC(),xV=pC(),NV=EC(),OV=vC(),DV=Hd(),PV=IC(),RV=SC(),BV=CC(),Iw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new xV.BooleanBinaryCodec,this.numericalCodec=new NV.NumericalBinaryCodec,this.addressCodec=new CV.AddressBinaryCodec,this.h256Codec=new OV.H256BinaryCodec,this.bytesCodec=new DV.BytesBinaryCodec,this.stringCodec=new BV.StringBinaryCodec,this.tokenIdentifierCodec=new PV.TokenIdentifierCodec,this.nothingCodec=new RV.NothingCodec}decodeNested(e,r){return Qd.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 Qd.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 Qd.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 Qd.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()})}};zd.PrimitiveBinaryCodec=Iw});var DC=A(Wd=>{"use strict";l();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.ListBinaryCodec=void 0;var NC=xt(),OC=Fd(),_w=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=OC.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 NC.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(OC.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)}};Wd.ListBinaryCodec=_w});var Tw=A($d=>{"use strict";l();Object.defineProperty($d,"__esModule",{value:!0});$d.FieldsBinaryCodec=void 0;var LV=xt(),Sw=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 LV.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)}};$d.FieldsBinaryCodec=Sw});var xw=A(Kd=>{"use strict";l();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.StructBinaryCodec=void 0;var FV=xt(),MV=Tw(),Cw=class{constructor(e){this.fieldsCodec=new MV.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 FV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Kd.StructBinaryCodec=Cw});var PC=A(Jd=>{"use strict";l();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.EnumBinaryCodec=void 0;var Yd=xt(),UV=Tw(),Nw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new UV.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 Yd.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Yd.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Yd.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 Yd.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};Jd.EnumBinaryCodec=Nw});var RC=A(Xd=>{"use strict";l();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TupleBinaryCodec=void 0;var qV=xw(),Ow=class{constructor(e){this.structCodec=new qV.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)}};Xd.TupleBinaryCodec=Ow});var BC=A(Zd=>{"use strict";l();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ArrayVecBinaryCodec=void 0;var VV=xt(),Dw=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";l();var HV=Nr&&Nr.__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]}),kV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GV=Nr&&Nr.__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)&&HV(e,t,r);return kV(e,t),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.BinaryCodecConstraints=Nr.BinaryCodec=void 0;var LC=GV(Le()),eh=xt(),FC=br(),jV=fC(),QV=xC(),zV=DC(),WV=xw(),$V=PC(),KV=RC(),YV=BC(),Pw=class{constructor(e=null){this.constraints=e||new th,this.optionCodec=new jV.OptionValueBinaryCodec(this),this.listCodec=new zV.ListBinaryCodec(this),this.arrayCodec=new YV.ArrayVecBinaryCodec(this),this.primitiveCodec=new QV.PrimitiveBinaryCodec(this),this.structCodec=new WV.StructBinaryCodec(this),this.tupleCodec=new KV.TupleBinaryCodec(this),this.enumCodec=new $V.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),eh.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]=eh.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 FC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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 FC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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)})}};Nr.BinaryCodec=Pw;var th=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new LC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new LC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Nr.BinaryCodecConstraints=th});var MC=A(Or=>{"use strict";l();var JV=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var XV=JV(Yt()),rh=xt(),ZV=Rw(),nh=new ZV.BinaryCodec;function eH(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=eH;function tH(t){return!!nh.decodeTopLevel(t,new rh.BooleanType).valueOf()}Or.decodeBool=tH;function rH(t){let e=nh.decodeTopLevel(t,new rh.BytesType);return String(e.valueOf())}Or.decodeString=rH;function nH(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return new XV.default(e.valueOf())}Or.decodeBigNumber=nH});var Bw=A(Ci=>{"use strict";l();var iH=Ci&&Ci.__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]}),UC=Ci&&Ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iH(e,t,r)};Object.defineProperty(Ci,"__esModule",{value:!0});UC(Rw(),Ci);UC(MC(),Ci)});var na=A(ih=>{"use strict";l();Object.defineProperty(ih,"__esModule",{value:!0});ih.ArgSerializer=void 0;var qC=Os(),sH=Bw(),VC=xt(),Lw=Yf(),Fw=td(),Mw=xd(),oH={codec:new sH.BinaryCodec},Uw=class{constructor(e){e=Object.assign(Object.assign({},oH),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(qC.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 d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(qC.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 o of e)i(o);function i(o){if(o.hasExactClass(Lw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(Mw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(Fw.CompositeValue.ClassName)){let u=o;for(let c of u.getItems())i(c);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new VC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};ih.ArgSerializer=Uw});var ah=A(oh=>{"use strict";l();Object.defineProperty(oh,"__esModule",{value:!0});oh.Compatibility=void 0;var aH=pt(),sh=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()==aH.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.`))}};oh.Compatibility=sh;sh.areWarningsEnabled=!0});var HC=A(wn=>{"use strict";l();var uH=wn&&wn.__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]}),cH=wn&&wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lH=wn&&wn.__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)&&uH(e,t,r);return cH(e,t),e};Object.defineProperty(wn,"__esModule",{value:!0});wn.Hash=void 0;var fH=lH(Le()),qw=class t{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 fH.ErrBadType("hash","buffer | string",e)}static empty(){return new t(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};wn.Hash=qw});var xc=A(Dr=>{"use strict";l();var dH=Dr&&Dr.__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]}),hH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pH=Dr&&Dr.__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)&&dH(e,t,r);return hH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionOptions=Dr.TransactionVersion=void 0;var Wr=Os(),kC=pH(Le()),Vw=class t{constructor(e){if(e=Number(e),e<1)throw new kC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Wr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Wr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Dr.TransactionVersion=Vw;var Hw=class t{constructor(e){if(e=Number(e),e<0)throw new kC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Wr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Wr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_GUARDED)==Wr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Wr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dr.TransactionOptions=Hw});var jC=A((mue,GC)=>{"use strict";l();GC.exports=gH;function gH(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";l();var uh=WC;uh.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 ia=new Array(64),zC=new Array(123);for($r=0;$r<64;)zC[ia[$r]=$r<26?$r+65:$r<52?$r+71:$r<62?$r-4:$r-59|43]=$r++;var $r;uh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=ia[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=ia[u|c>>6],s[o++]=ia[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ia[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 QC="invalid encoding";uh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=zC[u])===void 0)throw Error(QC);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(QC);return n-i};uh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var YC=A((Aue,KC)=>{"use strict";l();KC.exports=ch;function ch(){this._listeners={}}ch.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};ch.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";l();rx.exports=JC(JC);function JC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(u,c,f){e[0]=u,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],e[0]}function a(u,c){return r[3]=u[c],r[2]=u[c+1],r[1]=u[c+2],r[0]=u[c+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),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,XC),t.writeFloatBE=e.bind(null,ZC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}t.readFloatLE=r.bind(null,ex),t.readFloatBE=r.bind(null,tx)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(u,c,f){e[0]=u,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],r[4]=u[c+4],r[5]=u[c+5],r[6]=u[c+6],r[7]=u[c+7],e[0]}function a(u,c){return r[7]=u[c],r[6]=u[c+1],r[5]=u[c+2],r[4]=u[c+3],r[3]=u[c+4],r[2]=u[c+5],r[1]=u[c+6],r[0]=u[c+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(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((c<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((c<<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((c<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,XC,0,4),t.writeDoubleBE=e.bind(null,ZC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),f=(c>>31)*2+1,d=c>>>20&2047,g=4294967296*(c&1048575)+u;return d===2047?g?NaN:f*(1/0):d===0?f*5e-324*g:f*Math.pow(2,d-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,ex,0,4),t.readDoubleBE=r.bind(null,tx,4,0)}(),t}function XC(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 ZC(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 ex(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function tx(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var ix=A((exports,module)=>{"use strict";l();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 ox=A(sx=>{"use strict";l();var kw=sx;kw.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))};kw.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 ux=A((xue,ax)=>{"use strict";l();ax.exports=yH;function yH(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 c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var lx=A((Oue,cx)=>{"use strict";l();cx.exports=qt;var Nc=Ni();function qt(t,e){this.lo=t>>>0,this.hi=e>>>0}var Fs=qt.zero=new qt(0,0);Fs.toNumber=function(){return 0};Fs.zzEncode=Fs.zzDecode=function(){return this};Fs.length=function(){return 1};var mH=qt.zeroHash="\0\0\0\0\0\0\0\0";qt.fromNumber=function(e){if(e===0)return Fs;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 qt(n,i)};qt.from=function(e){if(typeof e=="number")return qt.fromNumber(e);if(Nc.isString(e))if(Nc.Long)e=Nc.Long.fromString(e);else return qt.fromNumber(parseInt(e,10));return e.low||e.high?new qt(e.low>>>0,e.high>>>0):Fs};qt.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};qt.prototype.toLong=function(e){return Nc.Long?new Nc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var xi=String.prototype.charCodeAt;qt.fromHash=function(e){return e===mH?Fs:new qt((xi.call(e,0)|xi.call(e,1)<<8|xi.call(e,2)<<16|xi.call(e,3)<<24)>>>0,(xi.call(e,4)|xi.call(e,5)<<8|xi.call(e,6)<<16|xi.call(e,7)<<24)>>>0)};qt.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)};qt.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};qt.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};qt.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 Ni=A(Gw=>{"use strict";l();var Ie=Gw;Ie.asPromise=jC();Ie.base64=$C();Ie.EventEmitter=YC();Ie.float=nx();Ie.inquire=ix();Ie.utf8=ox();Ie.pool=ux();Ie.LongBits=lx();Ie.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ie.global=Ie.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Gw;Ie.emptyArray=Object.freeze?Object.freeze([]):[];Ie.emptyObject=Object.freeze?Object.freeze({}):{};Ie.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ie.isString=function(e){return typeof e=="string"||e instanceof String};Ie.isObject=function(e){return e&&typeof e=="object"};Ie.isset=Ie.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};Ie.Buffer=function(){try{var t=Ie.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ie._Buffer_from=null;Ie._Buffer_allocUnsafe=null;Ie.newBuffer=function(e){return typeof e=="number"?Ie.Buffer?Ie._Buffer_allocUnsafe(e):new Ie.Array(e):Ie.Buffer?Ie._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ie.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ie.Long=Ie.global.dcodeIO&&Ie.global.dcodeIO.Long||Ie.global.Long||Ie.inquire("long");Ie.key2Re=/^true|false|0|1$/;Ie.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ie.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ie.longToHash=function(e){return e?Ie.LongBits.from(e).toHash():Ie.LongBits.zeroHash};Ie.longFromHash=function(e,r){var n=Ie.LongBits.fromHash(e);return Ie.Long?Ie.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function fx(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]}};Ie.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";l();yx.exports=Ue;var Pr=Ni(),jw,lh=Pr.LongBits,hx=Pr.base64,px=Pr.utf8;function Oc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function zw(){}function wH(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ue(){this.len=0,this.head=new Oc(zw,0,0),this.tail=this.head,this.states=null}var gx=function(){return Pr.Buffer?function(){return(Ue.create=function(){return new jw})()}:function(){return new Ue}};Ue.create=gx();Ue.alloc=function(e){return new Pr.Array(e)};Pr.Array!==Array&&(Ue.alloc=Pr.pool(Ue.alloc,Pr.Array.prototype.subarray));Ue.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Oc(e,r,n),this.len+=r,this};function Ww(t,e,r){e[r]=t&255}function EH(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function $w(t,e){this.len=t,this.next=void 0,this.val=e}$w.prototype=Object.create(Oc.prototype);$w.prototype.fn=EH;Ue.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new $w((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ue.prototype.int32=function(e){return e<0?this._push(Kw,10,lh.fromNumber(e)):this.uint32(e)};Ue.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Kw(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}Ue.prototype.uint64=function(e){var r=lh.from(e);return this._push(Kw,r.length(),r)};Ue.prototype.int64=Ue.prototype.uint64;Ue.prototype.sint64=function(e){var r=lh.from(e).zzEncode();return this._push(Kw,r.length(),r)};Ue.prototype.bool=function(e){return this._push(Ww,1,e?1:0)};function Qw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ue.prototype.fixed32=function(e){return this._push(Qw,4,e>>>0)};Ue.prototype.sfixed32=Ue.prototype.fixed32;Ue.prototype.fixed64=function(e){var r=lh.from(e);return this._push(Qw,4,r.lo)._push(Qw,4,r.hi)};Ue.prototype.sfixed64=Ue.prototype.fixed64;Ue.prototype.float=function(e){return this._push(Pr.float.writeFloatLE,4,e)};Ue.prototype.double=function(e){return this._push(Pr.float.writeDoubleLE,8,e)};var vH=Pr.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(Ww,1,0);if(Pr.isString(e)){var n=Ue.alloc(r=hx.length(e));hx.decode(e,n,0),e=n}return this.uint32(r)._push(vH,r,e)};Ue.prototype.string=function(e){var r=px.length(e);return r?this.uint32(r)._push(px.write,r,e):this._push(Ww,1,0)};Ue.prototype.fork=function(){return this.states=new wH(this),this.head=this.tail=new Oc(zw,0,0),this.len=0,this};Ue.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 Oc(zw,0,0),this.len=0),this};Ue.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};Ue.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};Ue._configure=function(t){jw=t,Ue.create=gx(),jw._configure()}});var Ex=A((Fue,wx)=>{"use strict";l();wx.exports=En;var mx=Yw();(En.prototype=Object.create(mx.prototype)).constructor=En;var Oi=Ni();function En(){mx.call(this)}En._configure=function(){En.alloc=Oi._Buffer_allocUnsafe,En.writeBytesBuffer=Oi.Buffer&&Oi.Buffer.prototype instanceof Uint8Array&&Oi.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(En.writeBytesBuffer,r,e),this};function AH(t,e,r){t.length<40?Oi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}En.prototype.string=function(e){var r=Oi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(AH,r,e),this};En._configure()});var Zw=A((Uue,_x)=>{"use strict";l();_x.exports=bt;var vn=Ni(),Xw,bx=vn.LongBits,bH=vn.utf8;function Kr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function bt(t){this.buf=t,this.pos=0,this.len=t.length}var vx=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new bt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new bt(e);throw Error("illegal buffer")},Ix=function(){return vn.Buffer?function(r){return(bt.create=function(i){return vn.Buffer.isBuffer(i)?new Xw(i):vx(i)})(r)}:vx};bt.create=Ix();bt.prototype._slice=vn.Array.prototype.subarray||vn.Array.prototype.slice;bt.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,Kr(this,10);return e}}();bt.prototype.int32=function(){return this.uint32()|0};bt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Jw(){var t=new bx(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 Kr(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 Kr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}bt.prototype.bool=function(){return this.uint32()!==0};function fh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}bt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)};bt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)|0};function Ax(){if(this.pos+8>this.len)throw Kr(this,8);return new bx(fh(this.buf,this.pos+=4),fh(this.buf,this.pos+=4))}bt.prototype.float=function(){if(this.pos+4>this.len)throw Kr(this,4);var e=vn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};bt.prototype.double=function(){if(this.pos+8>this.len)throw Kr(this,4);var e=vn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};bt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Kr(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)};bt.prototype.string=function(){var e=this.bytes();return bH.read(e,0,e.length)};bt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Kr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Kr(this);while(this.buf[this.pos++]&128);return this};bt.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};bt._configure=function(t){Xw=t,bt.create=Ix(),Xw._configure();var e=vn.Long?"toLong":"toNumber";vn.merge(bt.prototype,{int64:function(){return Jw.call(this)[e](!1)},uint64:function(){return Jw.call(this)[e](!0)},sint64:function(){return Jw.call(this).zzDecode()[e](!1)},fixed64:function(){return Ax.call(this)[e](!0)},sfixed64:function(){return Ax.call(this)[e](!1)}})}});var xx=A((Vue,Cx)=>{"use strict";l();Cx.exports=Ms;var Tx=Zw();(Ms.prototype=Object.create(Tx.prototype)).constructor=Ms;var Sx=Ni();function Ms(t){Tx.call(this,t)}Ms._configure=function(){Sx.Buffer&&(Ms.prototype._slice=Sx.Buffer.prototype.slice)};Ms.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))};Ms._configure()});var Ox=A((kue,Nx)=>{"use strict";l();Nx.exports=Dc;var eE=Ni();(Dc.prototype=Object.create(eE.EventEmitter.prototype)).constructor=Dc;function Dc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");eE.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Dc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return eE.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,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Dc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Px=A(Dx=>{"use strict";l();var IH=Dx;IH.Service=Ox()});var Bx=A((zue,Rx)=>{"use strict";l();Rx.exports={}});var Mx=A(Fx=>{"use strict";l();var pr=Fx;pr.build="minimal";pr.Writer=Yw();pr.BufferWriter=Ex();pr.Reader=Zw();pr.BufferReader=xx();pr.util=Ni();pr.rpc=Px();pr.roots=Bx();pr.configure=Lx;function Lx(){pr.util._configure(),pr.Writer._configure(pr.BufferWriter),pr.Reader._configure(pr.BufferReader)}Lx()});var qx=A((Yue,Ux)=>{"use strict";l();Ux.exports=Mx()});var Hx=A((Xue,Vx)=>{"use strict";l();var sa=qx(),dh=sa.Reader,_H=sa.Writer,Z=sa.util,Pc=sa.roots.default||(sa.roots.default={});Pc.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 dh||(n=new dh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!Z.isInteger(n.Nonce)&&!(n.Nonce&&Z.isInteger(n.Nonce.low)&&Z.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||Z.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||Z.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||Z.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||Z.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||Z.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!Z.isInteger(n.GasPrice)&&!(n.GasPrice&&Z.isInteger(n.GasPrice.low)&&Z.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!Z.isInteger(n.GasLimit)&&!(n.GasLimit&&Z.isInteger(n.GasLimit.low)&&Z.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||Z.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||Z.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!Z.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||Z.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!Z.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||Z.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||Z.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Pc.proto.Transaction)return n;var i=new Pc.proto.Transaction;return n.Nonce!=null&&(Z.Long?(i.Nonce=Z.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 Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?Z.base64.decode(n.Value,i.Value=Z.newBuffer(Z.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?Z.base64.decode(n.RcvAddr,i.RcvAddr=Z.newBuffer(Z.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?Z.base64.decode(n.RcvUserName,i.RcvUserName=Z.newBuffer(Z.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?Z.base64.decode(n.SndAddr,i.SndAddr=Z.newBuffer(Z.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?Z.base64.decode(n.SndUserName,i.SndUserName=Z.newBuffer(Z.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(Z.Long?(i.GasPrice=Z.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 Z.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(Z.Long?(i.GasLimit=Z.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 Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?Z.base64.decode(n.Data,i.Data=Z.newBuffer(Z.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?Z.base64.decode(n.ChainID,i.ChainID=Z.newBuffer(Z.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"?Z.base64.decode(n.Signature,i.Signature=Z.newBuffer(Z.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"?Z.base64.decode(n.GuardAddr,i.GuardAddr=Z.newBuffer(Z.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?Z.base64.decode(n.GuardSignature,i.GuardSignature=Z.newBuffer(Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=Z.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=Z.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=Z.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=Z.newBuffer(s.SndUserName))),Z.Long){var o=new Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=Z.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=Z.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=Z.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=Z.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?Z.Long.prototype.toString.call(n.Nonce):i.longs===Number?new Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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?Z.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new Z.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?Z.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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,sa.util.toJSONOptions)},e}(),t}();Vx.exports=Pc});var kx=A(Rr=>{"use strict";l();var SH=Rr&&Rr.__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]}),TH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CH=Rr&&Rr.__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)&&SH(e,t,r);return TH(e,t),e},xH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var NH=xH(Yt()),tE=pt(),OH=Os(),DH=CH(Le()),PH=Tc(),rE=class{serializeTransaction(e){let r=Hx().proto,n=new tE.Address(e.getReceiver().bech32()).pubkey(),i=new tE.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:e.getReceiverUsername()?h.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?h.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,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()!==OH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new tE.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 NH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=PH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new DH.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=rE});var Gx=A(Us=>{"use strict";l();var RH=Us&&Us.__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]}),BH=Us&&Us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RH(e,t,r)};Object.defineProperty(Us,"__esModule",{value:!0});BH(kx(),Us)});var Rc=A(Br=>{"use strict";l();var LH=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]}),FH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MH=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)&&LH(e,t,r);return FH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.interpretSignatureAsBuffer=Br.Signature=void 0;var jx=MH(Le()),Qx=64,nE=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof h.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new jx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Qx}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Qx)throw new jx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Br.Signature=nE;function UH(t){if(ArrayBuffer.isView(t))return h.Buffer.from(t);if(t.hex!=null)return h.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Br.interpretSignatureAsBuffer=UH});var Yn=A(hh=>{"use strict";l();Object.defineProperty(hh,"__esModule",{value:!0});hh.TransactionPayload=void 0;var iE=class t{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=h.Buffer.from(e,"base64").toString();return new t(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}};hh.TransactionPayload=iE});var sE=A((uce,zx)=>{l();Jn.notEqual=VH;Jn.notOk=HH;Jn.equal=qH;Jn.ok=Jn;zx.exports=Jn;function qH(t,e,r){Jn(t==e,r)}function VH(t,e,r){Jn(t!=e,r)}function HH(t,e){Jn(!t,e)}function Jn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Vs=A(ca=>{"use strict";l();var oE=$0(),aa=Y0(),Wx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ca.Buffer=W;ca.SlowBuffer=WH;ca.INSPECT_MAX_BYTES=50;var ph=2147483647;ca.kMaxLength=ph;W.TYPED_ARRAY_SUPPORT=kH();!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 kH(){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(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 Xn(t){if(t>ph)throw new RangeError('The value "'+t+'" is invalid for option "size"');let 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 lE(t)}return Jx(t,e,r)}W.poolSize=8192;function Jx(t,e,r){if(typeof t=="string")return jH(t,e);if(ArrayBuffer.isView(t))return QH(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(An(t,ArrayBuffer)||t&&An(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(An(t,SharedArrayBuffer)||t&&An(t.buffer,SharedArrayBuffer)))return uE(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 W.from(n,e,r);let i=zH(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 Jx(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function Xx(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 GH(t,e,r){return Xx(t),t<=0?Xn(t):e!==void 0?typeof r=="string"?Xn(t).fill(e,r):Xn(t).fill(e):Xn(t)}W.alloc=function(t,e,r){return GH(t,e,r)};function lE(t){return Xx(t),Xn(t<0?0:fE(t)|0)}W.allocUnsafe=function(t){return lE(t)};W.allocUnsafeSlow=function(t){return lE(t)};function jH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Zx(t,e)|0,n=Xn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function aE(t){let e=t.length<0?0:fE(t.length)|0,r=Xn(e);for(let n=0;n=ph)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ph.toString(16)+" bytes");return t|0}function WH(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(An(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),An(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;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(W.isBuffer(o)||(o=W.from(o)),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 Zx(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||An(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 cE(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return uN(t).length;default:if(i)return n?-1:cE(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=Zx;function $H(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 ik(this,e,r);case"utf8":case"utf-8":return tN(this,e,r);case"ascii":return rk(this,e,r);case"latin1":case"binary":return nk(this,e,r);case"base64":return ek(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sk(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function qs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}W.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+=" ... "),""};Wx&&(W.prototype[Wx]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(An(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;let o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,hE(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:$x(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):$x(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function $x(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 c;if(i){let f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){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 KH(this,e,r,n);case"utf8":case"utf-8":return YH(this,e,r,n);case"ascii":case"latin1":case"binary":return JH(this,e,r,n);case"base64":return XH(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZH(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 ek(t,e,r){return e===0&&r===t.length?oE.fromByteArray(t):oE.fromByteArray(t.slice(e,r))}function tN(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 tk(n)}var Kx=4096;function tk(t){let e=t.length;if(e<=Kx)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")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e+--r],s=1;for(;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||Vt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readBigUInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(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};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Vt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readBigInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Vt(e,4,this.length),aa.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),aa.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!1,52,8)};function gr(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){let a=Math.pow(2,8*n)-1;gr(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;gr(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};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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 rN(t,e,r,n,i){aN(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 nN(t,e,r,n,i){aN(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}W.prototype.writeBigUInt64LE=Di(function(e,r=0){return rN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeBigUInt64BE=Di(function(e,r=0){return nN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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};W.prototype.writeBigInt64LE=Di(function(e,r=0){return rN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W.prototype.writeBigInt64BE=Di(function(e,r=0){return nN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function iN(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 sN(t,e,r,n,i){return e=+e,r=r>>>0,i||iN(t,e,r,4,34028234663852886e22,-34028234663852886e22),aa.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return sN(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return sN(this,e,r,!1,n)};function oN(t,e,r,n,i){return e=+e,r=r>>>0,i||iN(t,e,r,8,17976931348623157e292,-17976931348623157e292),aa.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return oN(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return oN(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);let s;if(typeof e=="number")for(s=r;s2**32?i=Yx(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Yx(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Yx(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 ok(t,e,r){ua(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Bc(e,t.length-(r+1))}function aN(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 oa.ERR_OUT_OF_RANGE("value",a,t)}ok(n,i,s)}function ua(t,e){if(typeof t!="number")throw new oa.ERR_INVALID_ARG_TYPE(e,"number",t)}function Bc(t,e,r){throw Math.floor(t)!==t?(ua(t,r),new oa.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new oa.ERR_BUFFER_OUT_OF_BOUNDS:new oa.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ak=/[^+/0-9A-Za-z-_]/g;function uk(t){if(t=t.split("=")[0],t=t.trim().replace(ak,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function cE(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 ck(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function uN(t){return oE.toByteArray(uk(t))}function gh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function An(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function hE(t){return t!==t}var fk=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 Di(t){return typeof BigInt>"u"?dk:t}function dk(){throw new Error("BigInt not supported")}});var lN=A((hce,cN)=>{l();cN.exports=pE;pE.supported=typeof WebAssembly<"u";function pE(t){if(!pE.supported)return null;var e=t&&t.imports,r=hk("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 hk(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(pk)):new(Vs()).Buffer(t,"base64")}function pk(t){return t.charCodeAt(0)}});var mN=A((mce,In)=>{l();var bn=sE(),Ze=lN()(),Zn=64,yh=[];In.exports=Lr;var fN=In.exports.BYTES_MIN=16,dN=In.exports.BYTES_MAX=64,gce=In.exports.BYTES=32,hN=In.exports.KEYBYTES_MIN=16,pN=In.exports.KEYBYTES_MAX=64,yce=In.exports.KEYBYTES=32,gN=In.exports.SALTBYTES=16,yN=In.exports.PERSONALBYTES=16;function Lr(t,e,r,n,i){if(!(this instanceof Lr))return new Lr(t,e,r,n,i);if(!(Ze&&Ze.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(bn(t>=fN,"digestLength must be at least "+fN+", was given "+t),bn(t<=dN,"digestLength must be at most "+dN+", was given "+t),e!=null&&bn(e.length>=hN,"key must be at least "+hN+", was given "+e.length),e!=null&&bn(e.length<=pN,"key must be at least "+pN+", was given "+e.length),r!=null&&bn(r.length===gN,"salt must be exactly "+gN+", was given "+r.length),n!=null&&bn(n.length===yN,"personal must be exactly "+yN+", was given "+n.length)),yh.length||(yh.push(Zn),Zn+=216),this.digestLength=t,this.finalized=!1,this.pointer=yh.pop(),Ze.memory.fill(0,0,64),Ze.memory[0]=this.digestLength,Ze.memory[1]=e?e.length:0,Ze.memory[2]=1,Ze.memory[3]=1,r&&Ze.memory.set(r,32),n&&Ze.memory.set(n,48),this.pointer+216>Ze.memory.length&&Ze.realloc(this.pointer+216),Ze.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ze.memory.fill(0,Zn,Zn+e.length),Ze.memory[this.pointer+200]=128)}Lr.prototype.update=function(t){return bn(this.finalized===!1,"Hash instance finalized"),bn(t,"input must be TypedArray or Buffer"),Zn+t.length>Ze.memory.length&&Ze.realloc(Zn+t.length),Ze.memory.set(t,Zn),Ze.exports.blake2b_update(this.pointer,Zn,Zn+t.length),this};Lr.prototype.digest=function(t){if(bn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,yh.push(this.pointer),Ze.exports.blake2b_final(this.pointer),!t||t==="binary")return Ze.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return yk(Ze.memory,this.pointer+128,this.digestLength);bn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Bi=sE(),Fc=mN();function mh(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 wN(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 SN(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Pi(t,e,r,n,i,s){var o=Lc[i],a=Lc[i+1],u=Lc[s],c=Lc[s+1];mh(xe,t,e),wN(xe,t,o,a);var f=xe[n]^xe[t],d=xe[n+1]^xe[t+1];xe[n]=d,xe[n+1]=f,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=f>>>24^d<<8,xe[e+1]=d>>>24^f<<8,mh(xe,t,e),wN(xe,t,u,c),f=xe[n]^xe[t],d=xe[n+1]^xe[t+1],xe[n]=f>>>16^d<<16,xe[n+1]=d>>>16^f<<16,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=d>>>31^f<<1,xe[e+1]=f>>>31^d<<1}var TN=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),wk=[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],Xt=new Uint8Array(wk.map(function(t){return t*2})),xe=new Uint32Array(32),Lc=new Uint32Array(32);function CN(t,e){var r=0;for(r=0;r<16;r++)xe[r]=t.h[r],xe[r+16]=TN[r];for(xe[24]=xe[24]^t.t,xe[25]=xe[25]^t.t/4294967296,e&&(xe[28]=~xe[28],xe[29]=~xe[29]),r=0;r<32;r++)Lc[r]=SN(t.b,4*r);for(r=0;r<12;r++)Pi(0,8,16,24,Xt[r*16+0],Xt[r*16+1]),Pi(2,10,18,26,Xt[r*16+2],Xt[r*16+3]),Pi(4,12,20,28,Xt[r*16+4],Xt[r*16+5]),Pi(6,14,22,30,Xt[r*16+6],Xt[r*16+7]),Pi(0,10,20,30,Xt[r*16+8],Xt[r*16+9]),Pi(2,12,22,24,Xt[r*16+10],Xt[r*16+11]),Pi(4,14,16,26,Xt[r*16+12],Xt[r*16+13]),Pi(6,8,18,28,Xt[r*16+14],Xt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^xe[r]^xe[r+16]}var Ri=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 la(t,e,r,n){Ri.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ri[0]=t,e&&(Ri[1]=e.length),Ri[2]=1,Ri[3]=1,r&&Ri.set(r,32),n&&Ri.set(n,48);for(var i=0;i<16;i++)this.h[i]=TN[i]^SN(Ri,i*4);e&&(xN(this,e),this.c=128)}la.prototype.update=function(t){return Bi(t!=null,"input must be Uint8Array or Buffer"),xN(this,t),this};la.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Bi(e.length>=this.outlen,"out must have at least outlen bytes of space"),Ek(this,e),t==="hex"?vk(e):e};la.prototype.final=la.prototype.digest;la.ready=function(t){Fc.ready(function(){t()})};function xN(t,e){for(var r=0;r>2]>>8*(r&3);return e}function vk(t){for(var e="",r=0;r=EN,"outlen must be at least "+EN+", was given "+e),Bi(e<=vN,"outlen must be at most "+vN+", was given "+e),r!=null&&Bi(r.length>=AN,"key must be at least "+AN+", was given "+r.length),r!=null&&Bi(r.length<=bN,"key must be at most "+bN+", was given "+r.length),n!=null&&Bi(n.length===IN,"salt must be exactly "+IN+", was given "+n.length),i!=null&&Bi(i.length===_N,"personal must be exactly "+_N+", was given "+i.length)),new NN(e,r,n,i)};yr.exports.ready=function(t){Fc.ready(function(){t()})};yr.exports.WASM_SUPPORTED=Fc.SUPPORTED;yr.exports.WASM_LOADED=!1;var EN=yr.exports.BYTES_MIN=16,vN=yr.exports.BYTES_MAX=64,Ece=yr.exports.BYTES=32,AN=yr.exports.KEYBYTES_MIN=16,bN=yr.exports.KEYBYTES_MAX=64,vce=yr.exports.KEYBYTES=32,IN=yr.exports.SALTBYTES=16,_N=yr.exports.PERSONALBYTES=16;Fc.ready(function(t){t||(yr.exports.WASM_LOADED=!0,NN=Fc)})});var Yr=A(Fr=>{"use strict";l();var bk=Fr&&Fr.__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]}),Ik=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_k=Fr&&Fr.__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)&&bk(e,t,r);return Ik(e,t),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var fa=Yt(),Mc=pt(),Sk=ah(),Tk=Os(),Ck=_k(Le()),xk=HC(),ei=xc(),Nk=Gx(),wh=Rc(),ON=Yn(),Ok=br(),Dk=gE(),Pk=32,yE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:c,chainID:f,version:d,options:g,guardian:m}){this.nonce=e||0,this.value=r?new fa.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||Tk.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=c||new ON.TransactionPayload,this.chainID=f,this.version=d?new ei.TransactionVersion(d.valueOf()):ei.TransactionVersion.withDefaultVersion(),this.options=g?new ei.TransactionOptions(g.valueOf()):ei.TransactionOptions.withDefaultOptions(),this.guardian=m||Mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=da.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}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}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 ei.TransactionVersion(e.valueOf())}getOptions(){return new ei.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new ei.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return Ok.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(),senderUsername:this.senderUsername?h.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?h.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().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 Sk.Compatibility.guardAddressIsSetAndNonZero(new Mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new fa.BigNumber(e.value).toFixed(0),receiver:Mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:Mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?Mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new ON.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new ei.TransactionVersion(e.version),options:e.options!=null?new ei.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new wh.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new wh.Signature(e.guardianSignature)),r}applySignature(e){this.signature=wh.interpretSignatureAsBuffer(e),this.hash=da.compute(this)}applyGuardianSignature(e){this.guardianSignature=wh.interpretSignatureAsBuffer(e),this.hash=da.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 Ck.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new fa.BigNumber(this.gasPrice.valueOf()),i=new fa.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new fa.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new fa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Fr.Transaction=yE;var da=class t extends xk.Hash{constructor(e){super(e)}static compute(e){let n=new Nk.ProtoSerializer().serializeTransaction(e),i=Dk(Pk).update(n).digest("hex");return new t(i)}};Fr.TransactionHash=da});var vE=A(vh=>{"use strict";l();Object.defineProperty(vh,"__esModule",{value:!0});vh.TransferTransactionsFactory=void 0;var mE=na(),Jr=xt(),Eh=Yr(),wE=Yn(),EE=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 Eh.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 mE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new wE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Eh.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 mE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.U64Value(e.tokenTransfer.nonce),new Jr.BigUIntValue(e.tokenTransfer.valueOf()),new Jr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new wE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Eh.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 Jr.AddressValue(e.destination),new Jr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Jr.BytesValue.fromUTF8(u.tokenIdentifier),new Jr.U64Value(u.nonce),new Jr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new mE.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new wE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Eh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};vh.TransferTransactionsFactory=EE});var bE=A(Hs=>{"use strict";l();Object.defineProperty(Hs,"__esModule",{value:!0});Hs.GasEstimator=Hs.DefaultGasConfiguration=void 0;Hs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Rk=1e5,DN=8e5,AE=class{constructor(e){this.gasConfiguration=e||Hs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Rk}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+DN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+DN)*r+this.gasConfiguration.gasPerDataByte*e}};Hs.GasEstimator=AE});var ha=A(Ah=>{"use strict";l();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.Account=void 0;var Bk=pt(),IE=class{constructor(e){this.address=new Bk.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()}}};Ah.Account=IE});var pa=A(Gs=>{"use strict";l();Object.defineProperty(Gs,"__esModule",{value:!0});Gs.Logger=Gs.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=Gs.LogLevel||(Gs.LogLevel={}));var bh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=ks.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=ks.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=ks.Error||console.error(e,r)}};Gs.Logger=bh;bh.logLevel=ks.Debug});var TE=A(_n=>{"use strict";l();var Lk=_n&&_n.__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]}),Fk=_n&&_n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mk=_n&&_n.__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)&&Lk(e,t,r);return Fk(e,t),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.AsyncTimer=void 0;var Uk=Mk(Le()),qk=Le(),_E=pa(),SE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new Uk.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,_E.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(){_E.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new qk.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(_E.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_n.AsyncTimer=SE});var Ih=A(ga=>{"use strict";l();var Mr=ga&&ga.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(ga,"__esModule",{value:!0});ga.TransactionWatcher=void 0;var CE=TE(),Li=Le(),PN=pa(),Fi=class t{constructor(e,r={}){this.fetcher=new xE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Mr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Mr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new Li.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>a.includes(c))},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>a.includes(c))!=null},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Mr(this,void 0,void 0,function*(){let n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Mr(this,void 0,void 0,function*(){let i=new CE.AsyncTimer("watcher:periodic"),s=new CE.AsyncTimer("watcher:patience"),o=new CE.AsyncTimer("watcher:timeout"),a=!1,u,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),c=e(u),c||a)break}catch(f){if(PN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Li.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Li.Err))throw f}}if(c&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!c)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}};ga.TransactionWatcher=Fi;Fi.DefaultPollingInterval=6e3;Fi.DefaultTimeout=Fi.DefaultPollingInterval*15;Fi.DefaultPatience=0;Fi.NoopOnStatusReceived=t=>{};var xE=class{constructor(e){this.fetcher=e}getTransaction(e){return Mr(this,void 0,void 0,function*(){return PN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var NE=A(_h=>{"use strict";l();Object.defineProperty(_h,"__esModule",{value:!0});_h.CodeMetadata=void 0;var Uc=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBuffer(e){if(e.length<2)throw new Error("Buffer is too short.");let r=e[0],n=e[1],i=(r&t.ByteZero.Upgradeable)!==0,s=(r&t.ByteZero.Readable)!==0,o=(n&t.ByteOne.Payable)!==0,a=(n&t.ByteOne.PayableBySc)!==0;return new t(i,s,o,a)}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|=t.ByteZero.Upgradeable),this.readable&&(e|=t.ByteZero.Readable),this.payable&&(r|=t.ByteOne.Payable),this.payableBySc&&(r|=t.ByteOne.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}};_h.CodeMetadata=Uc;Uc.ByteZero={Upgradeable:1,Reserved2:2,Readable:4};Uc.ByteOne={Reserved1:1,Payable:2,PayableBySc:4}});var qc=A(Sn=>{"use strict";l();var Vk=Sn&&Sn.__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]}),Hk=Sn&&Sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kk=Sn&&Sn.__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)&&Vk(e,t,r);return Hk(e,t),e};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ContractFunction=void 0;var Gk=kk(Le()),OE=class t{constructor(e){if(this.name=e,e==null)throw new Gk.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Sn.ContractFunction=OE});var RE=A(Ur=>{"use strict";l();var jk=Ur&&Ur.__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]}),Qk=Ur&&Ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zk=Ur&&Ur.__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)&&jk(e,t,r);return Qk(e,t),e},Wk=Ur&&Ur.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.InteractionChecker=void 0;var DE=zk(Le()),$k=Wk(Yt()),PE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new $k.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new DE.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 DE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";l();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Query=void 0;var Kk=pt(),Yk=na(),BE=class{constructor(e){this.caller=e.caller||new Kk.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new Yk.ArgSerializer().valuesToStrings(this.args)}};Sh.Query=BE});var UE=A(Th=>{"use strict";l();Object.defineProperty(Th,"__esModule",{value:!0});Th.Interaction=void 0;var RN=pt(),Jk=ah(),LE=Os(),FE=qc(),Xk=RE(),Zk=Vc(),ya=xt(),ME=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new RN.Address,this.sender=new RN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ma([],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(){Jk.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 FE.ContractFunction(LE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new FE.ContractFunction(LE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new FE.ContractFunction(LE.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 Zk.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 ma([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ma([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ma(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 Xk.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Th.Interaction=ME;var ma=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 ya.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ya.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ya.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ya.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ya.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ya.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var BN=A(Ch=>{"use strict";l();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArgumentErrorContext=void 0;var eG=Le(),qE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new eG.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)})`)}};Ch.ArgumentErrorContext=qE});var HE=A(js=>{"use strict";l();var tG=js&&js.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(js,"__esModule",{value:!0});js.NativeSerializer=void 0;var rG=tG(Yt()),nG=pt(),VE=Le(),iG=Md(),sG=BN(),_e=xt(),oG;(function(t){function e(E,S){E=E||[],r(E,S),n(S)&&(E=i(E,S));let N=S.input,_=[];for(let T=0;T0&&S[0].type.getCardinality().isComposite()&&(_=1/0,T=!0);for(let B of S){if(B.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:T}}function o(E,S,N){if(E&&E.belongsToTypesystem)return E;if(S instanceof _e.OptionType)return a(E,S,N);if(S instanceof _e.OptionalType)return u(E,S,N);if(S instanceof _e.VariadicType)return c(E,S,N);if(S instanceof _e.CompositeType)return d(E,S,N);if(S instanceof _e.TupleType)return g(E,S,N);if(S instanceof _e.StructType)return m(E,S,N);if(S instanceof _e.ListType)return f(E,S,N);if(S instanceof _e.PrimitiveType)return y(E,S,N);if(S instanceof _e.EnumType)return b(E,S,N);N.throwError(`convertToTypedValue: unhandled type ${S}`)}function a(E,S,N){if(E==null)return _e.OptionValue.newMissing();let _=o(E,S.getFirstTypeParameter(),N);return _e.OptionValue.newProvided(_)}function u(E,S,N){if(E==null)return new _e.OptionalValue(S);let _=o(E,S.getFirstTypeParameter(),N);return new _e.OptionalValue(S,_)}function c(E,S,N){if(S.isCounted)throw new VE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');E==null&&(E=[]),E.map===void 0&&N.convertError(E,"Variadic");let _=E.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new _e.VariadicValue(S,_)}function f(E,S,N){E.map===void 0&&N.convertError(E,"List");let _=E.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new _e.List(S,_)}function d(E,S,N){let _=[],T=S.getTypeParameters();N.guardSameLength(E,T);for(let B=0;B{"use strict";l();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.ContractCallPayloadBuilder=Xr.ContractUpgradePayloadBuilder=Xr.ContractDeployPayloadBuilder=Xr.ArwenVirtualMachine=void 0;var QE=Yn(),zE=br(),aG=na();Xr.ArwenVirtualMachine="0500";var kE=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(){zE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Xr.ArwenVirtualMachine}@${r}`;return n=WE(n,this.arguments),new QE.TransactionPayload(n)}};Xr.ContractDeployPayloadBuilder=kE;var GE=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(){zE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=WE(n,this.arguments),new QE.TransactionPayload(n)}};Xr.ContractUpgradePayloadBuilder=GE;var jE=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(){zE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=WE(e,this.arguments),new QE.TransactionPayload(e)}};Xr.ContractCallPayloadBuilder=jE;function WE(t,e){let{argumentsString:r,count:n}=new aG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var ti=A((Zce,KE)=>{"use strict";l();var wa=typeof Reflect=="object"?Reflect:null,LN=wa&&typeof wa.apply=="function"?wa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},xh;wa&&typeof wa.ownKeys=="function"?xh=wa.ownKeys:Object.getOwnPropertySymbols?xh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xh=function(e){return Object.getOwnPropertyNames(e)};function uG(t){console&&console.warn&&console.warn(t)}var MN=Number.isNaN||function(e){return e!==e};function We(){We.init.call(this)}KE.exports=We;KE.exports.once=dG;We.EventEmitter=We;We.prototype._events=void 0;We.prototype._eventsCount=0;We.prototype._maxListeners=void 0;var FN=10;function Nh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(We,"defaultMaxListeners",{enumerable:!0,get:function(){return FN},set:function(t){if(typeof t!="number"||t<0||MN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");FN=t}});We.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};We.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||MN(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 UN(t){return t._maxListeners===void 0?We.defaultMaxListeners:t._maxListeners}We.prototype.getMaxListeners=function(){return UN(this)};We.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")LN(u,this,r);else for(var c=u.length,f=GN(u,c),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,uG(a)}return t}We.prototype.addListener=function(e,r){return qN(this,e,r,!1)};We.prototype.on=We.prototype.addListener;We.prototype.prependListener=function(e,r){return qN(this,e,r,!0)};function cG(){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 VN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=cG.bind(n);return i.listener=r,n.wrapFn=i,i}We.prototype.once=function(e,r){return Nh(r),this.on(e,VN(this,e,r)),this};We.prototype.prependOnceListener=function(e,r){return Nh(r),this.prependListener(e,VN(this,e,r)),this};We.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Nh(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():lG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};We.prototype.off=We.prototype.removeListener;We.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 HN(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?fG(i):GN(i,i.length)}We.prototype.listeners=function(e){return HN(this,e,!0)};We.prototype.rawListeners=function(e){return HN(this,e,!1)};We.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):kN.call(t,e)};We.prototype.listenerCount=kN;function kN(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}We.prototype.eventNames=function(){return this._eventsCount>0?xh(this._events):[]};function GN(t,e){for(var r=new Array(e),n=0;n{l();QN.exports=ti().EventEmitter});var JE=A(()=>{l()});var JN=A((ole,YN)=>{"use strict";l();function zN(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 WN(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 Oh.alloc(0);for(var n=Oh.allocUnsafe(r>>>0),i=this.head,s=0;i;)AG(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=Oh.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:vG,value:function(r,n){return XE(this,WN(WN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var ev=A((ule,ZN)=>{"use strict";l();function bG(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(ZE,this,t)):p.default.nextTick(ZE,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(Dh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(XN,r,s)):p.default.nextTick(XN,r,s):e?(p.default.nextTick(Dh,r),e(s)):p.default.nextTick(Dh,r)}),this)}function XN(t,e){ZE(t,e),Dh(t)}function Dh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function IG(){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 ZE(t,e){t.emit("error",e)}function _G(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}ZN.exports={destroy:bG,undestroy:IG,errorOrDestroy:_G}});var Qs=A((lle,rO)=>{"use strict";l();function SG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var tO={};function qr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){SG(o,s);function o(a,u,c){return s.call(this,n(a,u,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,tO[t]=i}function eO(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 TG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function CG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function xG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}qr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);qr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&TG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(CG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(eO(e,"type"));else{var s=xG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(eO(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);qr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");qr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});qr("ERR_STREAM_PREMATURE_CLOSE","Premature close");qr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});qr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");qr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");qr("ERR_STREAM_WRITE_AFTER_END","write after end");qr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);qr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");rO.exports.codes=tO});var tv=A((dle,nO)=>{"use strict";l();var NG=Qs().codes.ERR_INVALID_OPT_VALUE;function OG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function DG(t,e,r,n){var i=OG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new NG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}nO.exports={getHighWaterMark:DG}});var Ea=A((ple,rv)=>{l();typeof Object.create=="function"?rv.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:rv.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 sO=A((yle,iO)=>{l();iO.exports=PG;function PG(t,e){if(nv("noDeprecation"))return t;var r=!1;function n(){if(!r){if(nv("throwDeprecation"))throw new Error(e);nv("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function nv(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var ov=A((wle,fO)=>{"use strict";l();fO.exports=gt;function aO(t){var e=this;this.next=null,this.entry=null,this.finish=function(){sj(e,t)}}var va;gt.WritableState=kc;var RG={deprecate:sO()},uO=YE(),Rh=Vs().Buffer,BG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function LG(t){return Rh.from(t)}function FG(t){return Rh.isBuffer(t)||t instanceof BG}var sv=ev(),MG=tv(),UG=MG.getHighWaterMark,Mi=Qs().codes,qG=Mi.ERR_INVALID_ARG_TYPE,VG=Mi.ERR_METHOD_NOT_IMPLEMENTED,HG=Mi.ERR_MULTIPLE_CALLBACK,kG=Mi.ERR_STREAM_CANNOT_PIPE,GG=Mi.ERR_STREAM_DESTROYED,jG=Mi.ERR_STREAM_NULL_VALUES,QG=Mi.ERR_STREAM_WRITE_AFTER_END,zG=Mi.ERR_UNKNOWN_ENCODING,Aa=sv.errorOrDestroy;Ea()(gt,uO);function WG(){}function kc(t,e,r){va=va||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof va),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=UG(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){ej(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 aO(this)}kc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(kc.prototype,"buffer",{get:RG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Ph;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ph=Function.prototype[Symbol.hasInstance],Object.defineProperty(gt,Symbol.hasInstance,{value:function(e){return Ph.call(this,e)?!0:this!==gt?!1:e&&e._writableState instanceof kc}})):Ph=function(e){return e instanceof this};function gt(t){va=va||zs();var e=this instanceof va;if(!e&&!Ph.call(gt,this))return new gt(t);this._writableState=new kc(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)),uO.call(this)}gt.prototype.pipe=function(){Aa(this,new kG)};function $G(t,e){var r=new QG;Aa(t,r),p.default.nextTick(e,r)}function KG(t,e,r,n){var i;return r===null?i=new jG:typeof r!="string"&&!e.objectMode&&(i=new qG("chunk",["string","Buffer"],r)),i?(Aa(t,i),p.default.nextTick(n,i),!1):!0}gt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&FG(t);return s&&!Rh.isBuffer(t)&&(t=LG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=WG),n.ending?$G(this,r):(s||KG(this,n,t,r))&&(n.pendingcb++,i=JG(this,n,s,t,e,r)),i};gt.prototype.cork=function(){this._writableState.corked++};gt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&cO(this,t))};gt.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 zG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function YG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Rh.from(e,r)),e}Object.defineProperty(gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function JG(t,e,r,n,i,s){if(!r){var o=YG(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";l();var oj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};hO.exports=Tn;var dO=cv(),uv=ov();Ea()(Tn,dO);for(av=oj(uv.prototype),Bh=0;Bh{l();var Fh=Vs(),Cn=Fh.Buffer;function pO(t,e){for(var r in t)e[r]=t[r]}Cn.from&&Cn.alloc&&Cn.allocUnsafe&&Cn.allocUnsafeSlow?gO.exports=Fh:(pO(Fh,lv),lv.Buffer=Ws);function Ws(t,e,r){return Cn(t,e,r)}Ws.prototype=Object.create(Cn.prototype);pO(Cn,Ws);Ws.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Cn(t,e,r)};Ws.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Cn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ws.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Cn(t)};Ws.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Fh.SlowBuffer(t)}});var hv=A(wO=>{"use strict";l();var dv=yO().Buffer,mO=dv.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 cj(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 lj(t){var e=cj(t);if(typeof e!="string"&&(dv.isEncoding===mO||!mO(t)))throw new Error("Unknown encoding: "+t);return e||t}wO.StringDecoder=Gc;function Gc(t){this.encoding=lj(t);var e;switch(this.encoding){case"utf16le":this.text=yj,this.end=mj,e=4;break;case"utf8":this.fillLast=hj,e=4;break;case"base64":this.text=wj,this.end=Ej,e=3;break;default:this.write=vj,this.end=Aj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=dv.allocUnsafe(e)}Gc.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 fj(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 dj(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 hj(t){var e=this.lastTotal-this.lastNeed,r=dj(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 pj(t,e){var r=fj(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 gj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function yj(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 mj(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 wj(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 Ej(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function vj(t){return t.toString(this.encoding)}function Aj(t){return t&&t.length?this.write(t):""}});var Mh=A((Sle,AO)=>{"use strict";l();var EO=Qs().codes.ERR_STREAM_PREMATURE_CLOSE;function bj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";l();var Uh;function Ui(t,e,r){return e=Sj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sj(t){var e=Tj(t,"string");return typeof e=="symbol"?e:String(e)}function Tj(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 Cj=Mh(),qi=Symbol("lastResolve"),$s=Symbol("lastReject"),jc=Symbol("error"),qh=Symbol("ended"),Ks=Symbol("lastPromise"),pv=Symbol("handlePromise"),Ys=Symbol("stream");function Vi(t,e){return{value:t,done:e}}function xj(t){var e=t[qi];if(e!==null){var r=t[Ys].read();r!==null&&(t[Ks]=null,t[qi]=null,t[$s]=null,e(Vi(r,!1)))}}function Nj(t){p.default.nextTick(xj,t)}function Oj(t,e){return function(r,n){t.then(function(){if(e[qh]){r(Vi(void 0,!0));return}e[pv](r,n)},n)}}var Dj=Object.getPrototypeOf(function(){}),Pj=Object.setPrototypeOf((Uh={get stream(){return this[Ys]},next:function(){var e=this,r=this[jc];if(r!==null)return Promise.reject(r);if(this[qh])return Promise.resolve(Vi(void 0,!0));if(this[Ys].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[jc]?a(e[jc]):o(Vi(void 0,!0))})});var n=this[Ks],i;if(n)i=new Promise(Oj(n,this));else{var s=this[Ys].read();if(s!==null)return Promise.resolve(Vi(s,!1));i=new Promise(this[pv])}return this[Ks]=i,i}},Ui(Uh,Symbol.asyncIterator,function(){return this}),Ui(Uh,"return",function(){var e=this;return new Promise(function(r,n){e[Ys].destroy(null,function(i){if(i){n(i);return}r(Vi(void 0,!0))})})}),Uh),Dj),Rj=function(e){var r,n=Object.create(Pj,(r={},Ui(r,Ys,{value:e,writable:!0}),Ui(r,qi,{value:null,writable:!0}),Ui(r,$s,{value:null,writable:!0}),Ui(r,jc,{value:null,writable:!0}),Ui(r,qh,{value:e._readableState.endEmitted,writable:!0}),Ui(r,pv,{value:function(s,o){var a=n[Ys].read();a?(n[Ks]=null,n[qi]=null,n[$s]=null,s(Vi(a,!1))):(n[qi]=s,n[$s]=o)},writable:!0}),r));return n[Ks]=null,Cj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[$s];s!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,s(i)),n[jc]=i;return}var o=n[qi];o!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,o(Vi(void 0,!0))),n[qh]=!0}),e.on("readable",Nj.bind(null,n)),n};bO.exports=Rj});var SO=A((Nle,_O)=>{l();_O.exports=function(){throw new Error("Readable.from is not available in the browser")}});var cv=A((Ple,LO)=>{"use strict";l();LO.exports=qe;var ba;qe.ReadableState=NO;var Dle=ti().EventEmitter,xO=function(e,r){return e.listeners(r).length},zc=YE(),Vh=Vs().Buffer,Bj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Lj(t){return Vh.from(t)}function Fj(t){return Vh.isBuffer(t)||t instanceof Bj}var gv=JE(),Ne;gv&&gv.debuglog?Ne=gv.debuglog("stream"):Ne=function(){};var Mj=JN(),bv=ev(),Uj=tv(),qj=Uj.getHighWaterMark,Hh=Qs().codes,Vj=Hh.ERR_INVALID_ARG_TYPE,Hj=Hh.ERR_STREAM_PUSH_AFTER_EOF,kj=Hh.ERR_METHOD_NOT_IMPLEMENTED,Gj=Hh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ia,yv,mv;Ea()(qe,zc);var Qc=bv.errorOrDestroy,wv=["error","close","destroy","pause","resume"];function jj(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 NO(t,e,r){ba=ba||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof ba),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=qj(this,t,"readableHighWaterMark",r),this.buffer=new Mj,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&&(Ia||(Ia=hv().StringDecoder),this.decoder=new Ia(t.encoding),this.encoding=t.encoding)}function qe(t){if(ba=ba||zs(),!(this instanceof qe))return new qe(t);var e=this instanceof ba;this._readableState=new NO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),zc.call(this)}Object.defineProperty(qe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});qe.prototype.destroy=bv.destroy;qe.prototype._undestroy=bv.undestroy;qe.prototype._destroy=function(t,e){e(t)};qe.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=Vh.from(t,e),e=""),n=!0),OO(this,t,e,!1,n)};qe.prototype.unshift=function(t){return OO(this,t,null,!0,!1)};function OO(t,e,r,n,i){Ne("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Wj(t,s);else{var o;if(i||(o=Qj(s,e)),o)Qc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Vh.prototype&&(e=Lj(e)),n)s.endEmitted?Qc(t,new Gj):Ev(t,s,e,!0);else if(s.ended)Qc(t,new Hj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?Ev(t,s,e,!1):Av(t,s)):Ev(t,s,e,!1)}else n||(s.reading=!1,Av(t,s))}return!s.ended&&(s.length=TO?t=TO:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function CO(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=zj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}qe.prototype.read=function(t){Ne("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 Ne("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?vv(this):kh(this),null;if(t=CO(t,e),t===0&&e.ended)return e.length===0&&vv(this),null;var n=e.needReadable;Ne("need readable",n),(e.length===0||e.length-t0?i=RO(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&&vv(this)),i!==null&&this.emit("data",i),i};function Wj(t,e){if(Ne("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?kh(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,DO(t)))}}function kh(t){var e=t._readableState;Ne("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ne("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(DO,t))}function DO(t){var e=t._readableState;Ne("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,Iv(t)}function Av(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick($j,t,e))}function $j(t,e){for(;!e.reading&&!e.ended&&(e.length1&&BO(n.pipes,t)!==-1)&&!c&&(Ne("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){Ne("onerror",O),b(),t.removeListener("error",g),xO(t,"error")===0&&Qc(t,O)}jj(t,"error",g);function m(){t.removeListener("finish",y),b()}t.once("close",m);function y(){Ne("onfinish"),t.removeListener("close",m),b()}t.once("finish",y);function b(){Ne("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ne("pipe resume"),r.resume()),t};function Kj(t){return function(){var r=t._readableState;Ne("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&xO(t,"data")&&(r.flowing=!0,Iv(t))}}qe.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,Ne("on readable",n.length,n.reading),n.length?kh(this):n.reading||p.default.nextTick(Yj,this)),r};qe.prototype.addListener=qe.prototype.on;qe.prototype.removeListener=function(t,e){var r=zc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(PO,this),r};qe.prototype.removeAllListeners=function(t){var e=zc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(PO,this),e};function PO(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 Yj(t){Ne("readable nexttick read 0"),t.read(0)}qe.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ne("resume"),t.flowing=!t.readableListening,Jj(this,t)),t.paused=!1,this};function Jj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(Xj,t,e))}function Xj(t,e){Ne("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Iv(t),e.flowing&&!e.reading&&t.read(0)}qe.prototype.pause=function(){return Ne("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ne("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Iv(t){var e=t._readableState;for(Ne("flow",e.flowing);e.flowing&&t.read()!==null;);}qe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ne("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(Ne("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 vv(t){var e=t._readableState;Ne("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Zj,e,t))}function Zj(t,e){if(Ne("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"&&(qe.from=function(t,e){return mv===void 0&&(mv=SO()),mv(qe,t,e)});function BO(t,e){for(var r=0,n=t.length;r{"use strict";l();MO.exports=ri;var Gh=Qs().codes,eQ=Gh.ERR_METHOD_NOT_IMPLEMENTED,tQ=Gh.ERR_MULTIPLE_CALLBACK,rQ=Gh.ERR_TRANSFORM_ALREADY_TRANSFORMING,nQ=Gh.ERR_TRANSFORM_WITH_LENGTH_0,jh=zs();Ea()(ri,jh);function iQ(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new tQ);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";l();qO.exports=Wc;var UO=_v();Ea()(Wc,UO);function Wc(t){if(!(this instanceof Wc))return new Wc(t);UO.call(this,t)}Wc.prototype._transform=function(t,e,r){r(null,t)}});var QO=A((Ule,jO)=>{"use strict";l();var Sv;function oQ(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var GO=Qs().codes,aQ=GO.ERR_MISSING_ARGS,uQ=GO.ERR_STREAM_DESTROYED;function HO(t){if(t)throw t}function cQ(t){return t.setHeader&&typeof t.abort=="function"}function lQ(t,e,r,n){n=oQ(n);var i=!1;t.on("close",function(){i=!0}),Sv===void 0&&(Sv=Mh()),Sv(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,cQ(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new uQ("pipe"))}}}function kO(t){t()}function fQ(t,e){return t.pipe(e)}function dQ(t){return!t.length||typeof t[t.length-1]!="function"?HO:t.pop()}function hQ(){for(var t=arguments.length,e=new Array(t),r=0;r0;return lQ(o,u,c,function(f){i||(i=f),f&&s.forEach(kO),!u&&(s.forEach(kO),n(i))})});return e.reduce(fQ)}jO.exports=hQ});var Tv=A((Vr,zO)=>{l();Vr=zO.exports=cv();Vr.Stream=Vr;Vr.Readable=Vr;Vr.Writable=ov();Vr.Duplex=zs();Vr.Transform=_v();Vr.PassThrough=VO();Vr.finished=Mh();Vr.pipeline=QO()});var KO=A((Hle,$O)=>{l();var{Transform:pQ}=Tv();$O.exports=t=>class WO extends pQ{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 WO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var XO=A((Gle,JO)=>{l();var{Transform:gQ}=Tv();JO.exports=t=>class YO extends gQ{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 YO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var e2=A((Qle,ZO)=>{l();var yQ=KO(),mQ=XO();ZO.exports=function(t){let e=yQ(t),r=mQ(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 n2=A(r2=>{l();var t2=[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];r2.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],c=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],g=f^(i<<1|s>>>31),m=d^(s<<1|i>>>31),y=t[0]^g,b=t[1]^m,O=t[10]^g,R=t[11]^m,z=t[20]^g,M=t[21]^m,E=t[30]^g,S=t[31]^m,N=t[40]^g,_=t[41]^m;g=r^(o<<1|a>>>31),m=n^(a<<1|o>>>31);let T=t[2]^g,B=t[3]^m,X=t[12]^g,Q=t[13]^m,H=t[22]^g,j=t[23]^m,K=t[32]^g,me=t[33]^m,ce=t[42]^g,ie=t[43]^m;g=i^(u<<1|c>>>31),m=s^(c<<1|u>>>31);let J=t[4]^g,oe=t[5]^m,re=t[14]^g,se=t[15]^m,U=t[24]^g,fe=t[25]^m,ue=t[34]^g,de=t[35]^m,ae=t[44]^g,le=t[45]^m;g=o^(f<<1|d>>>31),m=a^(d<<1|f>>>31);let w=t[6]^g,v=t[7]^m,I=t[16]^g,P=t[17]^m,C=t[26]^g,D=t[27]^m,L=t[36]^g,x=t[37]^m,F=t[46]^g,k=t[47]^m;g=u^(r<<1|n>>>31),m=c^(n<<1|r>>>31);let q=t[8]^g,ee=t[9]^m,Ae=t[18]^g,Se=t[19]^m,Be=t[28]^g,it=t[29]^m,dt=t[38]^g,De=t[39]^m,Ve=t[48]^g,Lt=t[49]^m,Ei=y,Ss=b,Ts=R<<4|O>>>28,cr=O<<4|R>>>28,Qn=z<<3|M>>>29,Kt=M<<3|z>>>29,Ft=S<<9|E>>>23,Je=E<<9|S>>>23,s0=N<<18|_>>>14,o0=_<<18|N>>>14,a0=T<<1|B>>>31,u0=B<<1|T>>>31,c0=Q<<12|X>>>20,l0=X<<12|Q>>>20,f0=H<<10|j>>>22,d0=j<<10|H>>>22,h0=me<<13|K>>>19,p0=K<<13|me>>>19,g0=ce<<2|ie>>>30,y0=ie<<2|ce>>>30,m0=oe<<30|J>>>2,w0=J<<30|oe>>>2,E0=re<<6|se>>>26,v0=se<<6|re>>>26,A0=fe<<11|U>>>21,b0=U<<11|fe>>>21,I0=ue<<15|de>>>17,_0=de<<15|ue>>>17,S0=le<<29|ae>>>3,T0=ae<<29|le>>>3,C0=w<<28|v>>>4,x0=v<<28|w>>>4,N0=P<<23|I>>>9,O0=I<<23|P>>>9,D0=C<<25|D>>>7,P0=D<<25|C>>>7,R0=L<<21|x>>>11,B0=x<<21|L>>>11,L0=k<<24|F>>>8,F0=F<<24|k>>>8,M0=q<<27|ee>>>5,U0=ee<<27|q>>>5,q0=Ae<<20|Se>>>12,V0=Se<<20|Ae>>>12,H0=it<<7|Be>>>25,k0=Be<<7|it>>>25,G0=dt<<8|De>>>24,j0=De<<8|dt>>>24,Q0=Ve<<14|Lt>>>18,z0=Lt<<14|Ve>>>18;t[0]=Ei^~c0&A0,t[1]=Ss^~l0&b0,t[10]=C0^~q0&Qn,t[11]=x0^~V0&Kt,t[20]=a0^~E0&D0,t[21]=u0^~v0&P0,t[30]=M0^~Ts&f0,t[31]=U0^~cr&d0,t[40]=m0^~N0&H0,t[41]=w0^~O0&k0,t[2]=c0^~A0&R0,t[3]=l0^~b0&B0,t[12]=q0^~Qn&h0,t[13]=V0^~Kt&p0,t[22]=E0^~D0&G0,t[23]=v0^~P0&j0,t[32]=Ts^~f0&I0,t[33]=cr^~d0&_0,t[42]=N0^~H0&Ft,t[43]=O0^~k0&Je,t[4]=A0^~R0&Q0,t[5]=b0^~B0&z0,t[14]=Qn^~h0&S0,t[15]=Kt^~p0&T0,t[24]=D0^~G0&s0,t[25]=P0^~j0&o0,t[34]=f0^~I0&L0,t[35]=d0^~_0&F0,t[44]=H0^~Ft&g0,t[45]=k0^~Je&y0,t[6]=R0^~Q0&Ei,t[7]=B0^~z0&Ss,t[16]=h0^~S0&C0,t[17]=p0^~T0&x0,t[26]=G0^~s0&a0,t[27]=j0^~o0&u0,t[36]=I0^~L0&M0,t[37]=_0^~F0&U0,t[46]=Ft^~g0&m0,t[47]=Je^~y0&w0,t[8]=Q0^~Ei&c0,t[9]=z0^~Ss&l0,t[18]=S0^~C0&q0,t[19]=T0^~x0&V0,t[28]=s0^~a0&E0,t[29]=o0^~u0&v0,t[38]=L0^~M0&Ts,t[39]=F0^~U0&cr,t[48]=g0^~m0&N0,t[49]=y0^~w0&O0,t[0]^=t2[e*2],t[1]^=t2[e*2+1]}}});var s2=A((Kle,i2)=>{l();var Qh=n2();function _a(){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}_a.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};_a.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Qh.p1600(this.state),this.count=0);return e};_a.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};i2.exports=_a});var Cv=A((Jle,o2)=>{l();o2.exports=e2()(s2())});var Dv=A(Sa=>{"use strict";l();var wQ=Sa&&Sa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sa,"__esModule",{value:!0});Sa.SmartContract=void 0;var EQ=wQ(Yt()),$c=pt(),xv=ah(),vQ=Le(),Nv=Yr(),AQ=br(),bQ=Tc(),a2=NE(),u2=qc(),c2=UE(),IQ=HE(),_Q=Vc(),zh=$E(),SQ=Cv(),Ov=class{constructor(e={}){this.address=new $c.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new $c.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 u2.ContractFunction(i);return new c2.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new u2.ContractFunction(i),a=IQ.NativeSerializer.nativeToTypedValues(s||[],n);return new c2.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return AQ.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}){xv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new a2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Nv.Transaction({receiver:$c.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){xv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new a2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Nv.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){xv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let c=new zh.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new Nv.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:c,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new _Q.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new vQ.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new $c.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new EQ.default(r.valueOf().toString(10)),u=bQ.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let c=h.Buffer.concat([i,o]),f=SQ("keccak256").update(c).digest(),d=h.Buffer.from(zh.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new $c.Address(g)}};Sa.SmartContract=Ov});var Wh=A(Js=>{"use strict";l();Object.defineProperty(Js,"__esModule",{value:!0});Js.SignableMessage=Js.MESSAGE_PREFIX=void 0;var TQ=pt(),CQ=Rc(),xQ=Cv();Js.MESSAGE_PREFIX=`Elrond Signed Message: +`;var Pv=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new TQ.Address,Object.assign(this,e)}serializeForSigning(){let e=h.Buffer.from(this.message.length.toString()),r=h.Buffer.concat([e,this.message]),n=h.Buffer.concat([h.Buffer.from(Js.MESSAGE_PREFIX),r]);return xQ("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=CQ.interpretSignatureAsBuffer(e)}getMessageSize(){let e=h.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};Js.SignableMessage=Pv});var Rv=A(l2=>{"use strict";l();Object.defineProperty(l2,"__esModule",{value:!0})});var Ta=A(Ht=>{"use strict";l();var NQ=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]}),OQ=Ht&&Ht.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DQ=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)&&NQ(e,t,r);return OQ(e,t),e};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.zeroPadStringIfOddLength=Ht.isPaddedHex=Ht.numberToPaddedHex=Ht.Nonce=Ht.Address=void 0;var f2=DQ(tw()),PQ="erd",Bv=class t{constructor(e){this.value=e}static fromPubkey(e){let r=f2.toWords(e),n=f2.encode(PQ,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Ht.Address=Bv;var Lv=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return d2(this.value)}};Ht.Nonce=Lv;function d2(t){let e=t.toString(16);return h2(e)}Ht.numberToPaddedHex=d2;function RQ(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ht.isPaddedHex=RQ;function h2(t){return t=t||"",t.length%2==1?"0"+t:t}Ht.zeroPadStringIfOddLength=h2});var p2=A(Hi=>{"use strict";l();var BQ=Hi&&Hi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hi,"__esModule",{value:!0});Hi.EsdtContractAddress=Hi.MaxUint64AsBigNumber=void 0;var LQ=BQ(Yt()),FQ=Ta();Hi.MaxUint64AsBigNumber=new LQ.default("18446744073709551615");Hi.EsdtContractAddress=new FQ.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var Mv=A(Ca=>{"use strict";l();var MQ=Ca&&Ca.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ContractQueryResponse=void 0;var UQ=MQ(Yt()),qQ=p2(),Fv=class t{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 UQ.default(e.gasRemaining||e.GasRemaining||0),o=qQ.MaxUint64AsBigNumber.minus(s).toNumber();return new t({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()}}};Ca.ContractQueryResponse=Fv});var g2=A(ki=>{"use strict";l();Object.defineProperty(ki,"__esModule",{value:!0});ki.ErrAccountNotConnected=ki.ErrCannotSignSingleTransaction=ki.Err=void 0;var Kc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};ki.Err=Kc;var Uv=class extends Kc{constructor(){super("Cannot sign single transaction.")}};ki.ErrCannotSignSingleTransaction=Uv;var qv=class extends Kc{constructor(){super("Account is not connected.")}};ki.ErrAccountNotConnected=qv});var y2=A(Yc=>{"use strict";l();Object.defineProperty(Yc,"__esModule",{value:!0});Yc.Operation=void 0;var VQ;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(VQ=Yc.Operation||(Yc.Operation={}))});var Vv=A(xa=>{"use strict";l();var Gi=xa&&xa.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(xa,"__esModule",{value:!0});xa.ExtensionProvider=void 0;var HQ=Yr(),m2=g2(),Jc=y2(),Xc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Gi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Gi(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(Jc.Operation.Connect,n),this.account.address})}logout(){return Gi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Jc.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 Gi(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 Gi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Gi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new m2.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new m2.ErrAccountNotConnected}signTransactions(e){return Gi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Jc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>HQ.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Gi(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Jc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Jc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(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)})}};xa.ExtensionProvider=Xc;Xc._instance=new Xc});function QQ(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){zQ(t);return}return e}function zQ(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zc(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!jQ.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(kQ.test(t)||GQ.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,QQ)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var kQ,GQ,jQ,b2=he(()=>{l();kQ=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,GQ=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,jQ=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function WQ(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mt(t,...e){try{return WQ(t(...e))}catch(r){return Promise.reject(r)}}function $Q(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function KQ(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function el(t){if($Q(t))return String(t);if(KQ(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return el(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function I2(){if(typeof h.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function _2(t){if(typeof t=="string")return t;I2();let e=h.Buffer.from(t).toString("base64");return Hv+e}function S2(t){return typeof t!="string"||!t.startsWith(Hv)?t:(I2(),h.Buffer.from(t.slice(Hv.length),"base64"))}function ir(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function T2(...t){return ir(t.join(":"))}function tl(t){return t=ir(t),t?t+":":""}var Hv,C2=he(()=>{l();Hv="base64:"});function O2(t={}){let e={mounts:{"":t.driver||JQ()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(d=>d.startsWith(c)||f&&c.startsWith(d)).map(d=>({relativeBase:c.length>d.length?c.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),i=(c,f)=>{if(e.watching){f=ir(f);for(let d of e.watchListeners)d(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await x2(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},a=(c,f,d)=>{let g=new Map,m=y=>{let b=g.get(y.base);return b||(b={driver:y.driver,base:y.base,items:[]},g.set(y.base,b)),b};for(let y of c){let b=typeof y=="string",O=ir(b?y:y.key),R=b?void 0:y.value,z=b||!y.options?f:{...f,...y.options},M=r(O);m(M).items.push({key:O,value:R,relativeKey:M.relativeKey,options:z})}return Promise.all([...g.values()].map(y=>d(y))).then(y=>y.flat())},u={hasItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.hasItem,d,f)},getItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.getItem,d,f).then(m=>Zc(m))},getItems(c,f){return a(c,f,d=>d.driver.getItems?Mt(d.driver.getItems,d.items.map(g=>({key:g.relativeKey,options:g.options})),f).then(g=>g.map(m=>({key:T2(d.base,m.key),value:Zc(m.value)}))):Promise.all(d.items.map(g=>Mt(d.driver.getItem,g.relativeKey,g.options).then(m=>({key:g.key,value:Zc(m)})))))},getItemRaw(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return g.getItemRaw?Mt(g.getItemRaw,d,f):Mt(g.getItem,d,f).then(m=>S2(m))},async setItem(c,f,d={}){if(f===void 0)return u.removeItem(c);c=ir(c);let{relativeKey:g,driver:m}=r(c);m.setItem&&(await Mt(m.setItem,g,el(f),d),m.watch||i("update",c))},async setItems(c,f){await a(c,f,async d=>{d.driver.setItems&&await Mt(d.driver.setItems,d.items.map(g=>({key:g.relativeKey,value:el(g.value),options:g.options})),f),d.driver.setItem&&await Promise.all(d.items.map(g=>Mt(d.driver.setItem,g.relativeKey,el(g.value),g.options)))})},async setItemRaw(c,f,d={}){if(f===void 0)return u.removeItem(c,d);c=ir(c);let{relativeKey:g,driver:m}=r(c);if(m.setItemRaw)await Mt(m.setItemRaw,g,f,d);else if(m.setItem)await Mt(m.setItem,g,_2(f),d);else return;m.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c);g.removeItem&&(await Mt(g.removeItem,d,f),(f.removeMeta||f.removeMata)&&await Mt(g.removeItem,d+"$",f),g.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c),m=Object.create(null);if(g.getMeta&&Object.assign(m,await Mt(g.getMeta,d,f)),!f.nativeOnly){let y=await Mt(g.getItem,d+"$",f).then(b=>Zc(b));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(m,y))}return m},setMeta(c,f,d={}){return this.setItem(c+"$",f,d)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=tl(c);let d=n(c,!0),g=[],m=[];for(let y of d){let O=(await Mt(y.driver.getKeys,y.relativeBase,f)).map(R=>y.mountpoint+ir(R)).filter(R=>!g.some(z=>R.startsWith(z)));m.push(...O),g=[y.mountpoint,...g.filter(R=>!R.startsWith(y.mountpoint))]}return c?m.filter(y=>y.startsWith(c)&&!y.endsWith("$")):m.filter(y=>!y.endsWith("$"))},async clear(c,f={}){c=tl(c),await Promise.all(n(c,!1).map(async d=>{if(d.driver.clear)return Mt(d.driver.clear,d.relativeBase,f);if(d.driver.removeItem){let g=await d.driver.getKeys(d.relativeBase||"",f);return Promise.all(g.map(m=>d.driver.removeItem(m,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>N2(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=tl(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((d,g)=>g.length-d.length)),e.mounts[c]=f,e.watching&&Promise.resolve(x2(f,i,c)).then(d=>{e.unwatch[c]=d}).catch(console.error),u},async unmount(c,f=!0){c=tl(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await N2(e.mounts[c]),e.mountpoints=e.mountpoints.filter(d=>d!==c),delete e.mounts[c])},getMount(c=""){c=ir(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=ir(c),n(c,f.parents).map(g=>({driver:g.driver,base:g.mountpoint}))}};return u}function x2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function N2(t){typeof t.dispose=="function"&&await Mt(t.dispose)}var YQ,JQ,D2=he(()=>{l();b2();C2();YQ="memory",JQ=()=>{let t=new Map;return{name:YQ,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function Xs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Gv(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Xs(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function rl(){return kv||(kv=Gv("keyval-store","keyval")),kv}function jv(t,e=rl()){return e("readonly",r=>Xs(r.get(t)))}function P2(t,e,r=rl()){return r("readwrite",n=>(n.put(e,t),Xs(n.transaction)))}function R2(t,e=rl()){return e("readwrite",r=>(r.delete(t),Xs(r.transaction)))}function B2(t=rl()){return t("readwrite",e=>(e.clear(),Xs(e.transaction)))}function XQ(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xs(t.transaction)}function L2(t=rl()){return t("readonly",e=>{if(e.getAllKeys)return Xs(e.getAllKeys());let r=[];return XQ(e,n=>r.push(n.key)).then(()=>r)})}var kv,F2=he(()=>{l()});var M2={};ft(M2,{safeJsonParse:()=>Qi,safeJsonStringify:()=>zi});function Qi(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return e7(t)}catch{return t}}function zi(t){return typeof t=="string"?t:ZQ(t)||""}var ZQ,e7,nl=he(()=>{l();ZQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),e7=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 q2={};ft(q2,{KeyValueStorage:()=>$v,default:()=>$v});function s7(t){var e;return[t[0],Qi((e=t[1])!=null?e:"")]}var t7,r7,n7,i7,zv,Qv,Jh,Wv,o7,U2,a7,u7,$v,V2=he(()=>{l();D2();F2();nl();t7="idb-keyval",r7=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=Gv(t.dbName,t.storeName)),{name:t7,options:t,async hasItem(i){return!(typeof await jv(r(i),n)>"u")},async getItem(i){return await jv(r(i),n)??null},setItem(i,s){return P2(r(i),s,n)},removeItem(i){return R2(r(i),n)},getKeys(){return L2(n)},clear(){return B2(n)}}},n7="WALLET_CONNECT_V2_INDEXED_DB",i7="keyvaluestorage",zv=class{constructor(){this.indexedDb=O2({driver:r7({dbName:n7,storeName:i7})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,zi(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},Qv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Jh={exports:{}};(function(){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 Qv<"u"&&Qv.localStorage?Jh.exports=Qv.localStorage:typeof window<"u"&&window.localStorage?Jh.exports=window.localStorage:Jh.exports=new e})();Wv=class{constructor(){this.localStorage=Jh.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(s7)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Qi(r)}async setItem(e,r){this.localStorage.setItem(e,zi(r))}async removeItem(e){this.localStorage.removeItem(e)}},o7="wc_storage_version",U2=1,a7=async(t,e,r)=>{let n=o7,i=await e.getItem(n);if(i&&i>=U2){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let a=s.shift();if(!a)continue;let u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){let c=await t.getItem(a);await e.setItem(a,c),o.push(a)}}await e.setItem(n,U2),r(e),u7(t,o)},u7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},$v=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new Wv;this.storage=e;try{let r=new zv;a7(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var Zr={};ft(Zr,{__assign:()=>Yv,__asyncDelegator:()=>A7,__asyncGenerator:()=>v7,__asyncValues:()=>b7,__await:()=>il,__awaiter:()=>p7,__classPrivateFieldGet:()=>T7,__classPrivateFieldSet:()=>C7,__createBinding:()=>y7,__decorate:()=>f7,__exportStar:()=>m7,__extends:()=>c7,__generator:()=>g7,__importDefault:()=>S7,__importStar:()=>_7,__makeTemplateObject:()=>I7,__metadata:()=>h7,__param:()=>d7,__read:()=>H2,__rest:()=>l7,__spread:()=>w7,__spreadArrays:()=>E7,__values:()=>Jv});function c7(t,e){Kv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function l7(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 d7(t,e){return function(r,n){e(r,n,t)}}function h7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function p7(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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function g7(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(c){return function(f){return u([c,f])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[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 H2(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 w7(){for(var t=[],e=0;e1||a(g,m)})})}function a(g,m){try{u(n[g](m))}catch(y){d(s[0][3],y)}}function u(g){g.value instanceof il?Promise.resolve(g.value.v).then(c,f):d(s[0][2],g)}function c(g){a("next",g)}function f(g){a("throw",g)}function d(g,m){g(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function A7(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:il(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function b7(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 Jv=="function"?Jv(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(c){s({value:c,done:a})},o)}}function I7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function _7(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 S7(t){return t&&t.__esModule?t:{default:t}}function T7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function C7(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 Kv,Yv,en=he(()=>{l();Kv=function(t,e){return Kv=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])},Kv(t,e)};Yv=function(){return Yv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";l();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.delay=void 0;function x7(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Xh.delay=x7});var G2=A(Na=>{"use strict";l();Object.defineProperty(Na,"__esModule",{value:!0});Na.ONE_THOUSAND=Na.ONE_HUNDRED=void 0;Na.ONE_HUNDRED=100;Na.ONE_THOUSAND=1e3});var j2=A(ge=>{"use strict";l();Object.defineProperty(ge,"__esModule",{value:!0});ge.ONE_YEAR=ge.FOUR_WEEKS=ge.THREE_WEEKS=ge.TWO_WEEKS=ge.ONE_WEEK=ge.THIRTY_DAYS=ge.SEVEN_DAYS=ge.FIVE_DAYS=ge.THREE_DAYS=ge.ONE_DAY=ge.TWENTY_FOUR_HOURS=ge.TWELVE_HOURS=ge.SIX_HOURS=ge.THREE_HOURS=ge.ONE_HOUR=ge.SIXTY_MINUTES=ge.THIRTY_MINUTES=ge.TEN_MINUTES=ge.FIVE_MINUTES=ge.ONE_MINUTE=ge.SIXTY_SECONDS=ge.THIRTY_SECONDS=ge.TEN_SECONDS=ge.FIVE_SECONDS=ge.ONE_SECOND=void 0;ge.ONE_SECOND=1;ge.FIVE_SECONDS=5;ge.TEN_SECONDS=10;ge.THIRTY_SECONDS=30;ge.SIXTY_SECONDS=60;ge.ONE_MINUTE=ge.SIXTY_SECONDS;ge.FIVE_MINUTES=ge.ONE_MINUTE*5;ge.TEN_MINUTES=ge.ONE_MINUTE*10;ge.THIRTY_MINUTES=ge.ONE_MINUTE*30;ge.SIXTY_MINUTES=ge.ONE_MINUTE*60;ge.ONE_HOUR=ge.SIXTY_MINUTES;ge.THREE_HOURS=ge.ONE_HOUR*3;ge.SIX_HOURS=ge.ONE_HOUR*6;ge.TWELVE_HOURS=ge.ONE_HOUR*12;ge.TWENTY_FOUR_HOURS=ge.ONE_HOUR*24;ge.ONE_DAY=ge.TWENTY_FOUR_HOURS;ge.THREE_DAYS=ge.ONE_DAY*3;ge.FIVE_DAYS=ge.ONE_DAY*5;ge.SEVEN_DAYS=ge.ONE_DAY*7;ge.THIRTY_DAYS=ge.ONE_DAY*30;ge.ONE_WEEK=ge.SEVEN_DAYS;ge.TWO_WEEKS=ge.ONE_WEEK*2;ge.THREE_WEEKS=ge.ONE_WEEK*3;ge.FOUR_WEEKS=ge.ONE_WEEK*4;ge.ONE_YEAR=ge.ONE_DAY*365});var Xv=A(Zh=>{"use strict";l();Object.defineProperty(Zh,"__esModule",{value:!0});var Q2=(en(),ht(Zr));Q2.__exportStar(G2(),Zh);Q2.__exportStar(j2(),Zh)});var W2=A(Oa=>{"use strict";l();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.fromMiliseconds=Oa.toMiliseconds=void 0;var z2=Xv();function N7(t){return t*z2.ONE_THOUSAND}Oa.toMiliseconds=N7;function O7(t){return Math.floor(t/z2.ONE_THOUSAND)}Oa.fromMiliseconds=O7});var K2=A(ep=>{"use strict";l();Object.defineProperty(ep,"__esModule",{value:!0});var $2=(en(),ht(Zr));$2.__exportStar(k2(),ep);$2.__exportStar(W2(),ep)});var Y2=A(sl=>{"use strict";l();Object.defineProperty(sl,"__esModule",{value:!0});sl.Watch=void 0;var tp=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}};sl.Watch=tp;sl.default=tp});var J2=A(rp=>{"use strict";l();Object.defineProperty(rp,"__esModule",{value:!0});rp.IWatch=void 0;var Zv=class{};rp.IWatch=Zv});var X2=A(e1=>{"use strict";l();Object.defineProperty(e1,"__esModule",{value:!0});var D7=(en(),ht(Zr));D7.__exportStar(J2(),e1)});var Zs=A(Da=>{"use strict";l();Object.defineProperty(Da,"__esModule",{value:!0});var np=(en(),ht(Zr));np.__exportStar(K2(),Da);np.__exportStar(Y2(),Da);np.__exportStar(X2(),Da);np.__exportStar(Xv(),Da)});var t1,Z2=he(()=>{l();t1=class{}});var r1={};ft(r1,{IEvents:()=>t1});var n1=he(()=>{l();Z2()});var eD=A(ip=>{"use strict";l();Object.defineProperty(ip,"__esModule",{value:!0});ip.IHeartBeat=void 0;var P7=(n1(),ht(r1)),i1=class extends P7.IEvents{constructor(e){super()}};ip.IHeartBeat=i1});var o1=A(s1=>{"use strict";l();Object.defineProperty(s1,"__esModule",{value:!0});var R7=(en(),ht(Zr));R7.__exportStar(eD(),s1)});var tD=A(Pa=>{"use strict";l();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HEARTBEAT_EVENTS=Pa.HEARTBEAT_INTERVAL=void 0;var B7=Zs();Pa.HEARTBEAT_INTERVAL=B7.FIVE_SECONDS;Pa.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var u1=A(a1=>{"use strict";l();Object.defineProperty(a1,"__esModule",{value:!0});var L7=(en(),ht(Zr));L7.__exportStar(tD(),a1)});var rD=A(sp=>{"use strict";l();Object.defineProperty(sp,"__esModule",{value:!0});sp.HeartBeat=void 0;var c1=(en(),ht(Zr)),F7=ti(),M7=Zs(),U7=o1(),l1=u1(),f1=class t extends U7.IHeartBeat{constructor(e){super(e),this.events=new F7.EventEmitter,this.interval=l1.HEARTBEAT_INTERVAL,this.interval=e?.interval||l1.HEARTBEAT_INTERVAL}static init(e){return c1.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return c1.__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 c1.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),M7.toMiliseconds(this.interval))})}pulse(){this.events.emit(l1.HEARTBEAT_EVENTS.pulse)}};sp.HeartBeat=f1});var nD=A(ol=>{"use strict";l();Object.defineProperty(ol,"__esModule",{value:!0});var d1=(en(),ht(Zr));d1.__exportStar(rD(),ol);d1.__exportStar(o1(),ol);d1.__exportStar(u1(),ol)});var sD=A((Ide,iD)=>{"use strict";l();function q7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}iD.exports=V7;function V7(t,e,r){var n=r&&r.stringify||q7,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(m+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=m+2,m++;break}c+=n(e[f]),d=m+2,m++;break;case 115:if(f>=u)break;d{"use strict";l();var oD=sD();cD.exports=xn;var al=Y7().console||{},H7={mapHttpRequest:op,mapHttpResponse:op,wrapRequestSerializer:h1,wrapResponseSerializer:h1,wrapErrorSerializer:h1,req:op,res:op,err:z7};function k7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function xn(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||al;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=k7(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=ul),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:W7(t)};u.levels=xn.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=ul,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=m,e&&(u._logEvent=p1());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,Ra(c,u,"error","log"),Ra(c,u,"fatal","error"),Ra(c,u,"warn","error"),Ra(c,u,"info","log"),Ra(c,u,"debug","log"),Ra(c,u,"trace","log")}function m(y,b){if(!y)throw new Error("missing bindings for child Pino");b=b||{},i&&y.serializers&&(b.serializers=y.serializers);let O=b.serializers;if(i&&O){var R=Object.assign({},n,O),z=t.browser.serialize===!0?Object.keys(R):i;delete y.serializers,ap([y],z,R,this._stdErrSerialize)}function M(E){this._childLevel=(E._childLevel|0)+1,this.error=Ba(E,y,"error"),this.fatal=Ba(E,y,"fatal"),this.warn=Ba(E,y,"warn"),this.info=Ba(E,y,"info"),this.debug=Ba(E,y,"debug"),this.trace=Ba(E,y,"trace"),R&&(this.serializers=R,this._serialize=z),e&&(this._logEvent=p1([].concat(E._logEvent.bindings,y)))}return M.prototype=this,new M(this)}return u}xn.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"}};xn.stdSerializers=H7;xn.stdTimeFunctions=Object.assign({},{nullTime:aD,epochTime:uD,unixTime:$7,isoTime:K7});function Ra(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?ul:i[r]?i[r]:al[r]||al[n]||ul,G7(t,e,r)}function G7(t,e,r){!t.transmit&&e[r]===ul||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===al?al:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Ba(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";l();Object.defineProperty(La,"__esModule",{value:!0});La.PINO_CUSTOM_CONTEXT_KEY=La.PINO_LOGGER_DEFAULTS=void 0;La.PINO_LOGGER_DEFAULTS={level:"info"};La.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var gD=A(mr=>{"use strict";l();Object.defineProperty(mr,"__esModule",{value:!0});mr.generateChildLogger=mr.formatChildLoggerContext=mr.getLoggerContext=mr.setBrowserLoggerContext=mr.getBrowserLoggerContext=mr.getDefaultLoggerOptions=void 0;var Fa=g1();function J7(t){return Object.assign(Object.assign({},t),{level:t?.level||Fa.PINO_LOGGER_DEFAULTS.level})}mr.getDefaultLoggerOptions=J7;function fD(t,e=Fa.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}mr.getBrowserLoggerContext=fD;function dD(t,e,r=Fa.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}mr.setBrowserLoggerContext=dD;function hD(t,e=Fa.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=fD(t,e):r=t.bindings().context||"",r}mr.getLoggerContext=hD;function pD(t,e,r=Fa.PINO_CUSTOM_CONTEXT_KEY){let n=hD(t,r);return n.trim()?`${n}/${e}`:e}mr.formatChildLoggerContext=pD;function X7(t,e,r=Fa.PINO_CUSTOM_CONTEXT_KEY){let n=pD(t,e,r),i=t.child({context:n});return dD(i,n,r)}mr.generateChildLogger=X7});var m1=A(Ma=>{"use strict";l();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.pino=void 0;var y1=(en(),ht(Zr)),Z7=y1.__importDefault(lD());Object.defineProperty(Ma,"pino",{enumerable:!0,get:function(){return Z7.default}});y1.__exportStar(g1(),Ma);y1.__exportStar(gD(),Ma)});var F1=A(Ot=>{"use strict";l();Object.defineProperty(Ot,"__esModule",{value:!0});var Ua=(n1(),ht(r1)),yD=ti();function e9(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var t9=e9(yD),w1=class extends Ua.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},E1=class{constructor(e,r,n){this.core=e,this.logger=r}},v1=class extends Ua.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},A1=class{constructor(e,r){this.logger=e,this.core=r}},b1=class extends Ua.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},I1=class extends Ua.IEvents{constructor(e){super()}},_1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},S1=class{constructor(){this.map=new Map}},T1=class extends Ua.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},C1=class{constructor(e,r){this.core=e,this.logger=r}},x1=class extends Ua.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},N1=class{constructor(e,r){this.logger=e,this.core=r}},O1=class{constructor(e,r){this.projectId=e,this.logger=r}},D1=class{constructor(e,r){this.projectId=e,this.logger=r}},P1=class extends t9.default{constructor(){super()}},R1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},B1=class extends yD.EventEmitter{constructor(){super()}},L1=class{constructor(e){this.client=e}};Ot.ICore=w1,Ot.ICrypto=E1,Ot.IEchoClient=D1,Ot.IEngine=L1,Ot.IEngineEvents=B1,Ot.IExpirer=x1,Ot.IJsonRpcHistory=v1,Ot.IKeyChain=C1,Ot.IMessageTracker=A1,Ot.IPairing=N1,Ot.IPublisher=b1,Ot.IRelayer=I1,Ot.ISignClient=R1,Ot.ISignClientEvents=P1,Ot.IStore=_1,Ot.ISubscriber=T1,Ot.ISubscriberTopicMap=S1,Ot.IVerify=O1});var wD=A(up=>{"use strict";l();Object.defineProperty(up,"__esModule",{value:!0});up.BrowserRandomSource=void 0;var mD=65536,M1=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";l();Object.defineProperty(U1,"__esModule",{value:!0});function r9(t){for(var e=0;e{l()});var vD=A(cp=>{"use strict";l();Object.defineProperty(cp,"__esModule",{value:!0});cp.NodeRandomSource=void 0;var n9=Hr(),q1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof TS<"u"){let e=ED();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";l();Object.defineProperty(lp,"__esModule",{value:!0});lp.SystemRandomSource=void 0;var i9=wD(),s9=vD(),V1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new i9.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new s9.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)}};lp.SystemRandomSource=V1});var bD=A(Ir=>{"use strict";l();Object.defineProperty(Ir,"__esModule",{value:!0});function o9(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}Ir.mul=Math.imul||o9;function a9(t,e){return t+e|0}Ir.add=a9;function u9(t,e){return t-e|0}Ir.sub=u9;function c9(t,e){return t<>>32-e}Ir.rotl=c9;function l9(t,e){return t<<32-e|t>>>e}Ir.rotr=l9;function f9(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ir.isInteger=Number.isInteger||f9;Ir.MAX_SAFE_INTEGER=9007199254740991;Ir.isSafeInteger=function(t){return Ir.isInteger(t)&&t>=-Ir.MAX_SAFE_INTEGER&&t<=Ir.MAX_SAFE_INTEGER}});var qa=A(Oe=>{"use strict";l();Object.defineProperty(Oe,"__esModule",{value:!0});var ID=bD();function d9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Oe.readInt16BE=d9;function h9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Oe.readUint16BE=h9;function p9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Oe.readInt16LE=p9;function g9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Oe.readUint16LE=g9;function _D(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}Oe.writeUint16BE=_D;Oe.writeInt16BE=_D;function SD(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}Oe.writeUint16LE=SD;Oe.writeInt16LE=SD;function H1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Oe.readInt32BE=H1;function k1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Oe.readUint32BE=k1;function G1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Oe.readInt32LE=G1;function j1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Oe.readUint32LE=j1;function fp(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}Oe.writeUint32BE=fp;Oe.writeInt32BE=fp;function dp(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}Oe.writeUint32LE=dp;Oe.writeInt32LE=dp;function y9(t,e){e===void 0&&(e=0);var r=H1(t,e),n=H1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Oe.readInt64BE=y9;function m9(t,e){e===void 0&&(e=0);var r=k1(t,e),n=k1(t,e+4);return r*4294967296+n}Oe.readUint64BE=m9;function w9(t,e){e===void 0&&(e=0);var r=G1(t,e),n=G1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Oe.readInt64LE=w9;function E9(t,e){e===void 0&&(e=0);var r=j1(t,e),n=j1(t,e+4);return n*4294967296+r}Oe.readUint64LE=E9;function TD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fp(t/4294967296>>>0,e,r),fp(t>>>0,e,r+4),e}Oe.writeUint64BE=TD;Oe.writeInt64BE=TD;function CD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),dp(t>>>0,e,r),dp(t/4294967296>>>0,e,r+4),e}Oe.writeUint64LE=CD;Oe.writeInt64LE=CD;function v9(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}Oe.readUintBE=v9;function A9(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}Oe.writeUintBE=b9;function I9(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(!ID.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";l();Object.defineProperty(er,"__esModule",{value:!0});er.randomStringForEntropy=er.randomString=er.randomUint32=er.randomBytes=er.defaultRandomSource=void 0;var P9=AD(),R9=qa(),xD=Hr();er.defaultRandomSource=new P9.SystemRandomSource;function Q1(t,e=er.defaultRandomSource){return e.randomBytes(t)}er.randomBytes=Q1;function B9(t=er.defaultRandomSource){let e=Q1(4,t),r=(0,R9.readUint32LE)(e);return(0,xD.wipe)(e),r}er.randomUint32=B9;var ND="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function OD(t,e=ND,r=er.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=Q1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(ni,"__esModule",{value:!0});var Ha=qa(),Va=Hr();ni.DIGEST_LENGTH=64;ni.BLOCK_SIZE=128;var PD=function(){function t(){this.digestLength=ni.DIGEST_LENGTH,this.blockSize=ni.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(){Va.wipe(this._buffer),Va.wipe(this._tempHi),Va.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&&(z1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=z1(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){Va.wipe(e.stateHi),Va.wipe(e.stateLo),e.buffer&&Va.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();ni.SHA512=PD;var DD=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 z1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],c=r[2],f=r[3],d=r[4],g=r[5],m=r[6],y=r[7],b=n[0],O=n[1],R=n[2],z=n[3],M=n[4],E=n[5],S=n[6],N=n[7],_,T,B,X,Q,H,j,K;o>=128;){for(var me=0;me<16;me++){var ce=8*me+s;t[me]=Ha.readUint32BE(i,ce),e[me]=Ha.readUint32BE(i,ce+4)}for(var me=0;me<80;me++){var ie=a,J=u,oe=c,re=f,se=d,U=g,fe=m,ue=y,de=b,ae=O,le=R,w=z,v=M,I=E,P=S,C=N;if(_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(d>>>14|M<<18)^(d>>>18|M<<14)^(M>>>9|d<<23),T=(M>>>14|d<<18)^(M>>>18|d<<14)^(d>>>9|M<<23),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=d&g^~d&m,T=M&E^~M&S,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=DD[me*2],T=DD[me*2+1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=t[me%16],T=e[me%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,B=j&65535|K<<16,X=Q&65535|H<<16,_=B,T=X,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(a>>>28|b<<4)^(b>>>2|a<<30)^(b>>>7|a<<25),T=(b>>>28|a<<4)^(a>>>2|b<<30)^(a>>>7|b<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=a&u^a&c^u&c,T=b&O^b&R^O&R,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,ue=j&65535|K<<16,C=Q&65535|H<<16,_=re,T=w,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=B,T=X,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,re=j&65535|K<<16,w=Q&65535|H<<16,u=ie,c=J,f=oe,d=re,g=se,m=U,y=fe,a=ue,O=de,R=ae,z=le,M=w,E=v,S=I,N=P,b=C,me%16===15)for(var ce=0;ce<16;ce++)_=t[ce],T=e[ce],Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=t[(ce+9)%16],T=e[(ce+9)%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+1)%16],X=e[(ce+1)%16],_=(B>>>1|X<<31)^(B>>>8|X<<24)^B>>>7,T=(X>>>1|B<<31)^(X>>>8|B<<24)^(X>>>7|B<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+14)%16],X=e[(ce+14)%16],_=(B>>>19|X<<13)^(X>>>29|B<<3)^B>>>6,T=(X>>>19|B<<13)^(B>>>29|X<<3)^(X>>>6|B<<26),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,t[ce]=j&65535|K<<16,e[ce]=Q&65535|H<<16}_=a,T=b,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[0],T=n[0],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[0]=a=j&65535|K<<16,n[0]=b=Q&65535|H<<16,_=u,T=O,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[1],T=n[1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[1]=u=j&65535|K<<16,n[1]=O=Q&65535|H<<16,_=c,T=R,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[2],T=n[2],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[2]=c=j&65535|K<<16,n[2]=R=Q&65535|H<<16,_=f,T=z,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[3],T=n[3],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[3]=f=j&65535|K<<16,n[3]=z=Q&65535|H<<16,_=d,T=M,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[4],T=n[4],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[4]=d=j&65535|K<<16,n[4]=M=Q&65535|H<<16,_=g,T=E,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[5],T=n[5],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[5]=g=j&65535|K<<16,n[5]=E=Q&65535|H<<16,_=m,T=S,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[6],T=n[6],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[6]=m=j&65535|K<<16,n[6]=S=Q&65535|H<<16,_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[7],T=n[7],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[7]=y=j&65535|K<<16,n[7]=N=Q&65535|H<<16,s+=128,o-=128}return s}function F9(t){var e=new PD;e.update(t);var r=e.digest();return e.clean(),r}ni.hash=F9});var WD=A(ke=>{"use strict";l();Object.defineProperty(ke,"__esModule",{value:!0});ke.convertSecretKeyToX25519=ke.convertPublicKeyToX25519=ke.verify=ke.sign=ke.extractPublicKeyFromSecretKey=ke.generateKeyPair=ke.generateKeyPairFromSeed=ke.SEED_LENGTH=ke.SECRET_KEY_LENGTH=ke.PUBLIC_KEY_LENGTH=ke.SIGNATURE_LENGTH=void 0;var M9=cl(),ll=RD(),UD=Hr();ke.SIGNATURE_LENGTH=64;ke.PUBLIC_KEY_LENGTH=32;ke.SECRET_KEY_LENGTH=64;ke.SEED_LENGTH=32;function Te(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,qD(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 VD(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function FD(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return fl(r,t),fl(n,e),VD(r,n)}function HD(t){let e=new Uint8Array(32);return fl(e,t),e[0]&1}function k9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function eo(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ro(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $e(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,b=0,O=0,R=0,z=0,M=0,E=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],v=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*v,b+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,E+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,b+=n*v,O+=n*I,R+=n*P,z+=n*C,M+=n*D,E+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,b+=n*w,O+=n*v,R+=n*I,z+=n*P,M+=n*C,E+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,b+=n*le,O+=n*w,R+=n*v,z+=n*I,M+=n*P,E+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,b+=n*ae,O+=n*le,R+=n*w,z+=n*v,M+=n*I,E+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,b+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*v,E+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,b+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,E+=n*v,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,b+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,E+=n*w,S+=n*v,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,b+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,E+=n*le,S+=n*w,N+=n*v,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,b+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,E+=n*ae,S+=n*le,N+=n*w,_+=n*v,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],b+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,E+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*v,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,E+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*v,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,E+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*v,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,E+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*v,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,E+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*v,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],E+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*v,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,b+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=b,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=E}function to(t,e){$e(t,e,e)}function kD(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)to(r,r),n!==2&&n!==4&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function G9(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)to(r,r),n!==1&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function Y1(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te(),c=Te(),f=Te();ro(r,t[1],t[0]),ro(f,e[1],e[0]),$e(r,r,f),eo(n,t[0],t[1]),eo(f,e[0],e[1]),$e(n,n,f),$e(i,t[3],e[3]),$e(i,i,V9),$e(s,t[2],e[2]),eo(s,s,s),ro(o,n,r),ro(a,s,i),eo(u,s,i),eo(c,n,r),$e(t[0],o,a),$e(t[1],c,u),$e(t[2],u,a),$e(t[3],o,c)}function MD(t,e,r){for(let n=0;n<4;n++)qD(t[n],e[n],r)}function X1(t,e){let r=Te(),n=Te(),i=Te();kD(i,e[2]),$e(r,e[0],i),$e(n,e[1],i),fl(t,n),t[31]^=HD(r)<<7}function GD(t,e,r){Wi(t[0],K1),Wi(t[1],ka),Wi(t[2],ka),Wi(t[3],K1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;MD(t,e,i),Y1(e,t),Y1(t,t),MD(t,e,i)}}function Z1(t,e){let r=[Te(),Te(),Te(),Te()];Wi(r[0],BD),Wi(r[1],LD),Wi(r[2],ka),$e(r[3],BD,LD),GD(t,r,e)}function jD(t){if(t.length!==ke.SEED_LENGTH)throw new Error(`ed25519: seed must be ${ke.SEED_LENGTH} bytes`);let e=(0,ll.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Te(),Te(),Te(),Te()];Z1(n,e),X1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}ke.generateKeyPairFromSeed=jD;function j9(t){let e=(0,M9.randomBytes)(32,t),r=jD(e);return(0,UD.wipe)(e),r}ke.generateKeyPair=j9;function Q9(t){if(t.length!==ke.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${ke.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}ke.extractPublicKeyFromSecretKey=Q9;var $1=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 QD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*$1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*$1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function J1(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;QD(t,e)}function z9(t,e){let r=new Float64Array(64),n=[Te(),Te(),Te(),Te()],i=(0,ll.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 ll.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),J1(a),Z1(n,a),X1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();J1(u);for(let c=0;c<32;c++)r[c]=a[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=u[c]*i[f];return QD(s.subarray(32),r),s}ke.sign=z9;function zD(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te();return Wi(t[2],ka),k9(t[1],e),to(i,t[1]),$e(s,i,q9),ro(i,i,t[2]),eo(s,t[2],s),to(o,s),to(a,o),$e(u,a,o),$e(r,u,i),$e(r,r,s),G9(r,r),$e(r,r,i),$e(r,r,s),$e(r,r,s),$e(t[0],r,s),to(n,t[0]),$e(n,n,s),FD(n,i)&&$e(t[0],t[0],H9),to(n,t[0]),$e(n,n,s),FD(n,i)?-1:(HD(t[0])===e[31]>>7&&ro(t[0],K1,t[0]),$e(t[3],t[0],t[1]),0)}function W9(t,e,r){let n=new Uint8Array(32),i=[Te(),Te(),Te(),Te()],s=[Te(),Te(),Te(),Te()];if(r.length!==ke.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${ke.SIGNATURE_LENGTH} bytes`);if(zD(s,t))return!1;let o=new ll.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return J1(a),GD(i,s,a),Z1(s,r.subarray(32)),Y1(i,s),X1(n,i),!VD(r,n)}ke.verify=W9;function $9(t){let e=[Te(),Te(),Te(),Te()];if(zD(e,t))throw new Error("Ed25519: invalid public key");let r=Te(),n=Te(),i=e[1];eo(r,ka,i),ro(n,ka,i),kD(n,n),$e(r,r,n);let s=new Uint8Array(32);return fl(s,r),s}ke.convertPublicKeyToX25519=$9;function K9(t){let e=(0,ll.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,UD.wipe)(e),r}ke.convertSecretKeyToX25519=K9});var hp,pp,no,Ga,gp,dl,yp,mp,wp,ja,Ep,vp,$D,KD,Ap=he(()=>{l();hp="EdDSA",pp="JWT",no=".",Ga="base64url",gp="utf8",dl="utf8",yp=":",mp="did",wp="key",ja="base58btc",Ep="z",vp="K36",$D=32,KD=32});function $i(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var hl=he(()=>{l()});function Qa(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?$i(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var bp=he(()=>{l();hl()});function Ip(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Qa(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return $i(r)}var eA=he(()=>{l();bp();hl()});function Y9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,E=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,E[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&E[T]===0;)T++;for(var B=u.repeat(b);T>>0,M=new Uint8Array(z);y[b];){var E=r[y.charCodeAt(b)];if(E===255)return;for(var S=0,N=z-1;(E!==0||S>>0,M[N]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");R=S,b++}if(y[b]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var b=g(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var J9,X9,YD,JD=he(()=>{l();J9=Y9,X9=J9,YD=X9});var yhe,XD,ii,ZD,eP,Ki=he(()=>{l();yhe=new Uint8Array(0),XD=(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")},ZD=t=>new TextEncoder().encode(t),eP=t=>new TextDecoder().decode(t)});var tA,rA,nA,rP,iA,za,Yi,Z9,ez,yt,tn=he(()=>{l();JD();Ki();tA=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")}},rA=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 rP(this,e)}},nA=class{constructor(e){this.decoders=e}or(e){return rP(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`)}},rP=(t,e)=>new nA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),iA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new tA(e,r,n),this.decoder=new rA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},za=({name:t,prefix:e,encode:r,decode:n})=>new iA(t,e,r,n),Yi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=YD(r,e);return za({prefix:t,name:e,encode:n,decode:s=>ii(i(s))})},Z9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},ez=(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<za({prefix:e,name:t,encode(i){return ez(i,n,r)},decode(i){return Z9(i,n,r,t)}})});var sA={};ft(sA,{identity:()=>tz});var tz,nP=he(()=>{l();tn();Ki();tz=za({prefix:"\0",name:"identity",encode:t=>eP(t),decode:t=>ZD(t)})});var oA={};ft(oA,{base2:()=>rz});var rz,iP=he(()=>{l();tn();rz=yt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var aA={};ft(aA,{base8:()=>nz});var nz,sP=he(()=>{l();tn();nz=yt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var uA={};ft(uA,{base10:()=>iz});var iz,oP=he(()=>{l();tn();iz=Yi({prefix:"9",name:"base10",alphabet:"0123456789"})});var cA={};ft(cA,{base16:()=>sz,base16upper:()=>oz});var sz,oz,aP=he(()=>{l();tn();sz=yt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),oz=yt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var lA={};ft(lA,{base32:()=>Wa,base32hex:()=>lz,base32hexpad:()=>dz,base32hexpadupper:()=>hz,base32hexupper:()=>fz,base32pad:()=>uz,base32padupper:()=>cz,base32upper:()=>az,base32z:()=>pz});var Wa,az,uz,cz,lz,fz,dz,hz,pz,fA=he(()=>{l();tn();Wa=yt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),az=yt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uz=yt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cz=yt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lz=yt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fz=yt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),dz=yt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),hz=yt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),pz=yt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var dA={};ft(dA,{base36:()=>gz,base36upper:()=>yz});var gz,yz,uP=he(()=>{l();tn();gz=Yi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),yz=Yi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var hA={};ft(hA,{base58btc:()=>Nn,base58flickr:()=>mz});var Nn,mz,pA=he(()=>{l();tn();Nn=Yi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mz=Yi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var gA={};ft(gA,{base64:()=>wz,base64pad:()=>Ez,base64url:()=>vz,base64urlpad:()=>Az});var wz,Ez,vz,Az,cP=he(()=>{l();tn();wz=yt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ez=yt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vz=yt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Az=yt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var yA={};ft(yA,{base256emoji:()=>Tz});function _z(t){return t.reduce((e,r)=>(e+=bz[r],e),"")}function Sz(t){let e=[];for(let r of t){let n=Iz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var lP,bz,Iz,Tz,fP=he(()=>{l();tn();lP=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}"),bz=lP.reduce((t,e,r)=>(t[r]=e,t),[]),Iz=lP.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);Tz=za({prefix:"\u{1F680}",name:"base256emoji",encode:_z,decode:Sz})});function pP(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Oz;)e[r++]=t&255|dP,t/=128;for(;t&Nz;)e[r++]=t&255|dP,t>>>=7;return e[r]=t|0,pP.bytes=r-n+1,e}function mA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw mA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&hP)<=Pz);return mA.bytes=s-n,r}var Cz,dP,xz,Nz,Oz,Dz,Pz,hP,Rz,Bz,Lz,Fz,Mz,Uz,qz,Vz,Hz,kz,Gz,jz,pl,gP=he(()=>{l();Cz=pP,dP=128,xz=127,Nz=~xz,Oz=Math.pow(2,31);Dz=mA,Pz=128,hP=127;Rz=Math.pow(2,7),Bz=Math.pow(2,14),Lz=Math.pow(2,21),Fz=Math.pow(2,28),Mz=Math.pow(2,35),Uz=Math.pow(2,42),qz=Math.pow(2,49),Vz=Math.pow(2,56),Hz=Math.pow(2,63),kz=function(t){return t{l();gP();gl=(t,e=0)=>[pl.decode(t,e),pl.decode.bytes],$a=(t,e,r=0)=>(pl.encode(t,e,r),e),Ka=t=>pl.encodingLength(t)});var io,yP,mP,Ya,ml=he(()=>{l();Ki();Sp();io=(t,e)=>{let r=e.byteLength,n=Ka(t),i=n+Ka(r),s=new Uint8Array(i+r);return $a(t,s,0),$a(r,s,n),s.set(e,i),new Ya(t,r,e,s)},yP=t=>{let e=ii(t),[r,n]=gl(e),[i,s]=gl(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ya(r,i,o,e)},mP=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&XD(t.bytes,e.bytes),Ya=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var EA,wA,vA=he(()=>{l();ml();EA=({name:t,code:e,encode:r})=>new wA(t,e,r),wA=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?io(this.code,r):r.then(n=>io(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var AA={};ft(AA,{sha256:()=>Qz,sha512:()=>zz});var EP,Qz,zz,vP=he(()=>{l();vA();EP=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Qz=EA({name:"sha2-256",code:18,encode:EP("SHA-256")}),zz=EA({name:"sha2-512",code:19,encode:EP("SHA-512")})});var bA={};ft(bA,{identity:()=>Kz});var AP,Wz,bP,$z,Kz,IP=he(()=>{l();Ki();ml();AP=0,Wz="identity",bP=ii,$z=t=>io(AP,bP(t)),Kz={code:AP,name:Wz,encode:bP,digest:$z}});var _P=he(()=>{l();Ki()});var rpe,npe,SP=he(()=>{l();rpe=new TextEncoder,npe=new TextDecoder});var xp,Xz,Zz,eW,wl,tW,TP,CP,Tp,Cp,rW,nW,iW,xP=he(()=>{l();Sp();ml();pA();fA();Ki();xp=class t{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:Cp,byteLength:Cp,code:Tp,version:Tp,multihash:Tp,bytes:Tp,_baseCache:Cp,asCID:Cp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==wl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==tW)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=io(e,r);return t.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&&mP(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return Zz(r,i,e||Nn.encoder);default:return eW(r,i,e||Wa.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 nW(/^0\.0/,iW),!!(e&&(e[CP]||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 t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||TP(r,n,i.bytes))}else if(e!=null&&e[CP]===!0){let{version:r,multihash:n,code:i}=e,s=yP(n);return t.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!==wl)throw new Error(`Version 0 CID must use dag-pb (code: ${wl}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=TP(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,wl,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=ii(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 Ya(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,g]=gl(e.subarray(r));return r+=g,d},i=n(),s=wl;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(),c=r+u,f=c-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=Xz(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Xz=(t,e)=>{switch(t[0]){case"Q":{let r=e||Nn;return[Nn.prefix,r.decode(`${Nn.prefix}${t}`)]}case Nn.prefix:{let r=e||Nn;return[Nn.prefix,r.decode(t)]}case Wa.prefix:{let r=e||Wa;return[Wa.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)]}}},Zz=(t,e,r)=>{let{prefix:n}=r;if(n!==Nn.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},eW=(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},wl=112,tW=18,TP=(t,e,r)=>{let n=Ka(t),i=n+Ka(e),s=new Uint8Array(i+r.byteLength);return $a(t,s,0),$a(e,s,n),s.set(r,i),s},CP=Symbol.for("@ipld/js-cid/CID"),Tp={writable:!1,configurable:!1,enumerable:!0},Cp={writable:!1,enumerable:!1,configurable:!1},rW="0.0.0-dev",nW=(t,e)=>{if(t.test(rW))console.warn(e);else throw new Error(e)},iW=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -18,35 +18,35 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var bP=he(()=>{l();AP();Sp();$i();yA();ml()});var EA,tpe,IP=he(()=>{l();YD();JD();XD();ZD();eP();aA();tP();lA();rP();iP();hP();yP();mP();wP();bP();EA={...tA,...rA,...nA,...iA,...sA,...oA,...uA,...cA,...fA,...dA},tpe={...mA,...wA}});function SP(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var _P,vA,Wz,Np,AA=he(()=>{l();IP();bp();_P=SP("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),vA=SP("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ga(t.length);for(let r=0;r{l();AA()});function On(t,e="utf8"){let r=Np[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var IA=he(()=>{l();AA();hl()});function El(t){return ji(si(On(t,Ha),gp))}function vl(t){return si(On(Qi(t),gp),Ha)}function _A(t){let e=On(vp,ka),r=Ep+si(Ip([e,t]),ka);return[mp,wp,r].join(yp)}function SA(t){let[e,r,n]=t.split(yp);if(e!==mp||r!==wp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==Ep)throw new Error("Issuer must be a key in mulicodec format");let s=On(n.slice(1),ka);if(si(s.slice(0,2),ka)!==vp)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 TP(t){return si(t,Ha)}function CP(t){return On(t,Ha)}function TA(t){return On([vl(t.header),vl(t.payload)].join(no),dl)}function $z(t){let e=si(t,dl).split(no),r=El(e[0]),n=El(e[1]);return{header:r,payload:n}}function CA(t){return[vl(t.header),vl(t.payload),TP(t.signature)].join(no)}function xA(t){let e=t.split(no),r=El(e[0]),n=El(e[1]),i=CP(e[2]),s=On(e.slice(0,2).join(no),dl);return{header:r,payload:n,signature:i,data:s}}var NA=he(()=>{l();Y1();bA();IA();nl();Ap()});function Kz(t=(0,xP.randomBytes)(32)){return Ka.generateKeyPairFromSeed(t)}async function Yz(t,e,r,n,i=(0,NP.fromMiliseconds)(Date.now())){let s={alg:hp,typ:pp},o=_A(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},c=TA({header:s,payload:u}),f=Ka.sign(n.secretKey,c);return CA({header:s,payload:u,signature:f})}async function Jz(t){let{header:e,payload:r,data:n,signature:i}=xA(t);if(e.alg!==hp||e.typ!==pp)throw new Error("JWT must use EdDSA algorithm");let s=SA(r.iss);return Ka.verify(s,n,i)}var Ka,xP,NP,OP=he(()=>{l();Ka=Se(VD()),xP=Se(cl()),NP=Se(Zs());Ap();NA()});var DP=he(()=>{l()});var PP={};ft(PP,{DATA_ENCODING:()=>dl,DID_DELIMITER:()=>yp,DID_METHOD:()=>wp,DID_PREFIX:()=>mp,JSON_ENCODING:()=>gp,JWT_DELIMITER:()=>no,JWT_ENCODING:()=>Ha,JWT_IRIDIUM_ALG:()=>hp,JWT_IRIDIUM_TYP:()=>pp,KEY_PAIR_SEED_LENGTH:()=>kD,MULTICODEC_ED25519_BASE:()=>Ep,MULTICODEC_ED25519_ENCODING:()=>ka,MULTICODEC_ED25519_HEADER:()=>vp,MULTICODEC_ED25519_LENGTH:()=>HD,decodeData:()=>$z,decodeIss:()=>SA,decodeJSON:()=>El,decodeJWT:()=>xA,decodeSig:()=>CP,encodeData:()=>TA,encodeIss:()=>_A,encodeJSON:()=>vl,encodeJWT:()=>CA,encodeSig:()=>TP,generateKeyPair:()=>Kz,signJWT:()=>Yz,verifyJWT:()=>Jz});var RP=he(()=>{l();OP();Ap();DP();NA()});var LP=v(Op=>{"use strict";l();Object.defineProperty(Op,"__esModule",{value:!0});var tr=Ma(),OA=Hr(),Xz=20;function Zz(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],c=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],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],A=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],R=e[11]<<24|e[10]<<16|e[9]<<8|e[8],z=e[15]<<24|e[14]<<16|e[13]<<8|e[12],M=n,b=i,S=s,N=o,_=a,T=u,B=c,X=f,Q=d,H=g,j=m,K=y,me=A,ce=O,ie=R,J=z,oe=0;oe>>16|me<<16,Q=Q+me|0,_^=Q,_=_>>>20|_<<12,b=b+T|0,ce^=b,ce=ce>>>16|ce<<16,H=H+ce|0,T^=H,T=T>>>20|T<<12,S=S+B|0,ie^=S,ie=ie>>>16|ie<<16,j=j+ie|0,B^=j,B=B>>>20|B<<12,N=N+X|0,J^=N,J=J>>>16|J<<16,K=K+J|0,X^=K,X=X>>>20|X<<12,S=S+B|0,ie^=S,ie=ie>>>24|ie<<8,j=j+ie|0,B^=j,B=B>>>25|B<<7,N=N+X|0,J^=N,J=J>>>24|J<<8,K=K+J|0,X^=K,X=X>>>25|X<<7,b=b+T|0,ce^=b,ce=ce>>>24|ce<<8,H=H+ce|0,T^=H,T=T>>>25|T<<7,M=M+_|0,me^=M,me=me>>>24|me<<8,Q=Q+me|0,_^=Q,_=_>>>25|_<<7,M=M+T|0,J^=M,J=J>>>16|J<<16,j=j+J|0,T^=j,T=T>>>20|T<<12,b=b+B|0,me^=b,me=me>>>16|me<<16,K=K+me|0,B^=K,B=B>>>20|B<<12,S=S+X|0,ce^=S,ce=ce>>>16|ce<<16,Q=Q+ce|0,X^=Q,X=X>>>20|X<<12,N=N+_|0,ie^=N,ie=ie>>>16|ie<<16,H=H+ie|0,_^=H,_=_>>>20|_<<12,S=S+X|0,ce^=S,ce=ce>>>24|ce<<8,Q=Q+ce|0,X^=Q,X=X>>>25|X<<7,N=N+_|0,ie^=N,ie=ie>>>24|ie<<8,H=H+ie|0,_^=H,_=_>>>25|_<<7,b=b+B|0,me^=b,me=me>>>24|me<<8,K=K+me|0,B^=K,B=B>>>25|B<<7,M=M+T|0,J^=M,J=J>>>24|J<<8,j=j+J|0,T^=j,T=T>>>25|T<<7;tr.writeUint32LE(M+n|0,t,0),tr.writeUint32LE(b+i|0,t,4),tr.writeUint32LE(S+s|0,t,8),tr.writeUint32LE(N+o|0,t,12),tr.writeUint32LE(_+a|0,t,16),tr.writeUint32LE(T+u|0,t,20),tr.writeUint32LE(B+c|0,t,24),tr.writeUint32LE(X+f|0,t,28),tr.writeUint32LE(Q+d|0,t,32),tr.writeUint32LE(H+g|0,t,36),tr.writeUint32LE(j+m|0,t,40),tr.writeUint32LE(K+y|0,t,44),tr.writeUint32LE(me+A|0,t,48),tr.writeUint32LE(ce+O|0,t,52),tr.writeUint32LE(ie+R|0,t,56),tr.writeUint32LE(J+z|0,t,60)}function BP(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 Dp=v(Ya=>{"use strict";l();Object.defineProperty(Ya,"__esModule",{value:!0});function rW(t,e,r){return~(t-1)&e|t-1&r}Ya.select=rW;function nW(t,e){return(t|0)-(e|0)-1>>>31&1}Ya.lessOrEqual=nW;function FP(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Ya.compare=FP;function iW(t,e){return t.length===0||e.length===0?!1:FP(t,e)!==0}Ya.equal=iW});var UP=v(oi=>{"use strict";l();Object.defineProperty(oi,"__esModule",{value:!0});var sW=Dp(),Pp=Hr();oi.DIGEST_LENGTH=16;var MP=function(){function t(e){this.digestLength=oi.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 c=e[14]|e[15]<<8;this._r[8]=(u>>>8|c<<8)&8191,this._r[9]=c>>>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],c=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],m=this._h[8],y=this._h[9],A=this._r[0],O=this._r[1],R=this._r[2],z=this._r[3],M=this._r[4],b=this._r[5],S=this._r[6],N=this._r[7],_=this._r[8],T=this._r[9];n>=16;){var B=e[r+0]|e[r+1]<<8;s+=B&8191;var X=e[r+2]|e[r+3]<<8;o+=(B>>>13|X<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(X>>>10|Q<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(Q>>>7|H<<9)&8191;var j=e[r+8]|e[r+9]<<8;c+=(H>>>4|j<<12)&8191,f+=j>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(j>>>14|K<<2)&8191;var me=e[r+12]|e[r+13]<<8;g+=(K>>>11|me<<5)&8191;var ce=e[r+14]|e[r+15]<<8;m+=(me>>>8|ce<<8)&8191,y+=ce>>>5|i;var ie=0,J=ie;J+=s*A,J+=o*(5*T),J+=a*(5*_),J+=u*(5*N),J+=c*(5*S),ie=J>>>13,J&=8191,J+=f*(5*b),J+=d*(5*M),J+=g*(5*z),J+=m*(5*R),J+=y*(5*O),ie+=J>>>13,J&=8191;var oe=ie;oe+=s*O,oe+=o*A,oe+=a*(5*T),oe+=u*(5*_),oe+=c*(5*N),ie=oe>>>13,oe&=8191,oe+=f*(5*S),oe+=d*(5*b),oe+=g*(5*M),oe+=m*(5*z),oe+=y*(5*R),ie+=oe>>>13,oe&=8191;var re=ie;re+=s*R,re+=o*O,re+=a*A,re+=u*(5*T),re+=c*(5*_),ie=re>>>13,re&=8191,re+=f*(5*N),re+=d*(5*S),re+=g*(5*b),re+=m*(5*M),re+=y*(5*z),ie+=re>>>13,re&=8191;var se=ie;se+=s*z,se+=o*R,se+=a*O,se+=u*A,se+=c*(5*T),ie=se>>>13,se&=8191,se+=f*(5*_),se+=d*(5*N),se+=g*(5*S),se+=m*(5*b),se+=y*(5*M),ie+=se>>>13,se&=8191;var U=ie;U+=s*M,U+=o*z,U+=a*R,U+=u*O,U+=c*A,ie=U>>>13,U&=8191,U+=f*(5*T),U+=d*(5*_),U+=g*(5*N),U+=m*(5*S),U+=y*(5*b),ie+=U>>>13,U&=8191;var fe=ie;fe+=s*b,fe+=o*M,fe+=a*z,fe+=u*R,fe+=c*O,ie=fe>>>13,fe&=8191,fe+=f*A,fe+=d*(5*T),fe+=g*(5*_),fe+=m*(5*N),fe+=y*(5*S),ie+=fe>>>13,fe&=8191;var ue=ie;ue+=s*S,ue+=o*b,ue+=a*M,ue+=u*z,ue+=c*R,ie=ue>>>13,ue&=8191,ue+=f*O,ue+=d*A,ue+=g*(5*T),ue+=m*(5*_),ue+=y*(5*N),ie+=ue>>>13,ue&=8191;var de=ie;de+=s*N,de+=o*S,de+=a*b,de+=u*M,de+=c*z,ie=de>>>13,de&=8191,de+=f*R,de+=d*O,de+=g*A,de+=m*(5*T),de+=y*(5*_),ie+=de>>>13,de&=8191;var ae=ie;ae+=s*_,ae+=o*N,ae+=a*S,ae+=u*b,ae+=c*M,ie=ae>>>13,ae&=8191,ae+=f*z,ae+=d*R,ae+=g*O,ae+=m*A,ae+=y*(5*T),ie+=ae>>>13,ae&=8191;var le=ie;le+=s*T,le+=o*_,le+=a*N,le+=u*S,le+=c*b,ie=le>>>13,le&=8191,le+=f*M,le+=d*z,le+=g*R,le+=m*O,le+=y*A,ie+=le>>>13,le&=8191,ie=(ie<<2)+ie|0,ie=ie+J|0,J=ie&8191,ie=ie>>>13,oe+=ie,s=J,o=oe,a=re,u=se,c=U,f=fe,d=ue,g=de,m=ae,y=le,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=c,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=m,this._h[9]=y},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";l();Object.defineProperty(ai,"__esModule",{value:!0});var Rp=LP(),uW=UP(),Al=Hr(),qP=Ma(),cW=Dp();ai.KEY_LENGTH=32;ai.NONCE_LENGTH=12;ai.TAG_LENGTH=16;var VP=new Uint8Array(16),lW=function(){function t(e){if(this.nonceLength=ai.NONCE_LENGTH,this.tagLength=ai.TAG_LENGTH,e.length!==ai.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);Rp.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 Rp.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),Al.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(VP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(VP.subarray(n.length%16));var o=new Uint8Array(8);i&&qP.writeUint64LE(i.length,o),s.update(o),qP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(DA,"__esModule",{value:!0});function fW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}DA.isSerializableHash=fW});var jP=v(bl=>{"use strict";l();Object.defineProperty(bl,"__esModule",{value:!0});var Dn=kP(),dW=Dp(),hW=Hr(),GP=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";l();Object.defineProperty(PA,"__esModule",{value:!0});var QP=jP(),zP=Hr(),gW=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=QP.hmac(this._hash,n,r);this._hmac=new QP.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";l();Object.defineProperty(Yi,"__esModule",{value:!0});var Lp=Ma(),Bp=Hr();Yi.DIGEST_LENGTH=32;Yi.BLOCK_SIZE=64;var $P=function(){function t(){this.digestLength=Yi.DIGEST_LENGTH,this.blockSize=Yi.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(){Bp.wipe(this._buffer),Bp.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&&(RA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=RA(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){Bp.wipe(e.state),e.buffer&&Bp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Yi.SHA256=$P;var yW=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 RA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],c=e[4],f=e[5],d=e[6],g=e[7],m=0;m<16;m++){var y=n+m*4;t[m]=Lp.readUint32BE(r,y)}for(var m=16;m<64;m++){var A=t[m-2],O=(A>>>17|A<<15)^(A>>>19|A<<13)^A>>>10;A=t[m-15];var R=(A>>>7|A<<25)^(A>>>18|A<<14)^A>>>3;t[m]=(O+t[m-7]|0)+(R+t[m-16]|0)}for(var m=0;m<64;m++){var O=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&d)|0)+(g+(yW[m]+t[m]|0)|0)|0,R=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&a^o&a)|0;g=d,d=f,f=c,c=u+O|0,u=a,a=o,o=s,s=O+R|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function mW(t){var e=new $P;e.update(t);var r=e.digest();return e.clean(),r}Yi.hash=mW});var ZP=v(mt=>{"use strict";l();Object.defineProperty(mt,"__esModule",{value:!0});mt.sharedKey=mt.generateKeyPair=mt.generateKeyPairFromSeed=mt.scalarMultBase=mt.scalarMult=mt.SHARED_KEY_LENGTH=mt.SECRET_KEY_LENGTH=mt.PUBLIC_KEY_LENGTH=void 0;var wW=cl(),EW=Hr();mt.PUBLIC_KEY_LENGTH=32;mt.SECRET_KEY_LENGTH=32;mt.SHARED_KEY_LENGTH=32;function Pn(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,Il(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 bW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Mp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ui(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,A=0,O=0,R=0,z=0,M=0,b=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],E=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*E,A+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,b+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,A+=n*E,O+=n*I,R+=n*P,z+=n*C,M+=n*D,b+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,A+=n*w,O+=n*E,R+=n*I,z+=n*P,M+=n*C,b+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,A+=n*le,O+=n*w,R+=n*E,z+=n*I,M+=n*P,b+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,A+=n*ae,O+=n*le,R+=n*w,z+=n*E,M+=n*I,b+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,A+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*E,b+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,A+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,b+=n*E,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,A+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,b+=n*w,S+=n*E,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,A+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,b+=n*le,S+=n*w,N+=n*E,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,A+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,b+=n*ae,S+=n*le,N+=n*w,_+=n*E,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],A+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,b+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*E,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,b+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*E,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,b+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*E,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,b+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*E,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,b+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*E,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],b+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*E,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,A+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=A,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=b}function _l(t,e){ui(t,e,e)}function IW(t,e){let r=Pn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)_l(r,r),n!==2&&n!==4&&ui(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function LA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Pn(),s=Pn(),o=Pn(),a=Pn(),u=Pn(),c=Pn();for(let m=0;m<31;m++)r[m]=t[m];r[31]=t[31]&127|64,r[0]&=248,bW(n,e);for(let m=0;m<16;m++)s[m]=n[m];i[0]=a[0]=1;for(let m=254;m>=0;--m){let y=r[m>>>3]>>>(m&7)&1;Il(i,s,y),Il(o,a,y),Fp(u,i,o),Mp(i,i,o),Fp(o,s,a),Mp(s,s,a),_l(a,u),_l(c,i),ui(i,o,i),ui(o,s,u),Fp(u,i,o),Mp(i,i,o),_l(s,i),Mp(o,a,c),ui(i,o,vW),Fp(i,i,a),ui(o,o,i),ui(i,a,c),ui(a,s,n),_l(s,u),Il(i,s,y),Il(o,a,y)}for(let m=0;m<16;m++)n[m+16]=i[m],n[m+32]=o[m],n[m+48]=s[m],n[m+64]=a[m];let f=n.subarray(32),d=n.subarray(16);IW(f,f),ui(d,d,f);let g=new Uint8Array(32);return AW(g,d),g}mt.scalarMult=LA;function JP(t){return LA(t,YP)}mt.scalarMultBase=JP;function XP(t){if(t.length!==mt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${mt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:JP(e),secretKey:e}}mt.generateKeyPairFromSeed=XP;function _W(t){let e=(0,wW.randomBytes)(32,t),r=XP(e);return(0,EW.wipe)(e),r}mt.generateKeyPair=_W;function SW(t,e,r=!1){if(t.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=LA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{l()});function rR(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{l()});function iR(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ga(t.length);for(let n=0;n{l();bp();hl()});var FA={};ft(FA,{compare:()=>eR,concat:()=>Ip,equals:()=>rR,fromString:()=>On,toString:()=>si,xor:()=>iR});var MA=he(()=>{l();tR();Y1();nR();IA();bA();sR()});var mR=v(ut=>{"use strict";l();var oR=ut&&ut.__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 hR:typeof navigator<"u"?UA(navigator.userAgent):yR()}ut.detect=NW;function pR(t){return t!==""&&xW.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 OW(t){var e=pR(t);return e?e[0]:null}ut.browserName=OW;function UA(t){var e=pR(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new dR;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";l();Object.defineProperty(et,"__esModule",{value:!0});et.getLocalStorage=et.getLocalStorageOrThrow=et.getCrypto=et.getCryptoOrThrow=et.getLocation=et.getLocationOrThrow=et.getNavigator=et.getNavigatorOrThrow=et.getDocument=et.getDocumentOrThrow=et.getFromWindowOrThrow=et.getFromWindow=void 0;function so(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}et.getFromWindow=so;function Ja(t){let e=so(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}et.getFromWindowOrThrow=Ja;function PW(){return Ja("document")}et.getDocumentOrThrow=PW;function RW(){return so("document")}et.getDocument=RW;function BW(){return Ja("navigator")}et.getNavigatorOrThrow=BW;function LW(){return so("navigator")}et.getNavigator=LW;function FW(){return Ja("location")}et.getLocationOrThrow=FW;function MW(){return so("location")}et.getLocation=MW;function UW(){return Ja("crypto")}et.getCryptoOrThrow=UW;function qW(){return so("crypto")}et.getCrypto=qW;function VW(){return Ja("localStorage")}et.getLocalStorageOrThrow=VW;function HW(){return so("localStorage")}et.getLocalStorage=HW});var ER=v(Up=>{"use strict";l();Object.defineProperty(Up,"__esModule",{value:!0});Up.getWindowMetadata=void 0;var wR=qA();function kW(){let t,e;try{t=wR.getDocumentOrThrow(),e=wR.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let m=0;m-1){let O=y.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let R=e.protocol+"//"+e.host;if(O.indexOf("/")===0)R+=O;else{let z=e.pathname.split("/");z.pop();let M=z.join("/");R+=M+"/"+O}g.push(R)}else if(O.indexOf("//")===0){let R=e.protocol+O;g.push(R)}else g.push(O)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let m=0;my.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(A.length&&A){let O=y.getAttribute("content");if(O)return O}}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,c=r();return{description:a,url:u,icons:c,name:o}}Up.getWindowMetadata=kW});var AR=v((mge,vR)=>{"use strict";l();vR.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var TR=v((Ege,SR)=>{"use strict";l();var _R="%[a-f0-9]{2}",bR=new RegExp("("+_R+")|([^%]+?)","gi"),IR=new RegExp("("+_R+")+","gi");function VA(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([],VA(r),VA(n))}function GW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(bR)||[],r=1;r{"use strict";l();CR.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 OR=v((Ige,NR)=>{"use strict";l();NR.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";l();var QW=AR(),zW=TR(),PR=xR(),WW=OR(),$W=t=>t==null,HA=Symbol("encodeFragmentIdentifier");function KW(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,[It(e,t),"[",i,"]"].join("")]:[...r,[It(e,t),"[",It(i,t),"]=",It(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[It(e,t),"[]"].join("")]:[...r,[It(e,t),"[]=",It(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,[It(e,t),":list="].join("")]:[...r,[It(e,t),":list=",It(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?[[It(r,t),e,It(i,t)].join("")]:[[n,It(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,It(e,t)]:[...r,[It(e,t),"=",It(n,t)].join("")]}}function YW(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&&ci(n,t).includes(t.arrayFormatSeparator);n=o?ci(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ci(u,t)):n===null?n:ci(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ci(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ci(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 RR(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function It(t,e){return e.encode?e.strict?QW(t):encodeURIComponent(t):t}function ci(t,e){return e.decode?zW(t):t}function BR(t){return Array.isArray(t)?t.sort():typeof t=="object"?BR(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function LR(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function JW(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function FR(t){t=LR(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function DR(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 MR(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),RR(e.arrayFormatSeparator);let r=YW(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]=PR(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ci(o,e),r(ci(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]=DR(s[o],e);else n[i]=DR(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]=BR(o):i[s]=o,i},Object.create(null))}wr.extract=FR;wr.parse=MR;wr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),RR(e.arrayFormatSeparator);let r=o=>e.skipNull&&$W(t[o])||e.skipEmptyString&&t[o]==="",n=KW(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?It(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?It(o,e)+"[]":a.reduce(n(o),[]).join("&"):It(o,e)+"="+It(a,e)}).filter(o=>o.length>0).join("&")};wr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=PR(t,"#");return Object.assign({url:r.split("?")[0]||"",query:MR(FR(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ci(n,e)}:{})};wr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[HA]:!0},e);let r=LR(t.url).split("?")[0]||"",n=wr.extract(t.url),i=wr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=wr.stringify(s,e);o&&(o=`?${o}`);let a=JW(t.url);return t.fragmentIdentifier&&(a=`#${e[HA]?It(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};wr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[HA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=wr.parseUrl(t,r);return wr.stringifyUrl({url:n,query:WW(i,e),fragmentIdentifier:s},r)};wr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return wr.pick(t,n,r)}});var qR=he(()=>{l()});function Ji(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function XW(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function ZW(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function e$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Sl(t,e,r){return(!r.length?ZW(t,e.length):e$(t,e.length))?XW(t,e):!1}function Tl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var kA=he(()=>{l()});function t$(t){return qp(t.method)&&Vp(t.params)}function qp(t){return Tl(t,"subscribe")}function Vp(t){return Sl(t,["topic"],[])}function r$(t){return Hp(t.method)&&kp(t.params)}function Hp(t){return Tl(t,"publish")}function kp(t){return Sl(t,["message","topic","ttl"],["prompt","tag"])}function n$(t){return Gp(t.method)&&jp(t.params)}function Gp(t){return Tl(t,"unsubscribe")}function jp(t){return Sl(t,["id","topic"],[])}function i$(t){return Qp(t.method)&&zp(t.params)}function Qp(t){return Tl(t,"subscription")}function zp(t){return Sl(t,["id","data"],[])}var GA=he(()=>{l();kA()});function s$(t){if(!qp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Vp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Ji(e,"topic"),e}function o$(t){if(!Hp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!kp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Ji(e,"topic"),Ji(e,"message"),Ji(e,"ttl","number"),e}function a$(t){if(!Gp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!jp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Ji(e,"id"),e}function u$(t){if(!Qp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!zp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Ji(e,"id"),Ji(e,"data"),e}var VR=he(()=>{l();kA();GA()});var c$,HR=he(()=>{l();c$={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 kR={};ft(kR,{RELAY_JSONRPC:()=>c$,isPublishMethod:()=>Hp,isPublishParams:()=>kp,isPublishRequest:()=>r$,isSubscribeMethod:()=>qp,isSubscribeParams:()=>Vp,isSubscribeRequest:()=>t$,isSubscriptionMethod:()=>Qp,isSubscriptionParams:()=>zp,isSubscriptionRequest:()=>i$,isUnsubscribeMethod:()=>Gp,isUnsubscribeParams:()=>jp,isUnsubscribeRequest:()=>n$,parsePublishRequest:()=>o$,parseSubscribeRequest:()=>s$,parseSubscriptionRequest:()=>u$,parseUnsubscribeRequest:()=>a$});var GR=he(()=>{l();qR();VR();HR();GA()});var Dl=v(V=>{"use strict";l();Object.defineProperty(V,"__esModule",{value:!0});var ZR=HP(),l$=WP(),e3=cl(),KA=KP(),f$=ZP(),ct=(MA(),ht(FA)),d$=mR(),Xa=Zs(),Za=qA(),h$=ER(),p$=UR(),g$=(GR(),ht(kR));function t3(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 r3=t3(f$),Wp=t3(p$),Yp=":";function n3(t){let[e,r]=t.split(Yp);return{namespace:e,reference:r}}function i3(t){let{namespace:e,reference:r}=t;return[e,r].join(Yp)}function YA(t){let[e,r,n]=t.split(Yp);return{namespace:e,reference:r,address:n}}function s3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Yp)}function JA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function o3(t){let{address:e}=YA(t);return e}function a3(t){let{namespace:e,reference:r}=YA(t);return i3({namespace:e,reference:r})}function y$(t,e){let{namespace:r,reference:n}=n3(e);return s3({namespace:r,reference:n,address:t})}function m$(t){return JA(t,o3)}function u3(t){return JA(t,a3)}function w$(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 E$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...u3(i.accounts))}),r}function v$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Jp(n,i))}),r}function Jp(t,e){return t.includes(":")?[t]:e.chains||[]}var Xp=t=>t?.split(":"),c3=t=>{let e=t&&Xp(t);if(e)return e[3]},A$=t=>{let e=t&&Xp(t);if(e)return e[2]+":"+e[3]},l3=t=>{let e=t&&Xp(t);if(e)return e.pop()},b$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=l3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${c3(e)}`,u=`Nonce: ${t.nonce}`,c=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var NP=he(()=>{l();xP();Sp();Ki();vA();ml()});var IA,ppe,OP=he(()=>{l();nP();iP();sP();oP();aP();fA();uP();pA();cP();fP();vP();IP();_P();SP();NP();IA={...sA,...oA,...aA,...uA,...cA,...lA,...dA,...hA,...gA,...yA},ppe={...AA,...bA}});function PP(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var DP,_A,sW,Np,SA=he(()=>{l();OP();bp();DP=PP("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),_A=PP("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Qa(t.length);for(let r=0;r{l();SA()});function On(t,e="utf8"){let r=Np[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?$i(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var CA=he(()=>{l();SA();hl()});function El(t){return Qi(si(On(t,Ga),gp))}function vl(t){return si(On(zi(t),gp),Ga)}function xA(t){let e=On(vp,ja),r=Ep+si(Ip([e,t]),ja);return[mp,wp,r].join(yp)}function NA(t){let[e,r,n]=t.split(yp);if(e!==mp||r!==wp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==Ep)throw new Error("Issuer must be a key in mulicodec format");let s=On(n.slice(1),ja);if(si(s.slice(0,2),ja)!==vp)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 RP(t){return si(t,Ga)}function BP(t){return On(t,Ga)}function OA(t){return On([vl(t.header),vl(t.payload)].join(no),dl)}function oW(t){let e=si(t,dl).split(no),r=El(e[0]),n=El(e[1]);return{header:r,payload:n}}function DA(t){return[vl(t.header),vl(t.payload),RP(t.signature)].join(no)}function PA(t){let e=t.split(no),r=El(e[0]),n=El(e[1]),i=BP(e[2]),s=On(e.slice(0,2).join(no),dl);return{header:r,payload:n,signature:i,data:s}}var RA=he(()=>{l();eA();TA();CA();nl();Ap()});function aW(t=(0,LP.randomBytes)(32)){return Ja.generateKeyPairFromSeed(t)}async function uW(t,e,r,n,i=(0,FP.fromMiliseconds)(Date.now())){let s={alg:hp,typ:pp},o=xA(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},c=OA({header:s,payload:u}),f=Ja.sign(n.secretKey,c);return DA({header:s,payload:u,signature:f})}async function cW(t){let{header:e,payload:r,data:n,signature:i}=PA(t);if(e.alg!==hp||e.typ!==pp)throw new Error("JWT must use EdDSA algorithm");let s=NA(r.iss);return Ja.verify(s,n,i)}var Ja,LP,FP,MP=he(()=>{l();Ja=be(WD()),LP=be(cl()),FP=be(Zs());Ap();RA()});var UP=he(()=>{l()});var qP={};ft(qP,{DATA_ENCODING:()=>dl,DID_DELIMITER:()=>yp,DID_METHOD:()=>wp,DID_PREFIX:()=>mp,JSON_ENCODING:()=>gp,JWT_DELIMITER:()=>no,JWT_ENCODING:()=>Ga,JWT_IRIDIUM_ALG:()=>hp,JWT_IRIDIUM_TYP:()=>pp,KEY_PAIR_SEED_LENGTH:()=>KD,MULTICODEC_ED25519_BASE:()=>Ep,MULTICODEC_ED25519_ENCODING:()=>ja,MULTICODEC_ED25519_HEADER:()=>vp,MULTICODEC_ED25519_LENGTH:()=>$D,decodeData:()=>oW,decodeIss:()=>NA,decodeJSON:()=>El,decodeJWT:()=>PA,decodeSig:()=>BP,encodeData:()=>OA,encodeIss:()=>xA,encodeJSON:()=>vl,encodeJWT:()=>DA,encodeSig:()=>RP,generateKeyPair:()=>aW,signJWT:()=>uW,verifyJWT:()=>cW});var VP=he(()=>{l();MP();Ap();UP();RA()});var kP=A(Op=>{"use strict";l();Object.defineProperty(Op,"__esModule",{value:!0});var tr=qa(),BA=Hr(),lW=20;function fW(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],c=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],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],b=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],R=e[11]<<24|e[10]<<16|e[9]<<8|e[8],z=e[15]<<24|e[14]<<16|e[13]<<8|e[12],M=n,E=i,S=s,N=o,_=a,T=u,B=c,X=f,Q=d,H=g,j=m,K=y,me=b,ce=O,ie=R,J=z,oe=0;oe>>16|me<<16,Q=Q+me|0,_^=Q,_=_>>>20|_<<12,E=E+T|0,ce^=E,ce=ce>>>16|ce<<16,H=H+ce|0,T^=H,T=T>>>20|T<<12,S=S+B|0,ie^=S,ie=ie>>>16|ie<<16,j=j+ie|0,B^=j,B=B>>>20|B<<12,N=N+X|0,J^=N,J=J>>>16|J<<16,K=K+J|0,X^=K,X=X>>>20|X<<12,S=S+B|0,ie^=S,ie=ie>>>24|ie<<8,j=j+ie|0,B^=j,B=B>>>25|B<<7,N=N+X|0,J^=N,J=J>>>24|J<<8,K=K+J|0,X^=K,X=X>>>25|X<<7,E=E+T|0,ce^=E,ce=ce>>>24|ce<<8,H=H+ce|0,T^=H,T=T>>>25|T<<7,M=M+_|0,me^=M,me=me>>>24|me<<8,Q=Q+me|0,_^=Q,_=_>>>25|_<<7,M=M+T|0,J^=M,J=J>>>16|J<<16,j=j+J|0,T^=j,T=T>>>20|T<<12,E=E+B|0,me^=E,me=me>>>16|me<<16,K=K+me|0,B^=K,B=B>>>20|B<<12,S=S+X|0,ce^=S,ce=ce>>>16|ce<<16,Q=Q+ce|0,X^=Q,X=X>>>20|X<<12,N=N+_|0,ie^=N,ie=ie>>>16|ie<<16,H=H+ie|0,_^=H,_=_>>>20|_<<12,S=S+X|0,ce^=S,ce=ce>>>24|ce<<8,Q=Q+ce|0,X^=Q,X=X>>>25|X<<7,N=N+_|0,ie^=N,ie=ie>>>24|ie<<8,H=H+ie|0,_^=H,_=_>>>25|_<<7,E=E+B|0,me^=E,me=me>>>24|me<<8,K=K+me|0,B^=K,B=B>>>25|B<<7,M=M+T|0,J^=M,J=J>>>24|J<<8,j=j+J|0,T^=j,T=T>>>25|T<<7;tr.writeUint32LE(M+n|0,t,0),tr.writeUint32LE(E+i|0,t,4),tr.writeUint32LE(S+s|0,t,8),tr.writeUint32LE(N+o|0,t,12),tr.writeUint32LE(_+a|0,t,16),tr.writeUint32LE(T+u|0,t,20),tr.writeUint32LE(B+c|0,t,24),tr.writeUint32LE(X+f|0,t,28),tr.writeUint32LE(Q+d|0,t,32),tr.writeUint32LE(H+g|0,t,36),tr.writeUint32LE(j+m|0,t,40),tr.writeUint32LE(K+y|0,t,44),tr.writeUint32LE(me+b|0,t,48),tr.writeUint32LE(ce+O|0,t,52),tr.writeUint32LE(ie+R|0,t,56),tr.writeUint32LE(J+z|0,t,60)}function HP(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 Dp=A(Xa=>{"use strict";l();Object.defineProperty(Xa,"__esModule",{value:!0});function pW(t,e,r){return~(t-1)&e|t-1&r}Xa.select=pW;function gW(t,e){return(t|0)-(e|0)-1>>>31&1}Xa.lessOrEqual=gW;function GP(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Xa.compare=GP;function yW(t,e){return t.length===0||e.length===0?!1:GP(t,e)!==0}Xa.equal=yW});var QP=A(oi=>{"use strict";l();Object.defineProperty(oi,"__esModule",{value:!0});var mW=Dp(),Pp=Hr();oi.DIGEST_LENGTH=16;var jP=function(){function t(e){this.digestLength=oi.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 c=e[14]|e[15]<<8;this._r[8]=(u>>>8|c<<8)&8191,this._r[9]=c>>>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],c=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],m=this._h[8],y=this._h[9],b=this._r[0],O=this._r[1],R=this._r[2],z=this._r[3],M=this._r[4],E=this._r[5],S=this._r[6],N=this._r[7],_=this._r[8],T=this._r[9];n>=16;){var B=e[r+0]|e[r+1]<<8;s+=B&8191;var X=e[r+2]|e[r+3]<<8;o+=(B>>>13|X<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(X>>>10|Q<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(Q>>>7|H<<9)&8191;var j=e[r+8]|e[r+9]<<8;c+=(H>>>4|j<<12)&8191,f+=j>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(j>>>14|K<<2)&8191;var me=e[r+12]|e[r+13]<<8;g+=(K>>>11|me<<5)&8191;var ce=e[r+14]|e[r+15]<<8;m+=(me>>>8|ce<<8)&8191,y+=ce>>>5|i;var ie=0,J=ie;J+=s*b,J+=o*(5*T),J+=a*(5*_),J+=u*(5*N),J+=c*(5*S),ie=J>>>13,J&=8191,J+=f*(5*E),J+=d*(5*M),J+=g*(5*z),J+=m*(5*R),J+=y*(5*O),ie+=J>>>13,J&=8191;var oe=ie;oe+=s*O,oe+=o*b,oe+=a*(5*T),oe+=u*(5*_),oe+=c*(5*N),ie=oe>>>13,oe&=8191,oe+=f*(5*S),oe+=d*(5*E),oe+=g*(5*M),oe+=m*(5*z),oe+=y*(5*R),ie+=oe>>>13,oe&=8191;var re=ie;re+=s*R,re+=o*O,re+=a*b,re+=u*(5*T),re+=c*(5*_),ie=re>>>13,re&=8191,re+=f*(5*N),re+=d*(5*S),re+=g*(5*E),re+=m*(5*M),re+=y*(5*z),ie+=re>>>13,re&=8191;var se=ie;se+=s*z,se+=o*R,se+=a*O,se+=u*b,se+=c*(5*T),ie=se>>>13,se&=8191,se+=f*(5*_),se+=d*(5*N),se+=g*(5*S),se+=m*(5*E),se+=y*(5*M),ie+=se>>>13,se&=8191;var U=ie;U+=s*M,U+=o*z,U+=a*R,U+=u*O,U+=c*b,ie=U>>>13,U&=8191,U+=f*(5*T),U+=d*(5*_),U+=g*(5*N),U+=m*(5*S),U+=y*(5*E),ie+=U>>>13,U&=8191;var fe=ie;fe+=s*E,fe+=o*M,fe+=a*z,fe+=u*R,fe+=c*O,ie=fe>>>13,fe&=8191,fe+=f*b,fe+=d*(5*T),fe+=g*(5*_),fe+=m*(5*N),fe+=y*(5*S),ie+=fe>>>13,fe&=8191;var ue=ie;ue+=s*S,ue+=o*E,ue+=a*M,ue+=u*z,ue+=c*R,ie=ue>>>13,ue&=8191,ue+=f*O,ue+=d*b,ue+=g*(5*T),ue+=m*(5*_),ue+=y*(5*N),ie+=ue>>>13,ue&=8191;var de=ie;de+=s*N,de+=o*S,de+=a*E,de+=u*M,de+=c*z,ie=de>>>13,de&=8191,de+=f*R,de+=d*O,de+=g*b,de+=m*(5*T),de+=y*(5*_),ie+=de>>>13,de&=8191;var ae=ie;ae+=s*_,ae+=o*N,ae+=a*S,ae+=u*E,ae+=c*M,ie=ae>>>13,ae&=8191,ae+=f*z,ae+=d*R,ae+=g*O,ae+=m*b,ae+=y*(5*T),ie+=ae>>>13,ae&=8191;var le=ie;le+=s*T,le+=o*_,le+=a*N,le+=u*S,le+=c*E,ie=le>>>13,le&=8191,le+=f*M,le+=d*z,le+=g*R,le+=m*O,le+=y*b,ie+=le>>>13,le&=8191,ie=(ie<<2)+ie|0,ie=ie+J|0,J=ie&8191,ie=ie>>>13,oe+=ie,s=J,o=oe,a=re,u=se,c=U,f=fe,d=ue,g=de,m=ae,y=le,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=c,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=m,this._h[9]=y},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";l();Object.defineProperty(ai,"__esModule",{value:!0});var Rp=kP(),vW=QP(),Al=Hr(),zP=qa(),AW=Dp();ai.KEY_LENGTH=32;ai.NONCE_LENGTH=12;ai.TAG_LENGTH=16;var WP=new Uint8Array(16),bW=function(){function t(e){if(this.nonceLength=ai.NONCE_LENGTH,this.tagLength=ai.TAG_LENGTH,e.length!==ai.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);Rp.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 Rp.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),Al.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(WP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(WP.subarray(n.length%16));var o=new Uint8Array(8);i&&zP.writeUint64LE(i.length,o),s.update(o),zP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(LA,"__esModule",{value:!0});function IW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}LA.isSerializableHash=IW});var JP=A(bl=>{"use strict";l();Object.defineProperty(bl,"__esModule",{value:!0});var Dn=KP(),_W=Dp(),SW=Hr(),YP=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";l();Object.defineProperty(FA,"__esModule",{value:!0});var XP=JP(),ZP=Hr(),CW=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=XP.hmac(this._hash,n,r);this._hmac=new XP.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";l();Object.defineProperty(Ji,"__esModule",{value:!0});var Lp=qa(),Bp=Hr();Ji.DIGEST_LENGTH=32;Ji.BLOCK_SIZE=64;var tR=function(){function t(){this.digestLength=Ji.DIGEST_LENGTH,this.blockSize=Ji.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(){Bp.wipe(this._buffer),Bp.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&&(MA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=MA(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){Bp.wipe(e.state),e.buffer&&Bp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Ji.SHA256=tR;var xW=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 MA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],c=e[4],f=e[5],d=e[6],g=e[7],m=0;m<16;m++){var y=n+m*4;t[m]=Lp.readUint32BE(r,y)}for(var m=16;m<64;m++){var b=t[m-2],O=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10;b=t[m-15];var R=(b>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;t[m]=(O+t[m-7]|0)+(R+t[m-16]|0)}for(var m=0;m<64;m++){var O=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&d)|0)+(g+(xW[m]+t[m]|0)|0)|0,R=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&a^o&a)|0;g=d,d=f,f=c,c=u+O|0,u=a,a=o,o=s,s=O+R|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function NW(t){var e=new tR;e.update(t);var r=e.digest();return e.clean(),r}Ji.hash=NW});var oR=A(mt=>{"use strict";l();Object.defineProperty(mt,"__esModule",{value:!0});mt.sharedKey=mt.generateKeyPair=mt.generateKeyPairFromSeed=mt.scalarMultBase=mt.scalarMult=mt.SHARED_KEY_LENGTH=mt.SECRET_KEY_LENGTH=mt.PUBLIC_KEY_LENGTH=void 0;var OW=cl(),DW=Hr();mt.PUBLIC_KEY_LENGTH=32;mt.SECRET_KEY_LENGTH=32;mt.SHARED_KEY_LENGTH=32;function Pn(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,Il(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 BW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Mp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ui(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,b=0,O=0,R=0,z=0,M=0,E=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],v=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*v,b+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,E+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,b+=n*v,O+=n*I,R+=n*P,z+=n*C,M+=n*D,E+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,b+=n*w,O+=n*v,R+=n*I,z+=n*P,M+=n*C,E+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,b+=n*le,O+=n*w,R+=n*v,z+=n*I,M+=n*P,E+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,b+=n*ae,O+=n*le,R+=n*w,z+=n*v,M+=n*I,E+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,b+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*v,E+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,b+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,E+=n*v,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,b+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,E+=n*w,S+=n*v,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,b+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,E+=n*le,S+=n*w,N+=n*v,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,b+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,E+=n*ae,S+=n*le,N+=n*w,_+=n*v,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],b+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,E+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*v,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,E+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*v,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,E+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*v,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,E+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*v,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,E+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*v,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],E+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*v,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,b+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=b,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=E}function _l(t,e){ui(t,e,e)}function LW(t,e){let r=Pn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)_l(r,r),n!==2&&n!==4&&ui(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function qA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Pn(),s=Pn(),o=Pn(),a=Pn(),u=Pn(),c=Pn();for(let m=0;m<31;m++)r[m]=t[m];r[31]=t[31]&127|64,r[0]&=248,BW(n,e);for(let m=0;m<16;m++)s[m]=n[m];i[0]=a[0]=1;for(let m=254;m>=0;--m){let y=r[m>>>3]>>>(m&7)&1;Il(i,s,y),Il(o,a,y),Fp(u,i,o),Mp(i,i,o),Fp(o,s,a),Mp(s,s,a),_l(a,u),_l(c,i),ui(i,o,i),ui(o,s,u),Fp(u,i,o),Mp(i,i,o),_l(s,i),Mp(o,a,c),ui(i,o,PW),Fp(i,i,a),ui(o,o,i),ui(i,a,c),ui(a,s,n),_l(s,u),Il(i,s,y),Il(o,a,y)}for(let m=0;m<16;m++)n[m+16]=i[m],n[m+32]=o[m],n[m+48]=s[m],n[m+64]=a[m];let f=n.subarray(32),d=n.subarray(16);LW(f,f),ui(d,d,f);let g=new Uint8Array(32);return RW(g,d),g}mt.scalarMult=qA;function iR(t){return qA(t,nR)}mt.scalarMultBase=iR;function sR(t){if(t.length!==mt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${mt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:iR(e),secretKey:e}}mt.generateKeyPairFromSeed=sR;function FW(t){let e=(0,OW.randomBytes)(32,t),r=sR(e);return(0,DW.wipe)(e),r}mt.generateKeyPair=FW;function MW(t,e,r=!1){if(t.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=qA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{l()});function cR(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{l()});function fR(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Qa(t.length);for(let n=0;n{l();bp();hl()});var VA={};ft(VA,{compare:()=>aR,concat:()=>Ip,equals:()=>cR,fromString:()=>On,toString:()=>si,xor:()=>fR});var HA=he(()=>{l();uR();eA();lR();CA();TA();dR()});var _R=A(ut=>{"use strict";l();var hR=ut&&ut.__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 vR:typeof navigator<"u"?kA(navigator.userAgent):IR()}ut.detect=HW;function AR(t){return t!==""&&VW.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 kW(t){var e=AR(t);return e?e[0]:null}ut.browserName=kW;function kA(t){var e=AR(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new ER;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";l();Object.defineProperty(et,"__esModule",{value:!0});et.getLocalStorage=et.getLocalStorageOrThrow=et.getCrypto=et.getCryptoOrThrow=et.getLocation=et.getLocationOrThrow=et.getNavigator=et.getNavigatorOrThrow=et.getDocument=et.getDocumentOrThrow=et.getFromWindowOrThrow=et.getFromWindow=void 0;function so(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}et.getFromWindow=so;function Za(t){let e=so(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}et.getFromWindowOrThrow=Za;function jW(){return Za("document")}et.getDocumentOrThrow=jW;function QW(){return so("document")}et.getDocument=QW;function zW(){return Za("navigator")}et.getNavigatorOrThrow=zW;function WW(){return so("navigator")}et.getNavigator=WW;function $W(){return Za("location")}et.getLocationOrThrow=$W;function KW(){return so("location")}et.getLocation=KW;function YW(){return Za("crypto")}et.getCryptoOrThrow=YW;function JW(){return so("crypto")}et.getCrypto=JW;function XW(){return Za("localStorage")}et.getLocalStorageOrThrow=XW;function ZW(){return so("localStorage")}et.getLocalStorage=ZW});var TR=A(Up=>{"use strict";l();Object.defineProperty(Up,"__esModule",{value:!0});Up.getWindowMetadata=void 0;var SR=GA();function e$(){let t,e;try{t=SR.getDocumentOrThrow(),e=SR.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let m=0;m-1){let O=y.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let R=e.protocol+"//"+e.host;if(O.indexOf("/")===0)R+=O;else{let z=e.pathname.split("/");z.pop();let M=z.join("/");R+=M+"/"+O}g.push(R)}else if(O.indexOf("//")===0){let R=e.protocol+O;g.push(R)}else g.push(O)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let m=0;my.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(b.length&&b){let O=y.getAttribute("content");if(O)return O}}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,c=r();return{description:a,url:u,icons:c,name:o}}Up.getWindowMetadata=e$});var xR=A((Oge,CR)=>{"use strict";l();CR.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var RR=A((Pge,PR)=>{"use strict";l();var DR="%[a-f0-9]{2}",NR=new RegExp("("+DR+")|([^%]+?)","gi"),OR=new RegExp("("+DR+")+","gi");function jA(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([],jA(r),jA(n))}function t$(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(NR)||[],r=1;r{"use strict";l();BR.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 MR=A((Fge,FR)=>{"use strict";l();FR.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";l();var n$=xR(),i$=RR(),qR=LR(),s$=MR(),o$=t=>t==null,QA=Symbol("encodeFragmentIdentifier");function a$(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,[It(e,t),"[",i,"]"].join("")]:[...r,[It(e,t),"[",It(i,t),"]=",It(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[It(e,t),"[]"].join("")]:[...r,[It(e,t),"[]=",It(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,[It(e,t),":list="].join("")]:[...r,[It(e,t),":list=",It(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?[[It(r,t),e,It(i,t)].join("")]:[[n,It(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,It(e,t)]:[...r,[It(e,t),"=",It(n,t)].join("")]}}function u$(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&&ci(n,t).includes(t.arrayFormatSeparator);n=o?ci(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ci(u,t)):n===null?n:ci(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ci(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ci(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 VR(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function It(t,e){return e.encode?e.strict?n$(t):encodeURIComponent(t):t}function ci(t,e){return e.decode?i$(t):t}function HR(t){return Array.isArray(t)?t.sort():typeof t=="object"?HR(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function kR(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function c$(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function GR(t){t=kR(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function UR(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 jR(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),VR(e.arrayFormatSeparator);let r=u$(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]=qR(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ci(o,e),r(ci(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]=UR(s[o],e);else n[i]=UR(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]=HR(o):i[s]=o,i},Object.create(null))}wr.extract=GR;wr.parse=jR;wr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),VR(e.arrayFormatSeparator);let r=o=>e.skipNull&&o$(t[o])||e.skipEmptyString&&t[o]==="",n=a$(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?It(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?It(o,e)+"[]":a.reduce(n(o),[]).join("&"):It(o,e)+"="+It(a,e)}).filter(o=>o.length>0).join("&")};wr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=qR(t,"#");return Object.assign({url:r.split("?")[0]||"",query:jR(GR(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ci(n,e)}:{})};wr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[QA]:!0},e);let r=kR(t.url).split("?")[0]||"",n=wr.extract(t.url),i=wr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=wr.stringify(s,e);o&&(o=`?${o}`);let a=c$(t.url);return t.fragmentIdentifier&&(a=`#${e[QA]?It(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};wr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[QA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=wr.parseUrl(t,r);return wr.stringifyUrl({url:n,query:s$(i,e),fragmentIdentifier:s},r)};wr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return wr.pick(t,n,r)}});var zR=he(()=>{l()});function Xi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function l$(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function f$(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function d$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Sl(t,e,r){return(!r.length?f$(t,e.length):d$(t,e.length))?l$(t,e):!1}function Tl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var zA=he(()=>{l()});function h$(t){return qp(t.method)&&Vp(t.params)}function qp(t){return Tl(t,"subscribe")}function Vp(t){return Sl(t,["topic"],[])}function p$(t){return Hp(t.method)&&kp(t.params)}function Hp(t){return Tl(t,"publish")}function kp(t){return Sl(t,["message","topic","ttl"],["prompt","tag"])}function g$(t){return Gp(t.method)&&jp(t.params)}function Gp(t){return Tl(t,"unsubscribe")}function jp(t){return Sl(t,["id","topic"],[])}function y$(t){return Qp(t.method)&&zp(t.params)}function Qp(t){return Tl(t,"subscription")}function zp(t){return Sl(t,["id","data"],[])}var WA=he(()=>{l();zA()});function m$(t){if(!qp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Vp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Xi(e,"topic"),e}function w$(t){if(!Hp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!kp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Xi(e,"topic"),Xi(e,"message"),Xi(e,"ttl","number"),e}function E$(t){if(!Gp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!jp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Xi(e,"id"),e}function v$(t){if(!Qp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!zp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Xi(e,"id"),Xi(e,"data"),e}var WR=he(()=>{l();zA();WA()});var A$,$R=he(()=>{l();A$={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 KR={};ft(KR,{RELAY_JSONRPC:()=>A$,isPublishMethod:()=>Hp,isPublishParams:()=>kp,isPublishRequest:()=>p$,isSubscribeMethod:()=>qp,isSubscribeParams:()=>Vp,isSubscribeRequest:()=>h$,isSubscriptionMethod:()=>Qp,isSubscriptionParams:()=>zp,isSubscriptionRequest:()=>y$,isUnsubscribeMethod:()=>Gp,isUnsubscribeParams:()=>jp,isUnsubscribeRequest:()=>g$,parsePublishRequest:()=>w$,parseSubscribeRequest:()=>m$,parseSubscriptionRequest:()=>v$,parseUnsubscribeRequest:()=>E$});var YR=he(()=>{l();zR();WR();$R();WA()});var Dl=A(V=>{"use strict";l();Object.defineProperty(V,"__esModule",{value:!0});var o3=$P(),b$=eR(),a3=cl(),ZA=rR(),I$=oR(),ct=(HA(),ht(VA)),_$=_R(),eu=Zs(),tu=GA(),S$=TR(),T$=QR(),C$=(YR(),ht(KR));function u3(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 c3=u3(I$),Wp=u3(T$),Yp=":";function l3(t){let[e,r]=t.split(Yp);return{namespace:e,reference:r}}function f3(t){let{namespace:e,reference:r}=t;return[e,r].join(Yp)}function eb(t){let[e,r,n]=t.split(Yp);return{namespace:e,reference:r,address:n}}function d3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Yp)}function tb(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function h3(t){let{address:e}=eb(t);return e}function p3(t){let{namespace:e,reference:r}=eb(t);return f3({namespace:e,reference:r})}function x$(t,e){let{namespace:r,reference:n}=l3(e);return d3({namespace:r,reference:n,address:t})}function N$(t){return tb(t,h3)}function g3(t){return tb(t,p3)}function O$(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 D$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...g3(i.accounts))}),r}function P$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Jp(n,i))}),r}function Jp(t,e){return t.includes(":")?[t]:e.chains||[]}var Xp=t=>t?.split(":"),y3=t=>{let e=t&&Xp(t);if(e)return e[3]},R$=t=>{let e=t&&Xp(t);if(e)return e[2]+":"+e[3]},m3=t=>{let e=t&&Xp(t);if(e)return e.pop()},B$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=m3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${y3(e)}`,u=`Nonce: ${t.nonce}`,c=`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,c,f].filter(d=>d!=null).join(` -`)},XA="base10",or="base16",$p="base64pad",Zp="utf8",ZA=0,eu=1,I$=0,jR=1,QA=12,eb=32;function _$(){let t=r3.generateKeyPair();return{privateKey:ct.toString(t.secretKey,or),publicKey:ct.toString(t.publicKey,or)}}function S$(){let t=e3.randomBytes(eb);return ct.toString(t,or)}function T$(t,e){let r=r3.sharedKey(ct.fromString(t,or),ct.fromString(e,or),!0),n=new l$.HKDF(KA.SHA256,r).expand(eb);return ct.toString(n,or)}function C$(t){let e=KA.hash(ct.fromString(t,or));return ct.toString(e,or)}function x$(t){let e=KA.hash(ct.fromString(t,Zp));return ct.toString(e,or)}function f3(t){return ct.fromString(`${t}`,XA)}function xl(t){return Number(ct.toString(t,XA))}function N$(t){let e=f3(typeof t.type<"u"?t.type:ZA);if(xl(e)===eu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ct.fromString(t.senderPublicKey,or):void 0,n=typeof t.iv<"u"?ct.fromString(t.iv,or):e3.randomBytes(QA),i=new ZR.ChaCha20Poly1305(ct.fromString(t.symKey,or)).seal(n,ct.fromString(t.message,Zp));return d3({type:e,sealed:i,iv:n,senderPublicKey:r})}function O$(t){let e=new ZR.ChaCha20Poly1305(ct.fromString(t.symKey,or)),{sealed:r,iv:n}=tb(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ct.toString(i,Zp)}function d3(t){if(xl(t.type)===eu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ct.toString(ct.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),$p)}return ct.toString(ct.concat([t.type,t.iv,t.sealed]),$p)}function tb(t){let e=ct.fromString(t,$p),r=e.slice(I$,jR),n=jR;if(xl(r)===eu){let a=n+eb,u=a+QA,c=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:c}}let i=n+QA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function D$(t,e){let r=tb(t);return h3({type:xl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ct.toString(r.senderPublicKey,or):void 0,receiverPublicKey:e?.receiverPublicKey})}function h3(t){let e=t?.type||ZA;if(e===eu){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 P$(t){return t.type===eu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var R$=Object.defineProperty,QR=Object.getOwnPropertySymbols,B$=Object.prototype.hasOwnProperty,L$=Object.prototype.propertyIsEnumerable,zR=(t,e,r)=>e in t?R$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WR=(t,e)=>{for(var r in e||(e={}))B$.call(e,r)&&zR(t,r,e[r]);if(QR)for(var r of QR(e))L$.call(e,r)&&zR(t,r,e[r]);return t},p3="ReactNative",sr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Kp=" ",F$=":",g3="/",rb=2,M$=1e3,y3="js";function nb(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function tu(){return!Za.getDocument()&&!!Za.getNavigator()&&navigator.product===p3}function Nl(){return!nb()&&!!Za.getNavigator()&&!!Za.getDocument()}function ao(){return tu()?sr.reactNative:nb()?sr.node:Nl()?sr.browser:sr.unknown}function U$(){var t;try{return tu()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function m3(t,e){let r=Wp.parse(t);return r=WR(WR({},r),e),t=Wp.stringify(r),t}function q$(){return h$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function V$(t,e){var r;let n=ao(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=Za.getLocation())==null?void 0:r.host)||"unknown"),i}function w3(){if(ao()===sr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=d$.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 E3(){var t;let e=ao();return e===sr.browser?[e,((t=Za.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function v3(t,e,r){let n=w3(),i=E3();return[[t,e].join("-"),[y3,r].join("-"),n,i].join("/")}function H$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){let u=r.split("?"),c=v3(t,e,n),f={auth:i,ua:c,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},d=m3(u[1]||"",f);return u[0]+"?"+d}function k$(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 G$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function A3(t,e=rb){return b3(t.split(g3),e)}function j$(t){return A3(t).join(Kp)}function Xi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function b3(t,e=rb){return t.slice(Math.max(t.length-e,0))}function Q$(t){return Object.fromEntries(t.entries())}function z$(t){return new Map(Object.entries(t))}function W$(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var $$=t=>t;function I3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function K$(t){return t.split(Kp).map(e=>I3(e)).join(Kp)}function Y$(t=Xa.FIVE_MINUTES,e){let r=Xa.toMiliseconds(t||Xa.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 J$(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 ib(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 X$(t){return ib("topic",t)}function Z$(t){return ib("id",t)}function eK(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 tK(t,e){return Xa.fromMiliseconds((e||Date.now())+Xa.toMiliseconds(t))}function rK(t){return Date.now()>=Xa.toMiliseconds(t)}function nK(t,e){return`${t}${e?`:${e}`:""}`}function Zi(t=[],e=[]){return[...new Set([...t,...e])]}async function iK({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=ao();o===sr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===sr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function sK(t,e){try{return await t.getItem(e)||(Nl()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var _3="irn";function oK(t){return t?.relay||{protocol:_3}}function aK(t){let e=g$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var uK=Object.defineProperty,$R=Object.getOwnPropertySymbols,cK=Object.prototype.hasOwnProperty,lK=Object.prototype.propertyIsEnumerable,KR=(t,e,r)=>e in t?uK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fK=(t,e)=>{for(var r in e||(e={}))cK.call(e,r)&&KR(t,r,e[r]);if($R)for(var r of $R(e))lK.call(e,r)&&KR(t,r,e[r]);return t};function S3(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 dK(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):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=Wp.parse(s);return{protocol:n,topic:T3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:S3(o)}}function T3(t){return t.startsWith("//")?t.substring(2):t}function C3(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 hK(t){return`${t.protocol}:${t.topic}@${t.version}?`+Wp.stringify(fK({symKey:t.symKey},C3(t.relay)))}var pK=Object.defineProperty,gK=Object.defineProperties,yK=Object.getOwnPropertyDescriptors,YR=Object.getOwnPropertySymbols,mK=Object.prototype.hasOwnProperty,wK=Object.prototype.propertyIsEnumerable,JR=(t,e,r)=>e in t?pK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,EK=(t,e)=>{for(var r in e||(e={}))mK.call(e,r)&&JR(t,r,e[r]);if(YR)for(var r of YR(e))wK.call(e,r)&&JR(t,r,e[r]);return t},vK=(t,e)=>gK(t,yK(e));function uo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function x3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...uo(r.accounts))}),e}function N3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function O3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.events)}),r}function AK(t,e){let r=V3(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 bK(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=zA(e),s=zA(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,d=n[c].methods,g=n[c].events,m=n[c].accounts;f.forEach(y=>{if(!m.some(A=>A.includes(y)))throw new Error(`No accounts provided for chain ${y} in namespace ${c}`)}),o[c]={chains:f,methods:d,events:g,accounts:m}});let a=k3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(y=>{var A,O;return(O=(A=i[c])==null?void 0:A.chains)==null?void 0:O.includes(y)}),d=n[c].methods.filter(y=>{var A,O;return(O=(A=i[c])==null?void 0:A.methods)==null?void 0:O.includes(y)}),g=n[c].events.filter(y=>{var A,O;return(O=(A=i[c])==null?void 0:A.events)==null?void 0:O.includes(y)}),m=f.map(y=>n[c].accounts.filter(A=>A.includes(`${y}:`))).flat();u[c]={chains:f,methods:d,events:g,accounts:m}}),Object.keys(s).forEach(c=>{var f,d,g,m,y,A;if(!n[c])return;let O=(d=(f=s[c])==null?void 0:f.chains)==null?void 0:d.filter(b=>n[c].chains.includes(b)),R=n[c].methods.filter(b=>{var S,N;return(N=(S=s[c])==null?void 0:S.methods)==null?void 0:N.includes(b)}),z=n[c].events.filter(b=>{var S,N;return(N=(S=s[c])==null?void 0:S.events)==null?void 0:N.includes(b)}),M=O?.map(b=>n[c].accounts.filter(S=>S.includes(`${b}:`))).flat();u[c]={chains:Zi((g=u[c])==null?void 0:g.chains,O),methods:Zi((m=u[c])==null?void 0:m.methods,R),events:Zi((y=u[c])==null?void 0:y.events,z),accounts:Zi((A=u[c])==null?void 0:A.accounts,M)}}),u)}function sb(t){return t.includes(":")}function D3(t){return sb(t)?t.split(":")[0]:t}function zA(t){var e,r,n;let i={};if(!eg(t))return i;for(let[s,o]of Object.entries(t)){let a=sb(s)?[s]:o.chains,u=o.methods||[],c=o.events||[],f=D3(s);i[f]=vK(EK({},i[f]),{chains:Zi(a,(e=i[f])==null?void 0:e.chains),methods:Zi(u,(r=i[f])==null?void 0:r.methods),events:Zi(c,(n=i[f])==null?void 0:n.events)})}return i}var P3={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}},R3={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 li(t,e){let{message:r,code:n}=R3[t];return{message:e?`${r} ${e}`:r,code:n}}function oo(t,e){let{message:r,code:n}=P3[t];return{message:e?`${r} ${e}`:r,code:n}}function Ol(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function eg(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function es(t){return typeof t>"u"}function _r(t,e){return e&&es(t)?!0:typeof t=="string"&&!!t.trim().length}function tg(t,e){return e&&es(t)?!0:typeof t=="number"&&!isNaN(t)}function IK(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Xi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:c}=t.namespaces[o],f=uo(a),d=r[o];(!Xi(Jp(o,d),f)||!Xi(d.methods,u)||!Xi(d.events,c))&&(s=!1)}),s):!1}function Cl(t){return _r(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function B3(t){if(_r(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Cl(r)}}return!1}function _K(t){if(_r(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function SK(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function TK(t){return t?.topic}function CK(t,e){let r=null;return _r(t?.publicKey,!1)||(r=li("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function WA(t){let e=!0;return Ol(t)?t.length&&(e=t.every(r=>_r(r,!1))):e=!1,e}function L3(t,e,r){let n=null;return Ol(e)&&e.length?e.forEach(i=>{n||Cl(i)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Cl(t)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function F3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=L3(i,Jp(i,s),`${e} ${r}`);o&&(n=o)}),n}function M3(t,e){let r=null;return Ol(t)?t.forEach(n=>{r||B3(n)||(r=oo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=oo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function U3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=M3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function q3(t,e){let r=null;return WA(t?.methods)?WA(t?.events)||(r=oo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=oo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function ob(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=q3(n,`${e}, namespace`);i&&(r=i)}),r}function xK(t,e,r){let n=null;if(t&&eg(t)){let i=ob(t,e);i&&(n=i);let s=F3(t,e,r);s&&(n=s)}else n=li("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function V3(t,e){let r=null;if(t&&eg(t)){let n=ob(t,e);n&&(r=n);let i=U3(t,e);i&&(r=i)}else r=li("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function H3(t){return _r(t.protocol,!0)}function NK(t,e){let r=!1;return e&&!t?r=!0:t&&Ol(t)&&t.length&&t.forEach(n=>{r=H3(n)}),r}function OK(t){return typeof t=="number"}function DK(t){return typeof t<"u"&&typeof t!==null}function PK(t){return!(!t||typeof t!="object"||!t.code||!tg(t.code,!1)||!t.message||!_r(t.message,!1))}function RK(t){return!(es(t)||!_r(t.method,!1))}function BK(t){return!(es(t)||es(t.result)&&es(t.error)||!tg(t.id,!1)||!_r(t.jsonrpc,!1))}function LK(t){return!(es(t)||!_r(t.name,!1))}function FK(t,e){return!(!Cl(e)||!x3(t).includes(e))}function MK(t,e,r){return _r(r,!1)?N3(t,e).includes(r):!1}function UK(t,e,r){return _r(r,!1)?O3(t,e).includes(r):!1}function k3(t,e,r){let n=null,i=qK(t),s=VK(e),o=Object.keys(i),a=Object.keys(s),u=XR(Object.keys(t)),c=XR(Object.keys(e)),f=u.filter(d=>!c.includes(d));return f.length&&(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)},rb="base10",or="base16",$p="base64pad",Zp="utf8",nb=0,ru=1,L$=0,JR=1,KA=12,ib=32;function F$(){let t=c3.generateKeyPair();return{privateKey:ct.toString(t.secretKey,or),publicKey:ct.toString(t.publicKey,or)}}function M$(){let t=a3.randomBytes(ib);return ct.toString(t,or)}function U$(t,e){let r=c3.sharedKey(ct.fromString(t,or),ct.fromString(e,or),!0),n=new b$.HKDF(ZA.SHA256,r).expand(ib);return ct.toString(n,or)}function q$(t){let e=ZA.hash(ct.fromString(t,or));return ct.toString(e,or)}function V$(t){let e=ZA.hash(ct.fromString(t,Zp));return ct.toString(e,or)}function w3(t){return ct.fromString(`${t}`,rb)}function xl(t){return Number(ct.toString(t,rb))}function H$(t){let e=w3(typeof t.type<"u"?t.type:nb);if(xl(e)===ru&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ct.fromString(t.senderPublicKey,or):void 0,n=typeof t.iv<"u"?ct.fromString(t.iv,or):a3.randomBytes(KA),i=new o3.ChaCha20Poly1305(ct.fromString(t.symKey,or)).seal(n,ct.fromString(t.message,Zp));return E3({type:e,sealed:i,iv:n,senderPublicKey:r})}function k$(t){let e=new o3.ChaCha20Poly1305(ct.fromString(t.symKey,or)),{sealed:r,iv:n}=sb(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ct.toString(i,Zp)}function E3(t){if(xl(t.type)===ru){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ct.toString(ct.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),$p)}return ct.toString(ct.concat([t.type,t.iv,t.sealed]),$p)}function sb(t){let e=ct.fromString(t,$p),r=e.slice(L$,JR),n=JR;if(xl(r)===ru){let a=n+ib,u=a+KA,c=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:c}}let i=n+KA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function G$(t,e){let r=sb(t);return v3({type:xl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ct.toString(r.senderPublicKey,or):void 0,receiverPublicKey:e?.receiverPublicKey})}function v3(t){let e=t?.type||nb;if(e===ru){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 j$(t){return t.type===ru&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var Q$=Object.defineProperty,XR=Object.getOwnPropertySymbols,z$=Object.prototype.hasOwnProperty,W$=Object.prototype.propertyIsEnumerable,ZR=(t,e,r)=>e in t?Q$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,e3=(t,e)=>{for(var r in e||(e={}))z$.call(e,r)&&ZR(t,r,e[r]);if(XR)for(var r of XR(e))W$.call(e,r)&&ZR(t,r,e[r]);return t},A3="ReactNative",sr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Kp=" ",$$=":",b3="/",ob=2,K$=1e3,I3="js";function ab(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function nu(){return!tu.getDocument()&&!!tu.getNavigator()&&navigator.product===A3}function Nl(){return!ab()&&!!tu.getNavigator()&&!!tu.getDocument()}function ao(){return nu()?sr.reactNative:ab()?sr.node:Nl()?sr.browser:sr.unknown}function Y$(){var t;try{return nu()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function _3(t,e){let r=Wp.parse(t);return r=e3(e3({},r),e),t=Wp.stringify(r),t}function J$(){return S$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function X$(t,e){var r;let n=ao(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=tu.getLocation())==null?void 0:r.host)||"unknown"),i}function S3(){if(ao()===sr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=_$.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 T3(){var t;let e=ao();return e===sr.browser?[e,((t=tu.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function C3(t,e,r){let n=S3(),i=T3();return[[t,e].join("-"),[I3,r].join("-"),n,i].join("/")}function Z$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){let u=r.split("?"),c=C3(t,e,n),f={auth:i,ua:c,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},d=_3(u[1]||"",f);return u[0]+"?"+d}function eK(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 tK(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function x3(t,e=ob){return N3(t.split(b3),e)}function rK(t){return x3(t).join(Kp)}function Zi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function N3(t,e=ob){return t.slice(Math.max(t.length-e,0))}function nK(t){return Object.fromEntries(t.entries())}function iK(t){return new Map(Object.entries(t))}function sK(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var oK=t=>t;function O3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function aK(t){return t.split(Kp).map(e=>O3(e)).join(Kp)}function uK(t=eu.FIVE_MINUTES,e){let r=eu.toMiliseconds(t||eu.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 cK(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 ub(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 lK(t){return ub("topic",t)}function fK(t){return ub("id",t)}function dK(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 hK(t,e){return eu.fromMiliseconds((e||Date.now())+eu.toMiliseconds(t))}function pK(t){return Date.now()>=eu.toMiliseconds(t)}function gK(t,e){return`${t}${e?`:${e}`:""}`}function es(t=[],e=[]){return[...new Set([...t,...e])]}async function yK({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=ao();o===sr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===sr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function mK(t,e){try{return await t.getItem(e)||(Nl()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var D3="irn";function wK(t){return t?.relay||{protocol:D3}}function EK(t){let e=C$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var vK=Object.defineProperty,t3=Object.getOwnPropertySymbols,AK=Object.prototype.hasOwnProperty,bK=Object.prototype.propertyIsEnumerable,r3=(t,e,r)=>e in t?vK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,IK=(t,e)=>{for(var r in e||(e={}))AK.call(e,r)&&r3(t,r,e[r]);if(t3)for(var r of t3(e))bK.call(e,r)&&r3(t,r,e[r]);return t};function P3(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 _K(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):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=Wp.parse(s);return{protocol:n,topic:R3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:P3(o)}}function R3(t){return t.startsWith("//")?t.substring(2):t}function B3(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 SK(t){return`${t.protocol}:${t.topic}@${t.version}?`+Wp.stringify(IK({symKey:t.symKey},B3(t.relay)))}var TK=Object.defineProperty,CK=Object.defineProperties,xK=Object.getOwnPropertyDescriptors,n3=Object.getOwnPropertySymbols,NK=Object.prototype.hasOwnProperty,OK=Object.prototype.propertyIsEnumerable,i3=(t,e,r)=>e in t?TK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,DK=(t,e)=>{for(var r in e||(e={}))NK.call(e,r)&&i3(t,r,e[r]);if(n3)for(var r of n3(e))OK.call(e,r)&&i3(t,r,e[r]);return t},PK=(t,e)=>CK(t,xK(e));function uo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function L3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...uo(r.accounts))}),e}function F3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function M3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.events)}),r}function RK(t,e){let r=W3(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 BK(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=YA(e),s=YA(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,d=n[c].methods,g=n[c].events,m=n[c].accounts;f.forEach(y=>{if(!m.some(b=>b.includes(y)))throw new Error(`No accounts provided for chain ${y} in namespace ${c}`)}),o[c]={chains:f,methods:d,events:g,accounts:m}});let a=K3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(y=>{var b,O;return(O=(b=i[c])==null?void 0:b.chains)==null?void 0:O.includes(y)}),d=n[c].methods.filter(y=>{var b,O;return(O=(b=i[c])==null?void 0:b.methods)==null?void 0:O.includes(y)}),g=n[c].events.filter(y=>{var b,O;return(O=(b=i[c])==null?void 0:b.events)==null?void 0:O.includes(y)}),m=f.map(y=>n[c].accounts.filter(b=>b.includes(`${y}:`))).flat();u[c]={chains:f,methods:d,events:g,accounts:m}}),Object.keys(s).forEach(c=>{var f,d,g,m,y,b;if(!n[c])return;let O=(d=(f=s[c])==null?void 0:f.chains)==null?void 0:d.filter(E=>n[c].chains.includes(E)),R=n[c].methods.filter(E=>{var S,N;return(N=(S=s[c])==null?void 0:S.methods)==null?void 0:N.includes(E)}),z=n[c].events.filter(E=>{var S,N;return(N=(S=s[c])==null?void 0:S.events)==null?void 0:N.includes(E)}),M=O?.map(E=>n[c].accounts.filter(S=>S.includes(`${E}:`))).flat();u[c]={chains:es((g=u[c])==null?void 0:g.chains,O),methods:es((m=u[c])==null?void 0:m.methods,R),events:es((y=u[c])==null?void 0:y.events,z),accounts:es((b=u[c])==null?void 0:b.accounts,M)}}),u)}function cb(t){return t.includes(":")}function U3(t){return cb(t)?t.split(":")[0]:t}function YA(t){var e,r,n;let i={};if(!eg(t))return i;for(let[s,o]of Object.entries(t)){let a=cb(s)?[s]:o.chains,u=o.methods||[],c=o.events||[],f=U3(s);i[f]=PK(DK({},i[f]),{chains:es(a,(e=i[f])==null?void 0:e.chains),methods:es(u,(r=i[f])==null?void 0:r.methods),events:es(c,(n=i[f])==null?void 0:n.events)})}return i}var q3={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}},V3={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 li(t,e){let{message:r,code:n}=V3[t];return{message:e?`${r} ${e}`:r,code:n}}function oo(t,e){let{message:r,code:n}=q3[t];return{message:e?`${r} ${e}`:r,code:n}}function Ol(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function eg(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function ts(t){return typeof t>"u"}function _r(t,e){return e&&ts(t)?!0:typeof t=="string"&&!!t.trim().length}function tg(t,e){return e&&ts(t)?!0:typeof t=="number"&&!isNaN(t)}function LK(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Zi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:c}=t.namespaces[o],f=uo(a),d=r[o];(!Zi(Jp(o,d),f)||!Zi(d.methods,u)||!Zi(d.events,c))&&(s=!1)}),s):!1}function Cl(t){return _r(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function H3(t){if(_r(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Cl(r)}}return!1}function FK(t){if(_r(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function MK(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function UK(t){return t?.topic}function qK(t,e){let r=null;return _r(t?.publicKey,!1)||(r=li("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function JA(t){let e=!0;return Ol(t)?t.length&&(e=t.every(r=>_r(r,!1))):e=!1,e}function k3(t,e,r){let n=null;return Ol(e)&&e.length?e.forEach(i=>{n||Cl(i)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Cl(t)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function G3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=k3(i,Jp(i,s),`${e} ${r}`);o&&(n=o)}),n}function j3(t,e){let r=null;return Ol(t)?t.forEach(n=>{r||H3(n)||(r=oo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=oo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Q3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=j3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function z3(t,e){let r=null;return JA(t?.methods)?JA(t?.events)||(r=oo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=oo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function lb(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=z3(n,`${e}, namespace`);i&&(r=i)}),r}function VK(t,e,r){let n=null;if(t&&eg(t)){let i=lb(t,e);i&&(n=i);let s=G3(t,e,r);s&&(n=s)}else n=li("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function W3(t,e){let r=null;if(t&&eg(t)){let n=lb(t,e);n&&(r=n);let i=Q3(t,e);i&&(r=i)}else r=li("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function $3(t){return _r(t.protocol,!0)}function HK(t,e){let r=!1;return e&&!t?r=!0:t&&Ol(t)&&t.length&&t.forEach(n=>{r=$3(n)}),r}function kK(t){return typeof t=="number"}function GK(t){return typeof t<"u"&&typeof t!==null}function jK(t){return!(!t||typeof t!="object"||!t.code||!tg(t.code,!1)||!t.message||!_r(t.message,!1))}function QK(t){return!(ts(t)||!_r(t.method,!1))}function zK(t){return!(ts(t)||ts(t.result)&&ts(t.error)||!tg(t.id,!1)||!_r(t.jsonrpc,!1))}function WK(t){return!(ts(t)||!_r(t.name,!1))}function $K(t,e){return!(!Cl(e)||!L3(t).includes(e))}function KK(t,e,r){return _r(r,!1)?F3(t,e).includes(r):!1}function YK(t,e,r){return _r(r,!1)?M3(t,e).includes(r):!1}function K3(t,e,r){let n=null,i=JK(t),s=XK(e),o=Object.keys(i),a=Object.keys(s),u=s3(Object.keys(t)),c=s3(Object.keys(e)),f=u.filter(d=>!c.includes(d));return f.length&&(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Xi(o,a)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),Zi(o,a)||(n=li("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 g=uo(e[d].accounts);g.includes(d)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${g.toString()}`))}),o.forEach(d=>{n||(Xi(i[d].methods,s[d].methods)?Xi(i[d].events,s[d].events)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function qK(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 XR(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function VK(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:uo(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 HK(t,e){return tg(t,!1)&&t<=e.max&&t>=e.min}function kK(){let t=ao();return new Promise(e=>{switch(t){case sr.browser:e(G3());break;case sr.reactNative:e(j3());break;case sr.node:e(Q3());break;default:e(!0)}})}function G3(){return Nl()&&navigator?.onLine}async function j3(){return tu()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function Q3(){return!0}function GK(t){switch(ao()){case sr.browser:z3(t);break;case sr.reactNative:W3(t);break;case sr.node:break}}function z3(t){!tu()&&Nl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function W3(t){tu()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var jA={},$A=class{static get(e){return jA[e]}static set(e,r){jA[e]=r}static delete(e){delete jA[e]}};V.BASE10=XA,V.BASE16=or,V.BASE64=$p,V.COLON=F$,V.DEFAULT_DEPTH=rb,V.EMPTY_SPACE=Kp,V.ENV_MAP=sr,V.INTERNAL_ERRORS=R3,V.MemoryStore=$A,V.ONE_THOUSAND=M$,V.REACT_NATIVE_PRODUCT=p3,V.RELAYER_DEFAULT_PROTOCOL=_3,V.SDK_ERRORS=P3,V.SDK_TYPE=y3,V.SLASH=g3,V.TYPE_0=ZA,V.TYPE_1=eu,V.UTF8=Zp,V.appendToQueryString=m3,V.assertType=G$,V.buildApprovedNamespaces=bK,V.calcExpiry=tK,V.capitalize=K$,V.capitalizeWord=I3,V.createDelayedPromise=Y$,V.createExpiringPromise=J$,V.decodeTypeByte=xl,V.decrypt=O$,V.deriveSymKey=T$,V.deserialize=tb,V.encodeTypeByte=f3,V.encrypt=N$,V.engineEvent=nK,V.enumify=$$,V.formatAccountId=s3,V.formatAccountWithChain=y$,V.formatChainId=i3,V.formatExpirerTarget=ib,V.formatIdTarget=Z$,V.formatMessage=b$,V.formatMessageContext=j$,V.formatRelayParams=C3,V.formatRelayRpcUrl=H$,V.formatTopicTarget=X$,V.formatUA=v3,V.formatUri=hK,V.generateKeyPair=_$,V.generateRandomBytes32=S$,V.getAccountsChains=uo,V.getAccountsFromNamespaces=w$,V.getAddressFromAccount=o3,V.getAddressesFromAccounts=m$,V.getAppMetadata=q$,V.getBrowserOnlineStatus=G3,V.getBundleId=U$,V.getChainFromAccount=a3,V.getChainsFromAccounts=u3,V.getChainsFromNamespace=Jp,V.getChainsFromNamespaces=E$,V.getChainsFromRequiredNamespaces=v$,V.getDeepLink=sK,V.getDidAddress=l3,V.getDidAddressSegments=Xp,V.getDidChainId=c3,V.getEnvironment=ao,V.getHttpUrl=k$,V.getInternalError=li,V.getJavascriptID=E3,V.getJavascriptOS=w3,V.getLastItems=b3,V.getNamespacedDidChainId=A$,V.getNamespacesChains=x3,V.getNamespacesEventsForChainId=O3,V.getNamespacesMethodsForChainId=N3,V.getNodeOnlineStatus=Q3,V.getReactNativeOnlineStatus=j3,V.getRelayClientMetadata=V$,V.getRelayProtocolApi=aK,V.getRelayProtocolName=oK,V.getRequiredNamespacesFromNamespaces=AK,V.getSdkError=oo,V.getUniqueValues=JA,V.handleDeeplinkRedirect=iK,V.hasOverlap=Xi,V.hashKey=C$,V.hashMessage=x$,V.isBrowser=Nl,V.isCaipNamespace=sb,V.isConformingNamespaces=k3,V.isExpired=rK,V.isNode=nb,V.isOnline=kK,V.isProposalStruct=SK,V.isReactNative=tu,V.isSessionCompatible=IK,V.isSessionStruct=TK,V.isTypeOneEnvelope=P$,V.isUndefined=es,V.isValidAccountId=B3,V.isValidAccounts=M3,V.isValidActions=q3,V.isValidArray=Ol,V.isValidChainId=Cl,V.isValidChains=L3,V.isValidController=CK,V.isValidErrorReason=PK,V.isValidEvent=LK,V.isValidId=OK,V.isValidNamespaceAccounts=U3,V.isValidNamespaceActions=ob,V.isValidNamespaceChains=F3,V.isValidNamespaceMethodsOrEvents=WA,V.isValidNamespaces=V3,V.isValidNamespacesChainId=FK,V.isValidNamespacesEvent=UK,V.isValidNamespacesRequest=MK,V.isValidNumber=tg,V.isValidObject=eg,V.isValidParams=DK,V.isValidRelay=H3,V.isValidRelays=NK,V.isValidRequest=RK,V.isValidRequestExpiry=HK,V.isValidRequiredNamespaces=xK,V.isValidResponse=BK,V.isValidString=_r,V.isValidUrl=_K,V.mapEntries=W$,V.mapToObj=Q$,V.mergeArrays=Zi,V.normalizeNamespaces=zA,V.objToMap=z$,V.parseAccountId=YA,V.parseChainId=n3,V.parseContextNames=A3,V.parseExpirerTarget=eK,V.parseNamespaceKey=D3,V.parseRelayParams=S3,V.parseTopic=T3,V.parseUri=dK,V.serialize=d3,V.subscribeToBrowserNetworkChange=z3,V.subscribeToNetworkChange=GK,V.subscribeToReactNativeNetworkChange=W3,V.validateDecoding=D$,V.validateEncoding=h3});var $3,K3,Y3,J3,rg,Pl,ab,ng,ts,Rl,ig=he(()=>{l();$3="PARSE_ERROR",K3="INVALID_REQUEST",Y3="METHOD_NOT_FOUND",J3="INVALID_PARAMS",rg="INTERNAL_ERROR",Pl="SERVER_ERROR",ab=[-32700,-32600,-32601,-32602,-32603],ng=[-32e3,-32099],ts={[$3]:{code:-32700,message:"Parse error"},[K3]:{code:-32600,message:"Invalid Request"},[Y3]:{code:-32601,message:"Method not found"},[J3]:{code:-32602,message:"Invalid params"},[rg]:{code:-32603,message:"Internal error"},[Pl]:{code:-32e3,message:"Server error"}},Rl=Pl});function jK(t){return t<=ng[0]&&t>=ng[1]}function sg(t){return ab.includes(t)}function X3(t){return typeof t=="number"}function og(t){return Object.keys(ts).includes(t)?ts[t]:ts[Rl]}function ag(t){let e=Object.values(ts).find(r=>r.code===t);return e||ts[Rl]}function QK(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(!X3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(sg(t.error.code)){let e=ag(t.error.code);if(e.message!==ts[Rl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function ub(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var cb=he(()=>{l();ig()});var eB=v(rs=>{"use strict";l();Object.defineProperty(rs,"__esModule",{value:!0});rs.isBrowserCryptoAvailable=rs.getSubtleCrypto=rs.getBrowerCrypto=void 0;function lb(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}rs.getBrowerCrypto=lb;function Z3(){let t=lb();return t.subtle||t.webkitSubtle}rs.getSubtleCrypto=Z3;function zK(){return!!lb()&&!!Z3()}rs.isBrowserCryptoAvailable=zK});var nB=v(ns=>{"use strict";l();Object.defineProperty(ns,"__esModule",{value:!0});ns.isBrowser=ns.isNode=ns.isReactNative=void 0;function tB(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ns.isReactNative=tB;function rB(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}ns.isNode=rB;function WK(){return!tB()&&!rB()}ns.isBrowser=WK});var fb=v(ug=>{"use strict";l();Object.defineProperty(ug,"__esModule",{value:!0});var iB=(en(),ht(Zr));iB.__exportStar(eB(),ug);iB.__exportStar(nB(),ug)});var Ht={};ft(Ht,{isNodeJs:()=>oB});var sB,oB,aB=he(()=>{l();sB=Se(fb());Qt(Ht,Se(fb()));oB=sB.isNode});function db(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function hb(t=6){return BigInt(db(t))}function pb(t,e,r){return{id:r||db(),jsonrpc:"2.0",method:t,params:e}}function $K(t,e){return{id:t,jsonrpc:"2.0",result:e}}function gb(t,e,r){return{id:t,jsonrpc:"2.0",error:uB(e,r)}}function uB(t,e){return typeof t>"u"?og(rg):(typeof t=="string"&&(t=Object.assign(Object.assign({},og(Pl)),{message:t})),typeof e<"u"&&(t.data=e),sg(t.code)&&(t=ag(t.code)),t)}var cB=he(()=>{l();cb();ig()});function KK(t){return t.includes("*")?lg(t):!/\W/g.test(t)}function cg(t){return t==="*"}function lg(t){return cg(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function YK(t){return!cg(t)&&lg(t)&&!t.split("*")[0].trim()}function JK(t){return!cg(t)&&lg(t)&&!t.split("*")[1].trim()}var lB=he(()=>{l()});var fB=he(()=>{l()});var ru,yb=he(()=>{l();ru=class{}});var mb,fg,Bl,dB=he(()=>{l();yb();mb=class extends ru{constructor(e){super()}},fg=class extends ru{constructor(){super()}},Bl=class extends fg{constructor(e){super()}}});var hB=he(()=>{l()});var pB=he(()=>{l();fB();yb();dB();hB()});var gB=he(()=>{l();pB()});function eY(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function yB(t,e){let r=eY(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function tY(t){return yB(t,XK)}function dg(t){return yB(t,ZK)}function wb(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var XK,ZK,mB=he(()=>{l();XK="^https?:",ZK="^wss?:"});function Eb(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function rY(t){return Eb(t)&&"method"in t}function vb(t){return Eb(t)&&(wB(t)||hg(t))}function wB(t){return"result"in t}function hg(t){return"error"in t}function nY(t){return"error"in t&&t.valid===!1}var EB=he(()=>{l()});var rr={};ft(rr,{DEFAULT_ERROR:()=>Rl,IBaseJsonRpcProvider:()=>fg,IEvents:()=>ru,IJsonRpcConnection:()=>mb,IJsonRpcProvider:()=>Bl,INTERNAL_ERROR:()=>rg,INVALID_PARAMS:()=>J3,INVALID_REQUEST:()=>K3,METHOD_NOT_FOUND:()=>Y3,PARSE_ERROR:()=>$3,RESERVED_ERROR_CODES:()=>ab,SERVER_ERROR:()=>Pl,SERVER_ERROR_CODE_RANGE:()=>ng,STANDARD_ERROR_MAP:()=>ts,formatErrorMessage:()=>uB,formatJsonRpcError:()=>gb,formatJsonRpcRequest:()=>pb,formatJsonRpcResult:()=>$K,getBigIntRpcId:()=>hb,getError:()=>og,getErrorByCode:()=>ag,isHttpUrl:()=>tY,isJsonRpcError:()=>hg,isJsonRpcPayload:()=>Eb,isJsonRpcRequest:()=>rY,isJsonRpcResponse:()=>vb,isJsonRpcResult:()=>wB,isJsonRpcValidationInvalid:()=>nY,isLocalhostUrl:()=>wb,isNodeJs:()=>oB,isReservedErrorCode:()=>sg,isServerErrorCode:()=>jK,isValidDefaultRoute:()=>cg,isValidErrorCode:()=>X3,isValidLeadingWildcardRoute:()=>YK,isValidRoute:()=>KK,isValidTrailingWildcardRoute:()=>JK,isValidWildcardRoute:()=>lg,isWsUrl:()=>dg,parseConnectionError:()=>ub,payloadId:()=>db,validateJsonRpcError:()=>QK});var Ll=he(()=>{l();ig();cb();aB();Qt(rr,Ht);cB();lB();gB();mB();EB()});var vB,pg,AB,Ab=he(()=>{l();vB=Se(ti());Ll();pg=class extends Bl{constructor(e){super(e),this.events=new vB.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(pb(e.method,e.params||[],e.id||hb().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=>{hg(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),vb(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)}},AB=pg});var bB={};ft(bB,{JsonRpcProvider:()=>pg,default:()=>iY});var iY,IB=he(()=>{l();Ab();Ab();iY=AB});var SB=v((zye,_B)=>{"use strict";l();_B.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var NB={};ft(NB,{WsConnection:()=>bb,default:()=>bb});var xB,sY,oY,TB,CB,aY,bb,OB=he(()=>{l();xB=Se(ti());nl();Ll();sY=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:SB(),oY=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",TB=t=>t.split("?")[0],CB=10,aY=sY(),bb=class{constructor(e){if(this.url=e,this.events=new xB.EventEmitter,this.registering=!1,!dg(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){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Qi(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!dg(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=new URLSearchParams(e).get("origin"),s=(0,rr.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!wb(e)},o=new aY(e,[],s);oY()?o.onerror=a=>{let u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}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"?ji(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=gb(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return ub(e,TB(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>CB&&this.events.setMaxListeners(CB)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${TB(this.url)}`));return this.events.emit("register_error",r),r}}});var f6=v((Fl,iu)=>{l();var uY=200,Rb="__lodash_hash_undefined__",bg=1,kB=2,GB=9007199254740991,gg="[object Arguments]",Tb="[object Array]",cY="[object AsyncFunction]",jB="[object Boolean]",QB="[object Date]",zB="[object Error]",WB="[object Function]",lY="[object GeneratorFunction]",yg="[object Map]",$B="[object Number]",fY="[object Null]",nu="[object Object]",DB="[object Promise]",dY="[object Proxy]",KB="[object RegExp]",mg="[object Set]",YB="[object String]",hY="[object Symbol]",pY="[object Undefined]",Cb="[object WeakMap]",JB="[object ArrayBuffer]",wg="[object DataView]",gY="[object Float32Array]",yY="[object Float64Array]",mY="[object Int8Array]",wY="[object Int16Array]",EY="[object Int32Array]",vY="[object Uint8Array]",AY="[object Uint8ClampedArray]",bY="[object Uint16Array]",IY="[object Uint32Array]",_Y=/[\\^$.*+?()[\]{}|]/g,SY=/^\[object .+?Constructor\]$/,TY=/^(?:0|[1-9]\d*)$/,st={};st[gY]=st[yY]=st[mY]=st[wY]=st[EY]=st[vY]=st[AY]=st[bY]=st[IY]=!0;st[gg]=st[Tb]=st[JB]=st[jB]=st[wg]=st[QB]=st[zB]=st[WB]=st[yg]=st[$B]=st[nu]=st[KB]=st[mg]=st[YB]=st[Cb]=!1;var XB=typeof global=="object"&&global&&global.Object===Object&&global,CY=typeof self=="object"&&self&&self.Object===Object&&self,fi=XB||CY||Function("return this")(),ZB=typeof Fl=="object"&&Fl&&!Fl.nodeType&&Fl,PB=ZB&&typeof iu=="object"&&iu&&!iu.nodeType&&iu,e6=PB&&PB.exports===ZB,Ib=e6&&XB.process,RB=function(){try{return Ib&&Ib.binding&&Ib.binding("util")}catch{}}(),BB=RB&&RB.isTypedArray;function xY(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function iJ(t,e){var r=this.__data__,n=_g(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}di.prototype.clear=eJ;di.prototype.delete=tJ;di.prototype.get=rJ;di.prototype.has=nJ;di.prototype.set=iJ;function fo(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,d=!0,g=r&kB?new vg:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=GB}function c6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ql(t){return t!=null&&typeof t=="object"}var l6=BB?PY(BB):AJ;function LJ(t){return RJ(t)?mJ(t):bJ(t)}function FJ(){return[]}function MJ(){return!1}iu.exports=BJ});var Bb=v((Xye,d6)=>{l();d6.exports=function(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],o=[],a={},u=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return s},entries:function(){return o},get:function(f){return a[f.toLowerCase()]},has:function(f){return f.toLowerCase()in a}}}};for(var c in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(f,d,g){s.push(d=d.toLowerCase()),o.push([d,g]),a[d]=a[d]?a[d]+","+g:g}),r(u())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(c,e.headers[c]);i.send(e.body||null)})}});var p6=v((e0e,h6)=>{l();h6.exports=self.fetch||(self.fetch=Bb().default||Bb())});var A8=v(Ee=>{"use strict";l();Object.defineProperty(Ee,"__esModule",{value:!0});var po=ti(),UJ=(R2(),ht(P2)),Gl=Y2(),Qe=h1(),Ln=P1(),g6=(nl(),ht(O2)),qJ=(RP(),ht(PP)),te=Dl(),VJ=(MA(),ht(FA)),Ke=Zs(),HJ=(IB(),ht(bB)),Sr=(Ll(),ht(rr)),kJ=(OB(),ht(NB)),GJ=f6(),jJ=p6();function jl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function QJ(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 zJ=jl(po),WJ=jl(UJ),Tg=QJ(qJ),$J=jl(kJ),KJ=jl(GJ),YJ=jl(jJ);function JJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,b=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,b[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&b[T]===0;)T++;for(var B=u.repeat(A);T>>0,M=new Uint8Array(z);y[A];){var b=r[y.charCodeAt(A)];if(b===255)return;for(var S=0,N=z-1;(b!==0||S>>0,M[N]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");R=S,A++}if(y[A]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var A=g(y);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var XJ=JJ,ZJ=XJ,P6=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")},eX=t=>new TextEncoder().encode(t),tX=t=>new TextDecoder().decode(t),Mb=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")}},Ub=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 R6(this,e)}},qb=class{constructor(e){this.decoders=e}or(e){return R6(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`)}},R6=(t,e)=>new qb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Vb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Mb(e,r,n),this.decoder=new Ub(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Hg=({name:t,prefix:e,encode:r,decode:n})=>new Vb(t,e,r,n),Ql=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=ZJ(r,e);return Hg({prefix:t,name:e,encode:n,decode:s=>P6(i(s))})},rX=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},nX=(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<Hg({prefix:e,name:t,encode(i){return nX(i,n,r)},decode(i){return rX(i,n,r,t)}}),iX=Hg({prefix:"\0",name:"identity",encode:t=>tX(t),decode:t=>eX(t)}),sX=Object.freeze({__proto__:null,identity:iX}),oX=zt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),aX=Object.freeze({__proto__:null,base2:oX}),uX=zt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),cX=Object.freeze({__proto__:null,base8:uX}),lX=Ql({prefix:"9",name:"base10",alphabet:"0123456789"}),fX=Object.freeze({__proto__:null,base10:lX}),dX=zt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),hX=zt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),pX=Object.freeze({__proto__:null,base16:dX,base16upper:hX}),gX=zt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),yX=zt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mX=zt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),wX=zt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),EX=zt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),vX=zt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),AX=zt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),bX=zt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),IX=zt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_X=Object.freeze({__proto__:null,base32:gX,base32upper:yX,base32pad:mX,base32padupper:wX,base32hex:EX,base32hexupper:vX,base32hexpad:AX,base32hexpadupper:bX,base32z:IX}),SX=Ql({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),TX=Ql({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),CX=Object.freeze({__proto__:null,base36:SX,base36upper:TX}),xX=Ql({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),NX=Ql({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),OX=Object.freeze({__proto__:null,base58btc:xX,base58flickr:NX}),DX=zt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),PX=zt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),RX=zt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),BX=zt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),LX=Object.freeze({__proto__:null,base64:DX,base64pad:PX,base64url:RX,base64urlpad:BX}),B6=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}"),FX=B6.reduce((t,e,r)=>(t[r]=e,t),[]),MX=B6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function UX(t){return t.reduce((e,r)=>(e+=FX[r],e),"")}function qX(t){let e=[];for(let r of t){let n=MX[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var VX=Hg({prefix:"\u{1F680}",name:"base256emoji",encode:UX,decode:qX}),HX=Object.freeze({__proto__:null,base256emoji:VX}),kX=L6,y6=128,GX=127,jX=~GX,QX=Math.pow(2,31);function L6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=QX;)e[r++]=t&255|y6,t/=128;for(;t&jX;)e[r++]=t&255|y6,t>>>=7;return e[r]=t|0,L6.bytes=r-n+1,e}var zX=Hb,WX=128,m6=127;function Hb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Hb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&m6)<=WX);return Hb.bytes=s-n,r}var $X=Math.pow(2,7),KX=Math.pow(2,14),YX=Math.pow(2,21),JX=Math.pow(2,28),XX=Math.pow(2,35),ZX=Math.pow(2,42),eZ=Math.pow(2,49),tZ=Math.pow(2,56),rZ=Math.pow(2,63),nZ=function(t){return t<$X?1:t(F6.encode(t,e,r),e),E6=t=>F6.encodingLength(t),kb=(t,e)=>{let r=e.byteLength,n=E6(t),i=n+E6(r),s=new Uint8Array(i+r);return w6(t,s,0),w6(r,s,n),s.set(e,i),new Gb(t,r,e,s)},Gb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},M6=({name:t,code:e,encode:r})=>new jb(t,e,r),jb=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?kb(this.code,r):r.then(n=>kb(this.code,n))}else throw Error("Unknown type, must be binary type")}},U6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),sZ=M6({name:"sha2-256",code:18,encode:U6("SHA-256")}),oZ=M6({name:"sha2-512",code:19,encode:U6("SHA-512")}),aZ=Object.freeze({__proto__:null,sha256:sZ,sha512:oZ}),q6=0,uZ="identity",V6=P6,cZ=t=>kb(q6,V6(t)),lZ={code:q6,name:uZ,encode:V6,digest:cZ},fZ=Object.freeze({__proto__:null,identity:lZ});new TextEncoder,new TextDecoder;var v6={...sX,...aX,...cX,...fX,...pX,..._X,...CX,...OX,...LX,...HX};({...aZ,...fZ});function H6(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function dZ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?H6(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function k6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var A6=k6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Lb=k6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=dZ(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}=te.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Og=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=z6,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=Tg.generateKeyPair(i);return Tg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=te.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Tg.generateKeyPair(s),a=te.generateRandomBytes32(),u=W6;return await Tg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=te.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||te.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=te.validateEncoding(o),u=g6.safeJsonStringify(s);if(te.isTypeOneEnvelope(a)){let g=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(g,m)}let c=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return te.encrypt({type:f,symKey:c,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=te.validateDecoding(s,o);if(te.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,c=a.senderPublicKey;i=await this.generateSharedKey(u,c)}try{let u=this.getSymKey(i),c=te.decrypt({symKey:u,encoded:s});return g6.safeJsonParse(c)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=te.deserialize(i);return te.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=te.deserialize(i);return s.senderPublicKey?VJ.toString(s.senderPublicKey,te.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new Ng(this.core,this.logger)}get context(){return Qe.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(Qb)}catch{e=te.generateRandomBytes32(),await this.keychain.set(Qb,e)}return pZ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Dg=class extends Ln.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=Y6,this.version=J6,this.initialized=!1,this.storagePrefix=hi,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=te.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=te.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Wb=class extends Ln.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new po.EventEmitter,this.name=Z6,this.queue=new Map,this.publishTimeout=Ke.toMiliseconds(Ke.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||X6,u=te.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,d=s?.id||Sr.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:c,tag:f,id:d}},m=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await te.createExpiringPromise(this.rpcPublish(n,i,a,u,c,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(ar.publish,g)}catch(y){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),y;return}finally{clearTimeout(m)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},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=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,c,f,d;let g={method:te.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return te.isUndefined((u=g.params)==null?void 0:u.prompt)&&((c=g.params)==null||delete c.prompt),te.isUndefined((f=g.params)==null?void 0:f.tag)&&((d=g.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){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(Gl.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ar.connection_stalled);return}this.checkQueue()}),this.relayer.on(ar.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},$b=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())}},EZ=Object.defineProperty,vZ=Object.defineProperties,AZ=Object.getOwnPropertyDescriptors,b6=Object.getOwnPropertySymbols,bZ=Object.prototype.hasOwnProperty,IZ=Object.prototype.propertyIsEnumerable,I6=(t,e,r)=>e in t?EZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hl=(t,e)=>{for(var r in e||(e={}))bZ.call(e,r)&&I6(t,r,e[r]);if(b6)for(var r of b6(e))IZ.call(e,r)&&I6(t,r,e[r]);return t},Fb=(t,e)=>vZ(t,AZ(e)),Pg=class extends Ln.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new $b,this.events=new po.EventEmitter,this.name=c8,this.version=l8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),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=te.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 Ke.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)>=f8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!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.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+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=te.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=te.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:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}return te.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:te.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,Fb(Hl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Hl({},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,Hl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Gr.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}=te.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(Gr.deleted,Fb(Hl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Gr.sync)}async reset(){if(this.cached.length){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}=te.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);te.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>Fb(Hl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(ar.connect,async()=>{await this.onConnect()}),this.relayer.on(ar.disconnect,()=>{this.onDisconnect()}),this.events.on(Gr.created,async e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Gr.deleted,async e=>{let r=Gr.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}=te.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)})}},_Z=Object.defineProperty,_6=Object.getOwnPropertySymbols,SZ=Object.prototype.hasOwnProperty,TZ=Object.prototype.propertyIsEnumerable,S6=(t,e,r)=>e in t?_Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CZ=(t,e)=>{for(var r in e||(e={}))SZ.call(e,r)&&S6(t,r,e[r]);if(_6)for(var r of _6(e))TZ.call(e,r)&&S6(t,r,e[r]);return t},Rg=class extends Ln.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new po.EventEmitter,this.name=r8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,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.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(ar.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ar.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Bn.payload,this.onPayloadHandler),this.provider.on(Bn.connect,this.onConnectHandler),this.provider.on(Bn.disconnect,this.onDisconnectHandler),this.provider.on(Bn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||t8})),this.messages=new Dg(this.logger,e.core),this.subscriber=new Pg(this,this.logger),this.publisher=new Wb(this,this.logger),this.relayUrl=e?.relayUrl||Yb,this.projectId=e.projectId,this.bundleId=te.getBundleId(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${zb}...`),await this.restartTransport(zb)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},o8)}get context(){return Qe.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){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Gr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Gr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}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.hasExperiencedNetworkDisruption&&this.connected?await te.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Gr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await te.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Bn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await te.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new HJ.JsonRpcProvider(new $J.default(te.formatRelayRpcUrl({sdkVersion:s8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Sr.isJsonRpcRequest(e)){if(!e.method.endsWith(n8))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(CZ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else Sr.isJsonRpcResponse(e)&&this.events.emit(ar.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ar.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Sr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Bn.payload,this.onPayloadHandler),this.provider.off(Bn.connect,this.onConnectHandler),this.provider.off(Bn.disconnect,this.onDisconnectHandler),this.provider.off(Bn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(ar.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await te.isOnline();te.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(ar.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},Ke.toMiliseconds(i8)))}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},xZ=Object.defineProperty,T6=Object.getOwnPropertySymbols,NZ=Object.prototype.hasOwnProperty,OZ=Object.prototype.propertyIsEnumerable,C6=(t,e,r)=>e in t?xZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x6=(t,e)=>{for(var r in e||(e={}))NZ.call(e,r)&&C6(t,r,e[r]);if(T6)for(var r of T6(e))OZ.call(e,r)&&C6(t,r,e[r]);return t},Bg=class extends Ln.IStore{constructor(e,r,n,i=hi,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=a8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!te.isUndefined(o)?this.map.set(this.getKey(o),o):te.isProposalStruct(o)?this.map.set(o.id,o):te.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=>KJ.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=x6(x6({},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=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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}=te.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}=te.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}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Lg=class{constructor(e,r){this.core=e,this.logger=r,this.name=d8,this.version=h8,this.events=new zJ.default,this.initialized=!1,this.storagePrefix=hi,this.ignoredPayloadTypes=[te.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=te.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=te.calcExpiry(Ke.FIVE_MINUTES),o={protocol:e8},a={topic:i,expiry:s,relay:o,active:!1},u=te.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}=te.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);let u=te.calcExpiry(Ke.FIVE_MINUTES),c={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,c),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(kl.create,c),this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o})),c},this.activate=async({topic:n})=>{this.isInitialized();let i=te.calcExpiry(Ke.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}=te.createDelayedPromise();this.events.once(te.engineEvent("pairing_ping",s),({error:c})=>{c?u(c):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",te.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Sr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=ou[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Sr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=ou[u.request.method].res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Sr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=ou[u.request.method]?ou[u.request.method].res:ou.unregistered_method.res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,te.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=>te.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){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;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(kl.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(()=>{Sr.isJsonRpcResult(i)?this.events.emit(te.engineEvent("pairing_ping",s),{}):Sr.isJsonRpcError(i)&&this.events.emit(te.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(kl.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=te.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(te.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!te.isValidParams(n)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!te.isValidUrl(n.uri)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}let s=te.parseUri(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(o)}if(!(s!=null&&s.symKey)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(o)}},this.isValidPing=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!te.isValidString(n,!1)){let{message:i}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(te.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=te.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new Bg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ar.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{Sr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Sr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(kr.expired,async e=>{let{topic:r}=te.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(kl.expire,{topic:r}))})}},Fg=class extends Ln.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new po.EventEmitter,this.name=p8,this.version=g8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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,expiry:te.calcExpiry(Ke.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(rn.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=Sr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(rn.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(rn.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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:Sr.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(rn.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=te.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(rn.created,e=>{let r=rn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.updated,e=>{let r=rn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.deleted,e=>{let r=rn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{Ke.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Mg=class extends Ln.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new po.EventEmitter,this.name=y8,this.version=m8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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(kr.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(kr.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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 te.formatTopicTarget(e);if(typeof e=="number")return te.formatIdTarget(e);let{message:r}=te.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(kr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=te.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Ke.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(kr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(kr.created,e=>{let r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.expired,e=>{let r=kr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.deleted,e=>{let r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ug=class extends Ln.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=Cg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||te.isReactNative()||!te.isBrowser())return;let i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=xg;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=this.getVerifyUrl(n?.verifyUrl),s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,xg)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(Ke.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(Cg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=Cg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},Ke.toMiliseconds(Ke.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||au;return w8.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${au}`),i=au),i},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=au,this.abortController=new AbortController,this.isDevEnv=te.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Ke.toMiliseconds(e))}},qg=class extends Ln.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=E8,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${v8}/${this.projectId}/clients`;await YJ.default(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=Qe.generateChildLogger(r,this.context)}},DZ=Object.defineProperty,N6=Object.getOwnPropertySymbols,PZ=Object.prototype.hasOwnProperty,RZ=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?DZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D6=(t,e)=>{for(var r in e||(e={}))PZ.call(e,r)&&O6(t,r,e[r]);if(N6)for(var r of N6(e))RZ.call(e,r)&&O6(t,r,e[r]);return t},Vg=class t extends Ln.ICore{constructor(e){super(e),this.protocol=Kb,this.version=G6,this.name=kg,this.events=new po.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||Yb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||j6.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Gl.HeartBeat,this.crypto=new Og(this,this.logger,e?.keychain),this.history=new Fg(this,this.logger),this.expirer=new Mg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new WJ.default(D6(D6({},Q6),e?.storageOptions)),this.relayer=new Rg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Lg(this,this.logger),this.verify=new Ug(this.projectId||"",this.logger),this.echoClient=new qg(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(u8,n),r}get context(){return Qe.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}}},BZ=Vg;Ee.CORE_CONTEXT=kg,Ee.CORE_DEFAULT=j6,Ee.CORE_PROTOCOL=Kb,Ee.CORE_STORAGE_OPTIONS=Q6,Ee.CORE_STORAGE_PREFIX=hi,Ee.CORE_VERSION=G6,Ee.CRYPTO_CLIENT_SEED=Qb,Ee.CRYPTO_CONTEXT=z6,Ee.CRYPTO_JWT_TTL=W6,Ee.Core=BZ,Ee.Crypto=Og,Ee.ECHO_CONTEXT=E8,Ee.ECHO_URL=v8,Ee.EXPIRER_CONTEXT=y8,Ee.EXPIRER_DEFAULT_TTL=wZ,Ee.EXPIRER_EVENTS=kr,Ee.EXPIRER_STORAGE_VERSION=m8,Ee.EchoClient=qg,Ee.Expirer=Mg,Ee.HISTORY_CONTEXT=p8,Ee.HISTORY_EVENTS=rn,Ee.HISTORY_STORAGE_VERSION=g8,Ee.JsonRpcHistory=Fg,Ee.KEYCHAIN_CONTEXT=$6,Ee.KEYCHAIN_STORAGE_VERSION=K6,Ee.KeyChain=Ng,Ee.MESSAGES_CONTEXT=Y6,Ee.MESSAGES_STORAGE_VERSION=J6,Ee.MessageTracker=Dg,Ee.PAIRING_CONTEXT=d8,Ee.PAIRING_DEFAULT_TTL=mZ,Ee.PAIRING_EVENTS=kl,Ee.PAIRING_RPC_OPTS=ou,Ee.PAIRING_STORAGE_VERSION=h8,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=f8,Ee.PUBLISHER_CONTEXT=Z6,Ee.PUBLISHER_DEFAULT_TTL=X6,Ee.Pairing=Lg,Ee.RELAYER_CONTEXT=r8,Ee.RELAYER_DEFAULT_LOGGER=t8,Ee.RELAYER_DEFAULT_PROTOCOL=e8,Ee.RELAYER_DEFAULT_RELAY_URL=Yb,Ee.RELAYER_EVENTS=ar,Ee.RELAYER_FAILOVER_RELAY_URL=zb,Ee.RELAYER_PROVIDER_EVENTS=Bn,Ee.RELAYER_RECONNECT_TIMEOUT=i8,Ee.RELAYER_SDK_VERSION=s8,Ee.RELAYER_STORAGE_OPTIONS=gZ,Ee.RELAYER_SUBSCRIBER_SUFFIX=n8,Ee.RELAYER_TRANSPORT_CUTOFF=o8,Ee.Relayer=Rg,Ee.STORE_STORAGE_VERSION=a8,Ee.SUBSCRIBER_CONTEXT=c8,Ee.SUBSCRIBER_DEFAULT_TTL=yZ,Ee.SUBSCRIBER_EVENTS=Gr,Ee.SUBSCRIBER_STORAGE_VERSION=l8,Ee.Store=Bg,Ee.Subscriber=Pg,Ee.TRUSTED_VERIFY_URLS=w8,Ee.VERIFY_CONTEXT=Cg,Ee.VERIFY_FALLBACK_SERVER=xg,Ee.VERIFY_SERVER=au,Ee.Verify=Ug,Ee.WALLETCONNECT_CLIENT_ID=u8,Ee.default=Vg});var P8=v(Ye=>{"use strict";l();Object.defineProperty(Ye,"__esModule",{value:!0});var Mn=A8(),Gg=h1(),_8=P1(),G=Dl(),S8=ti(),tt=Zs(),wt=(Ll(),ht(rr));function LZ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var FZ=LZ(S8),tI="wc",rI=2,nI="client",$g=`${tI}@${rI}:${nI}:`,jg={name:nI,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},MZ={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"},UZ={database:":memory:"},Jb="WALLETCONNECT_DEEPLINK_CHOICE",qZ={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},VZ="history",HZ="0.3",T8="proposal",kZ=tt.THIRTY_DAYS,C8="Proposal expired",x8="session",Wl=tt.SEVEN_DAYS,N8="engine",uu={wc_sessionPropose:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1115}}},Qg={min:tt.FIVE_MINUTES,max:tt.SEVEN_DAYS},Fn={idle:"IDLE",active:"ACTIVE"},O8="request",D8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],GZ=Object.defineProperty,jZ=Object.defineProperties,QZ=Object.getOwnPropertyDescriptors,b8=Object.getOwnPropertySymbols,zZ=Object.prototype.hasOwnProperty,WZ=Object.prototype.propertyIsEnumerable,I8=(t,e,r)=>e in t?GZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))zZ.call(e,r)&&I8(t,r,e[r]);if(b8)for(var r of b8(e))WZ.call(e,r)&&I8(t,r,e[r]);return t},zl=(t,e)=>jZ(t,QZ(e)),Xb=class extends _8.IEngine{constructor(e){super(e),this.name=N8,this.events=new FZ.default,this.initialized=!1,this.ignoredPayloadTypes=[G.TYPE_1],this.requestQueue={state:Fn.idle,queue:[]},this.sessionRequestQueue={state:Fn.idle,queue:[]},this.requestQueueDelay=tt.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(uu)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=zl(Er({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,c=i,f,d=!1;if(c&&(d=this.client.core.pairing.pairings.get(c).active),!c||!d){let{topic:M,uri:b}=await this.client.core.pairing.create();c=M,f=b}let g=await this.client.core.crypto.generateKeyPair(),m=Er({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Mn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:y,resolve:A,done:O}=G.createDelayedPromise(tt.FIVE_MINUTES,C8);if(this.events.once(G.engineEvent("session_connect"),async({error:M,session:b})=>{if(M)y(M);else if(b){b.self.publicKey=g;let S=zl(Er({},b),{requiredNamespaces:b.requiredNamespaces,optionalNamespaces:b.optionalNamespaces});await this.client.session.set(b.topic,S),await this.setExpiry(b.topic,b.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:b.peer.metadata}),A(S)}}),!c){let{message:M}=G.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(M)}let R=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:m}),z=G.calcExpiry(tt.FIVE_MINUTES);return await this.setProposal(R,Er({id:R,expiry:z},m)),{uri:f,approval:O}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await 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:c,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",G.isValidObject(f)||(f=G.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),m=c.publicKey,y=await this.client.core.crypto.generateSharedKey(g,m);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:c.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let A=Er({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:G.calcExpiry(Wl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(y),await this.sendRequest({topic:y,method:"wc_sessionSettle",params:A,throwOnFailedPublish:!0});let O=zl(Er({},A),{topic:y,pairingTopic:u,acknowledged:!1,self:A.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:g});return await this.client.session.set(y,O),await this.setExpiry(y,G.calcExpiry(Wl)),{topic:y,acknowledged:()=>new Promise(R=>setTimeout(()=>R(this.client.session.get(y)),500))}},this.reject=async r=>{await 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,G.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_update",s),({error:c})=>{c?u(c):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,G.calcExpiry(Wl)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=wt.payloadId(),{done:u,resolve:c,reject:f}=G.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(G.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):c(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await G.getDeepLink(this.client.core.storage,Jb);G.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;wt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):wt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();this.events.once(G.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=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:G.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>G.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(Jb).catch(s=>this.client.logger.warn(s)),this.getPendingSessionRequests().forEach(s=>{s.topic===r&&this.deletePendingSessionRequest(s.id,G.getSdkError("USER_DISCONNECTED"))})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,G.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.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Fn.idle)},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=uu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,G.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:c}=r,f=wt.formatJsonRpcRequest(i,s,u);if(G.isBrowser()&&D8.includes(i)){let m=G.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:m})}let d=await this.client.core.crypto.encode(n,f),g=uu[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),c?(g.internal=zl(Er({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(m=>this.client.logger.error(m)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=wt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),c=await this.client.core.history.get(i,n),f=uu[c.request.method].res;o?(f.internal=zl(Er({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=wt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=uu[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=>{G.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{G.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Fn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Fn.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Fn.idle},this.processRequest=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.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=G.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(Er({},n.params));let o=G.calcExpiry(tt.FIVE_MINUTES),a=Er({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=G.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:c})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(wt.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 c=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else wt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.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:c,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:m}=n.params,y=Er({topic:r,relay:o,expiry:u,namespaces:c,acknowledged:!0,pairingTopic:m,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(G.engineEvent("session_connect"),{session:y}),this.cleanupDuplicatePairings(y)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(G.engineEvent("session_approve",i),{})):wt.isJsonRpcError(n)&&(await this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(Er({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),G.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_update",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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,G.calcExpiry(Wl)),await this.sendResult({id:i,topic:r,result:!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;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_extend",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!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(()=>{wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_ping",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Mn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(Er({topic:r},s));let o=G.hashMessage(JSON.stringify(wt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),c={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(c),this.addSessionRequestToSessionRequestQueue(c),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Er({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),G.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Fn.idle,this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Fn.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Fn.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,wt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(G.isUndefined(n)||await this.isValidPairingTopic(n),!G.isValidRelays(a,!0)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!G.isUndefined(i)&&G.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!G.isUndefined(s)&&G.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=G.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!G.isValidParams(r))throw new Error(G.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=G.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let c=G.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!G.isValidString(s,!0)){let{message:f}=G.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!G.isValidParams(r)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!G.isValidErrorReason(i)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!G.isValidParams(r)){let{message:c}=G.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!G.isValidRelay(n)){let{message:c}=G.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let a=G.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=G.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(G.isExpired(o)){let{message:c}=G.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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=G.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=G.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(!G.isValidNamespacesChainId(a,s)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!G.isValidRequest(i)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!G.isValidNamespacesRequest(a,s,i.method)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!G.isValidRequestExpiry(o,Qg)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Qg.min} and ${Qg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!G.isValidParams(r)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!G.isValidResponse(s)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!G.isValidParams(r)){let{message:a}=G.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(!G.isValidNamespacesChainId(o,s)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!G.isValidEvent(i)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!G.isValidNamespacesEvent(o,s,i.name)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Mn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!G.isValidString(i,!1)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=G.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Mn.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);try{wt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):wt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Mn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=G.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,G.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}))})}registerPairingEvents(){this.client.core.pairing.events.on(Mn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=G.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=G.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(G.isValidString(e,!1)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!G.isValidId(e)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=G.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Zb=class extends Mn.Store{constructor(e,r){super(e,r,T8,$g),this.core=e,this.logger=r}},zg=class extends Mn.Store{constructor(e,r){super(e,r,x8,$g),this.core=e,this.logger=r}},eI=class extends Mn.Store{constructor(e,r){super(e,r,O8,$g,n=>n.id),this.core=e,this.logger=r}},Wg=class t extends _8.ISignClient{constructor(e){super(e),this.protocol=tI,this.version=rI,this.name=jg.name,this.events=new S8.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||jg.name,this.metadata=e?.metadata||G.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Gg.pino(Gg.getDefaultLoggerOptions({level:e?.logger||jg.logger}));this.core=e?.core||new Mn.Core(e),this.logger=Gg.generateChildLogger(r,this.name),this.session=new zg(this.core,this.logger),this.proposal=new Zb(this.core,this.logger),this.pendingRequest=new eI(this.core,this.logger),this.engine=new Xb(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Gg.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.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},$Z=zg,KZ=Wg;Ye.ENGINE_CONTEXT=N8,Ye.ENGINE_QUEUE_STATES=Fn,Ye.ENGINE_RPC_OPTS=uu,Ye.HISTORY_CONTEXT=VZ,Ye.HISTORY_EVENTS=qZ,Ye.HISTORY_STORAGE_VERSION=HZ,Ye.METHODS_TO_VERIFY=D8,Ye.PROPOSAL_CONTEXT=T8,Ye.PROPOSAL_EXPIRY=kZ,Ye.PROPOSAL_EXPIRY_MESSAGE=C8,Ye.REQUEST_CONTEXT=O8,Ye.SESSION_CONTEXT=x8,Ye.SESSION_EXPIRY=Wl,Ye.SESSION_REQUEST_EXPIRY_BOUNDARIES=Qg,Ye.SIGN_CLIENT_CONTEXT=nI,Ye.SIGN_CLIENT_DEFAULT=jg,Ye.SIGN_CLIENT_EVENTS=MZ,Ye.SIGN_CLIENT_PROTOCOL=tI,Ye.SIGN_CLIENT_STORAGE_OPTIONS=UZ,Ye.SIGN_CLIENT_STORAGE_PREFIX=$g,Ye.SIGN_CLIENT_VERSION=rI,Ye.SessionStore=$Z,Ye.SignClient=KZ,Ye.WALLETCONNECT_DEEPLINK_CHOICE=Jb,Ye.default=Wg});var Kg=v(os=>{"use strict";l();Object.defineProperty(os,"__esModule",{value:!0});os.OptionalOperation=os.Operation=void 0;var YZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(YZ=os.Operation||(os.Operation={}));var JZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(JZ=os.OptionalOperation||(os.OptionalOperation={}))});var iI=v(Un=>{"use strict";l();Object.defineProperty(Un,"__esModule",{value:!0});Un.WALLETCONNECT_SIGN_LOGIN_DELAY=Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Un.WALLETCONNECT_MULTIVERSX_METHODS=Un.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var R8=Kg();Un.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Un.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(R8.Operation);Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(R8.OptionalOperation);Un.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var aI=v(nn=>{"use strict";l();Object.defineProperty(nn,"__esModule",{value:!0});nn.WalletConnectV2ProviderErrorMessagesEnum=nn.ErrBadAddress=nn.ErrNotImplemented=nn.Err=void 0;var $l=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};nn.Err=$l;var sI=class extends $l{constructor(){super("Method not yet implemented")}};nn.ErrNotImplemented=sI;var oI=class extends $l{constructor(e,r){super(`Bad address: ${e}`,r)}};nn.ErrBadAddress=oI;var XZ;(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.unableToSign="WalletConnect could not sign the message",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",t.invalidGuardian="WalletConnect: Invalid Guardian"})(XZ=nn.WalletConnectV2ProviderErrorMessagesEnum||(nn.WalletConnectV2ProviderErrorMessagesEnum={}))});var cI=v(Yg=>{"use strict";l();Object.defineProperty(Yg,"__esModule",{value:!0});Yg.Logger=void 0;var uI=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Yg.Logger=uI});var B8=v(()=>{"use strict";l();global.Buffer||(global.Buffer=Vs().Buffer)});var F8=v(L8=>{"use strict";l();Object.defineProperty(L8,"__esModule",{value:!0})});var U8=v(M8=>{"use strict";l();Object.defineProperty(M8,"__esModule",{value:!0})});var q8=v(cu=>{"use strict";l();var ZZ=cu&&cu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cu,"__esModule",{value:!0});cu.RelayedTransactionV1Builder=void 0;var eee=ZZ(Yt()),lI=pt(),tee=Le(),ree=Yr(),nee=Yn(),fI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new tee.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new nee.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new ree.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new lI.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new lI.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new eee.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:h.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new lI.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?h.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?h.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};cu.RelayedTransactionV1Builder=fI});var V8=v(Jg=>{"use strict";l();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.Code=void 0;var iee=yE(),see=32,dI=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}computeHash(){let e=iee(see).update(this.valueOf()).digest();return h.Buffer.from(e)}};Jg.Code=dI});var k8=v(H8=>{"use strict";l();Object.defineProperty(H8,"__esModule",{value:!0})});var z8=v(fu=>{"use strict";l();Object.defineProperty(fu,"__esModule",{value:!0});fu.bech32m=fu.bech32=void 0;var Xg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",j8={};for(let t=0;t>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 G8(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=lu(e)^n>>5}e=lu(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=G8(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");c=lu(c)^g,f+=Xg.charAt(g)}for(let d=0;d<6;++d)c=lu(c);c^=e;for(let d=0;d<6;++d){let g=c>>(5-d)*5&31;f+=Xg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),c=o.toUpperCase();if(o!==u&&o!==c)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let m=G8(d);if(typeof m=="string")return m;let y=[];for(let A=0;A=g.length)&&y.push(R)}return m!==e?"Invalid checksum for "+o:{prefix:d,words:y}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:oee,fromWordsUnsafe:aee,fromWords:uee}}fu.bech32=Q8("bech32");fu.bech32m=Q8("bech32m")});var $8=v(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.TokenTransferProperties=jr.TransactionMetadataTransfer=jr.TransactionMetadata=jr.TransactionToDecode=jr.TransactionDecoder=void 0;var W8=z8(),pI=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new go;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Zg;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new go;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new go;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return h.Buffer.from(e).toString("base64")}base64Decode(e){return h.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new go;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=h.Buffer.from(e,"hex"),n=W8.bech32.toWords(r);return W8.bech32.encode("erd",n)}isAddressValid(e){return h.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return h.Buffer.from(e,"base64").toString("hex")}hexToString(e){return h.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};jr.TransactionDecoder=pI;var Zg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};jr.TransactionToDecode=Zg;var go=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};jr.TransactionMetadata=go;var gI=class{constructor(){this.value=BigInt(0)}};jr.TransactionMetadataTransfer=gI;var yI=class{};jr.TokenTransferProperties=yI});var mI=v(ey=>{"use strict";l();Object.defineProperty(ey,"__esModule",{value:!0});ey.ReturnCode=void 0;var ze=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};ey.ReturnCode=ze;ze.None=new ze("");ze.Ok=new ze("ok");ze.FunctionNotFound=new ze("function not found");ze.FunctionWrongSignature=new ze("wrong signature for function");ze.ContractNotFound=new ze("contract not found");ze.UserError=new ze("user error");ze.OutOfGas=new ze("out of gas");ze.AccountCollision=new ze("account collision");ze.OutOfFunds=new ze("out of funds");ze.CallStackOverFlow=new ze("call stack overflow");ze.ContractInvalid=new ze("contract invalid");ze.ExecutionFailed=new ze("execution failed");ze.Unknown=new ze("unknown")});var J8=v(ty=>{"use strict";l();Object.defineProperty(ty,"__esModule",{value:!0});ty.ResultsParser=void 0;var cee=$8(),K8=pt(),Y8=Le(),as=pa(),lee=na(),du=mI(),hu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(hu||(hu={}));var wI;(function(t){t.TooMuchGas="@too much gas provided for processing"})(wI||(wI={}));var fee={argsSerializer:new lee.ArgSerializer},EI=class{constructor(e){e=Object.assign(Object.assign({},fee),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new du.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new du.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return as.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return as.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return as.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return as.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return as.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return as.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return as.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return as.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new Y8.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new cee.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:du.ReturnCode.None,returnMessage:du.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:du.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(hu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(hu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(wI.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new K8.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(hu.OnWriteLog,u=>u.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new K8.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(hu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),c=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&c});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||h.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new Y8.ErrCannotParseContractResults("no return code");return{returnCode:du.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){var n,i;let s={},o=e.topics.map(m=>h.Buffer.from(m.valueOf())).slice(1),a=((n=e.dataPayload)===null||n===void 0?void 0:n.valueOf())||h.Buffer.from([]),u=((i=e.additionalData)===null||i===void 0?void 0:i.map(m=>h.Buffer.from(m.valueOf())))||[];u.length==0&&a.length>0&&u.push(h.Buffer.from(a));let c=r.inputs.filter(m=>m.indexed),f=this.argsSerializer.buffersToValues(o,c);for(let m=0;m!m.indexed),g=this.argsSerializer.buffersToValues(u,d);for(let m=0;m{"use strict";l();var dee=_t&&_t.__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]}),ur=_t&&_t.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dee(e,t,r)};Object.defineProperty(_t,"__esModule",{value:!0});ur(na(),_t);ur(V8(),_t);ur(Lw(),_t);ur(OE(),_t);ur(qc(),_t);ur(qE(),_t);ur(BE(),_t);ur(k8(),_t);ur(kE(),_t);ur(Vc(),_t);ur(J8(),_t);ur(mI(),_t);ur(Pv(),_t);ur(KE(),_t);ur(xt(),_t)});var Z8=v(ry=>{"use strict";l();Object.defineProperty(ry,"__esModule",{value:!0});ry.RelayedTransactionV2Builder=void 0;var X8=Le(),Kl=vI(),hee=Yr(),pee=Yn(),AI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new X8.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new X8.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Kl.ArgSerializer().valuesToString([new Kl.AddressValue(this.innerTransaction.getReceiver()),new Kl.U64Value(this.innerTransaction.getNonce().valueOf()),new Kl.BytesValue(this.innerTransaction.getData().valueOf()),new Kl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new pee.TransactionPayload(r),i=new hee.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};ry.RelayedTransactionV2Builder=AI});var II=v(lt=>{"use strict";l();var gee=lt&<.__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]}),yee=lt&<.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eL=lt&<.__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)&&gee(e,t,r);return yee(e,t),e},mee=lt&<.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lt,"__esModule",{value:!0});lt.addressToHex=lt.bufferToHex=lt.utf8ToHex=lt.bigIntToHex=lt.bigIntToBuffer=lt.bufferToBigInt=lt.stringToBuffer=void 0;var wee=mee(Yt()),Eee=pt(),bI=eL(Tc()),tL=eL(Md());function vee(t){return h.Buffer.from(t)}lt.stringToBuffer=vee;function Aee(t){return t.length==0?new wee.default(0):bI.bufferToBigInt(t)}lt.bufferToBigInt=Aee;function bee(t){return t==0?h.Buffer.from([]):bI.bigIntToBuffer(t)}lt.bigIntToBuffer=bee;function Iee(t){return t==0?"":bI.getHexMagnitudeOfBigInt(t)}lt.bigIntToHex=Iee;function _ee(t){let e=h.Buffer.from(t).toString("hex");return tL.zeroPadStringIfOddLength(e)}lt.utf8ToHex=_ee;function See(t){let e=t.toString("hex");return tL.zeroPadStringIfOddLength(e)}lt.bufferToHex=See;function Tee(t){return Eee.Address.fromBech32(t.toString()).pubkey().toString("hex")}lt.addressToHex=Tee});var nL=v(ny=>{"use strict";l();Object.defineProperty(ny,"__esModule",{value:!0});ny.TokenOperationsFactory=void 0;var _I=Os(),Cee=pa(),rL=xc(),xee=Yr(),Nee=Yn(),ne=II(),SI=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true"),this.falseAsHex=ne.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){Cee.Logger.info(` + Approved: ${g.toString()}`))}),o.forEach(d=>{n||(Zi(i[d].methods,s[d].methods)?Zi(i[d].events,s[d].events)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function JK(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 s3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function XK(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:uo(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 ZK(t,e){return tg(t,!1)&&t<=e.max&&t>=e.min}function eY(){let t=ao();return new Promise(e=>{switch(t){case sr.browser:e(Y3());break;case sr.reactNative:e(J3());break;case sr.node:e(X3());break;default:e(!0)}})}function Y3(){return Nl()&&navigator?.onLine}async function J3(){return nu()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function X3(){return!0}function tY(t){switch(ao()){case sr.browser:Z3(t);break;case sr.reactNative:eB(t);break;case sr.node:break}}function Z3(t){!nu()&&Nl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function eB(t){nu()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var $A={},XA=class{static get(e){return $A[e]}static set(e,r){$A[e]=r}static delete(e){delete $A[e]}};V.BASE10=rb,V.BASE16=or,V.BASE64=$p,V.COLON=$$,V.DEFAULT_DEPTH=ob,V.EMPTY_SPACE=Kp,V.ENV_MAP=sr,V.INTERNAL_ERRORS=V3,V.MemoryStore=XA,V.ONE_THOUSAND=K$,V.REACT_NATIVE_PRODUCT=A3,V.RELAYER_DEFAULT_PROTOCOL=D3,V.SDK_ERRORS=q3,V.SDK_TYPE=I3,V.SLASH=b3,V.TYPE_0=nb,V.TYPE_1=ru,V.UTF8=Zp,V.appendToQueryString=_3,V.assertType=tK,V.buildApprovedNamespaces=BK,V.calcExpiry=hK,V.capitalize=aK,V.capitalizeWord=O3,V.createDelayedPromise=uK,V.createExpiringPromise=cK,V.decodeTypeByte=xl,V.decrypt=k$,V.deriveSymKey=U$,V.deserialize=sb,V.encodeTypeByte=w3,V.encrypt=H$,V.engineEvent=gK,V.enumify=oK,V.formatAccountId=d3,V.formatAccountWithChain=x$,V.formatChainId=f3,V.formatExpirerTarget=ub,V.formatIdTarget=fK,V.formatMessage=B$,V.formatMessageContext=rK,V.formatRelayParams=B3,V.formatRelayRpcUrl=Z$,V.formatTopicTarget=lK,V.formatUA=C3,V.formatUri=SK,V.generateKeyPair=F$,V.generateRandomBytes32=M$,V.getAccountsChains=uo,V.getAccountsFromNamespaces=O$,V.getAddressFromAccount=h3,V.getAddressesFromAccounts=N$,V.getAppMetadata=J$,V.getBrowserOnlineStatus=Y3,V.getBundleId=Y$,V.getChainFromAccount=p3,V.getChainsFromAccounts=g3,V.getChainsFromNamespace=Jp,V.getChainsFromNamespaces=D$,V.getChainsFromRequiredNamespaces=P$,V.getDeepLink=mK,V.getDidAddress=m3,V.getDidAddressSegments=Xp,V.getDidChainId=y3,V.getEnvironment=ao,V.getHttpUrl=eK,V.getInternalError=li,V.getJavascriptID=T3,V.getJavascriptOS=S3,V.getLastItems=N3,V.getNamespacedDidChainId=R$,V.getNamespacesChains=L3,V.getNamespacesEventsForChainId=M3,V.getNamespacesMethodsForChainId=F3,V.getNodeOnlineStatus=X3,V.getReactNativeOnlineStatus=J3,V.getRelayClientMetadata=X$,V.getRelayProtocolApi=EK,V.getRelayProtocolName=wK,V.getRequiredNamespacesFromNamespaces=RK,V.getSdkError=oo,V.getUniqueValues=tb,V.handleDeeplinkRedirect=yK,V.hasOverlap=Zi,V.hashKey=q$,V.hashMessage=V$,V.isBrowser=Nl,V.isCaipNamespace=cb,V.isConformingNamespaces=K3,V.isExpired=pK,V.isNode=ab,V.isOnline=eY,V.isProposalStruct=MK,V.isReactNative=nu,V.isSessionCompatible=LK,V.isSessionStruct=UK,V.isTypeOneEnvelope=j$,V.isUndefined=ts,V.isValidAccountId=H3,V.isValidAccounts=j3,V.isValidActions=z3,V.isValidArray=Ol,V.isValidChainId=Cl,V.isValidChains=k3,V.isValidController=qK,V.isValidErrorReason=jK,V.isValidEvent=WK,V.isValidId=kK,V.isValidNamespaceAccounts=Q3,V.isValidNamespaceActions=lb,V.isValidNamespaceChains=G3,V.isValidNamespaceMethodsOrEvents=JA,V.isValidNamespaces=W3,V.isValidNamespacesChainId=$K,V.isValidNamespacesEvent=YK,V.isValidNamespacesRequest=KK,V.isValidNumber=tg,V.isValidObject=eg,V.isValidParams=GK,V.isValidRelay=$3,V.isValidRelays=HK,V.isValidRequest=QK,V.isValidRequestExpiry=ZK,V.isValidRequiredNamespaces=VK,V.isValidResponse=zK,V.isValidString=_r,V.isValidUrl=FK,V.mapEntries=sK,V.mapToObj=nK,V.mergeArrays=es,V.normalizeNamespaces=YA,V.objToMap=iK,V.parseAccountId=eb,V.parseChainId=l3,V.parseContextNames=x3,V.parseExpirerTarget=dK,V.parseNamespaceKey=U3,V.parseRelayParams=P3,V.parseTopic=R3,V.parseUri=_K,V.serialize=E3,V.subscribeToBrowserNetworkChange=Z3,V.subscribeToNetworkChange=tY,V.subscribeToReactNativeNetworkChange=eB,V.validateDecoding=G$,V.validateEncoding=v3});var tB,rB,nB,iB,rg,Pl,fb,ng,rs,Rl,ig=he(()=>{l();tB="PARSE_ERROR",rB="INVALID_REQUEST",nB="METHOD_NOT_FOUND",iB="INVALID_PARAMS",rg="INTERNAL_ERROR",Pl="SERVER_ERROR",fb=[-32700,-32600,-32601,-32602,-32603],ng=[-32e3,-32099],rs={[tB]:{code:-32700,message:"Parse error"},[rB]:{code:-32600,message:"Invalid Request"},[nB]:{code:-32601,message:"Method not found"},[iB]:{code:-32602,message:"Invalid params"},[rg]:{code:-32603,message:"Internal error"},[Pl]:{code:-32e3,message:"Server error"}},Rl=Pl});function rY(t){return t<=ng[0]&&t>=ng[1]}function sg(t){return fb.includes(t)}function sB(t){return typeof t=="number"}function og(t){return Object.keys(rs).includes(t)?rs[t]:rs[Rl]}function ag(t){let e=Object.values(rs).find(r=>r.code===t);return e||rs[Rl]}function nY(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(!sB(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(sg(t.error.code)){let e=ag(t.error.code);if(e.message!==rs[Rl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function db(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var hb=he(()=>{l();ig()});var aB=A(ns=>{"use strict";l();Object.defineProperty(ns,"__esModule",{value:!0});ns.isBrowserCryptoAvailable=ns.getSubtleCrypto=ns.getBrowerCrypto=void 0;function pb(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}ns.getBrowerCrypto=pb;function oB(){let t=pb();return t.subtle||t.webkitSubtle}ns.getSubtleCrypto=oB;function iY(){return!!pb()&&!!oB()}ns.isBrowserCryptoAvailable=iY});var lB=A(is=>{"use strict";l();Object.defineProperty(is,"__esModule",{value:!0});is.isBrowser=is.isNode=is.isReactNative=void 0;function uB(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}is.isReactNative=uB;function cB(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}is.isNode=cB;function sY(){return!uB()&&!cB()}is.isBrowser=sY});var gb=A(ug=>{"use strict";l();Object.defineProperty(ug,"__esModule",{value:!0});var fB=(en(),ht(Zr));fB.__exportStar(aB(),ug);fB.__exportStar(lB(),ug)});var kt={};ft(kt,{isNodeJs:()=>hB});var dB,hB,pB=he(()=>{l();dB=be(gb());Qt(kt,be(gb()));hB=dB.isNode});function yb(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function mb(t=6){return BigInt(yb(t))}function wb(t,e,r){return{id:r||yb(),jsonrpc:"2.0",method:t,params:e}}function oY(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Eb(t,e,r){return{id:t,jsonrpc:"2.0",error:gB(e,r)}}function gB(t,e){return typeof t>"u"?og(rg):(typeof t=="string"&&(t=Object.assign(Object.assign({},og(Pl)),{message:t})),typeof e<"u"&&(t.data=e),sg(t.code)&&(t=ag(t.code)),t)}var yB=he(()=>{l();hb();ig()});function aY(t){return t.includes("*")?lg(t):!/\W/g.test(t)}function cg(t){return t==="*"}function lg(t){return cg(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function uY(t){return!cg(t)&&lg(t)&&!t.split("*")[0].trim()}function cY(t){return!cg(t)&&lg(t)&&!t.split("*")[1].trim()}var mB=he(()=>{l()});var wB=he(()=>{l()});var iu,vb=he(()=>{l();iu=class{}});var Ab,fg,Bl,EB=he(()=>{l();vb();Ab=class extends iu{constructor(e){super()}},fg=class extends iu{constructor(){super()}},Bl=class extends fg{constructor(e){super()}}});var vB=he(()=>{l()});var AB=he(()=>{l();wB();vb();EB();vB()});var bB=he(()=>{l();AB()});function dY(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function IB(t,e){let r=dY(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function hY(t){return IB(t,lY)}function dg(t){return IB(t,fY)}function bb(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var lY,fY,_B=he(()=>{l();lY="^https?:",fY="^wss?:"});function Ib(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function pY(t){return Ib(t)&&"method"in t}function _b(t){return Ib(t)&&(SB(t)||hg(t))}function SB(t){return"result"in t}function hg(t){return"error"in t}function gY(t){return"error"in t&&t.valid===!1}var TB=he(()=>{l()});var rr={};ft(rr,{DEFAULT_ERROR:()=>Rl,IBaseJsonRpcProvider:()=>fg,IEvents:()=>iu,IJsonRpcConnection:()=>Ab,IJsonRpcProvider:()=>Bl,INTERNAL_ERROR:()=>rg,INVALID_PARAMS:()=>iB,INVALID_REQUEST:()=>rB,METHOD_NOT_FOUND:()=>nB,PARSE_ERROR:()=>tB,RESERVED_ERROR_CODES:()=>fb,SERVER_ERROR:()=>Pl,SERVER_ERROR_CODE_RANGE:()=>ng,STANDARD_ERROR_MAP:()=>rs,formatErrorMessage:()=>gB,formatJsonRpcError:()=>Eb,formatJsonRpcRequest:()=>wb,formatJsonRpcResult:()=>oY,getBigIntRpcId:()=>mb,getError:()=>og,getErrorByCode:()=>ag,isHttpUrl:()=>hY,isJsonRpcError:()=>hg,isJsonRpcPayload:()=>Ib,isJsonRpcRequest:()=>pY,isJsonRpcResponse:()=>_b,isJsonRpcResult:()=>SB,isJsonRpcValidationInvalid:()=>gY,isLocalhostUrl:()=>bb,isNodeJs:()=>hB,isReservedErrorCode:()=>sg,isServerErrorCode:()=>rY,isValidDefaultRoute:()=>cg,isValidErrorCode:()=>sB,isValidLeadingWildcardRoute:()=>uY,isValidRoute:()=>aY,isValidTrailingWildcardRoute:()=>cY,isValidWildcardRoute:()=>lg,isWsUrl:()=>dg,parseConnectionError:()=>db,payloadId:()=>yb,validateJsonRpcError:()=>nY});var Ll=he(()=>{l();ig();hb();pB();Qt(rr,kt);yB();mB();bB();_B();TB()});var CB,pg,xB,Sb=he(()=>{l();CB=be(ti());Ll();pg=class extends Bl{constructor(e){super(e),this.events=new CB.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(wb(e.method,e.params||[],e.id||mb().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=>{hg(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),_b(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)}},xB=pg});var NB={};ft(NB,{JsonRpcProvider:()=>pg,default:()=>yY});var yY,OB=he(()=>{l();Sb();Sb();yY=xB});var PB=A((s0e,DB)=>{"use strict";l();DB.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var FB={};ft(FB,{WsConnection:()=>Tb,default:()=>Tb});var LB,mY,wY,RB,BB,EY,Tb,MB=he(()=>{l();LB=be(ti());nl();Ll();mY=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:PB(),wY=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",RB=t=>t.split("?")[0],BB=10,EY=mY(),Tb=class{constructor(e){if(this.url=e,this.events=new LB.EventEmitter,this.registering=!1,!dg(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){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(zi(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!dg(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=new URLSearchParams(e).get("origin"),s=(0,rr.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!bb(e)},o=new EY(e,[],s);wY()?o.onerror=a=>{let u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}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"?Qi(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=Eb(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return db(e,RB(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>BB&&this.events.setMaxListeners(BB)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${RB(this.url)}`));return this.events.emit("register_error",r),r}}});var w6=A((Fl,ou)=>{l();var vY=200,Mb="__lodash_hash_undefined__",bg=1,KB=2,YB=9007199254740991,gg="[object Arguments]",Ob="[object Array]",AY="[object AsyncFunction]",JB="[object Boolean]",XB="[object Date]",ZB="[object Error]",e6="[object Function]",bY="[object GeneratorFunction]",yg="[object Map]",t6="[object Number]",IY="[object Null]",su="[object Object]",UB="[object Promise]",_Y="[object Proxy]",r6="[object RegExp]",mg="[object Set]",n6="[object String]",SY="[object Symbol]",TY="[object Undefined]",Db="[object WeakMap]",i6="[object ArrayBuffer]",wg="[object DataView]",CY="[object Float32Array]",xY="[object Float64Array]",NY="[object Int8Array]",OY="[object Int16Array]",DY="[object Int32Array]",PY="[object Uint8Array]",RY="[object Uint8ClampedArray]",BY="[object Uint16Array]",LY="[object Uint32Array]",FY=/[\\^$.*+?()[\]{}|]/g,MY=/^\[object .+?Constructor\]$/,UY=/^(?:0|[1-9]\d*)$/,st={};st[CY]=st[xY]=st[NY]=st[OY]=st[DY]=st[PY]=st[RY]=st[BY]=st[LY]=!0;st[gg]=st[Ob]=st[i6]=st[JB]=st[wg]=st[XB]=st[ZB]=st[e6]=st[yg]=st[t6]=st[su]=st[r6]=st[mg]=st[n6]=st[Db]=!1;var s6=typeof global=="object"&&global&&global.Object===Object&&global,qY=typeof self=="object"&&self&&self.Object===Object&&self,fi=s6||qY||Function("return this")(),o6=typeof Fl=="object"&&Fl&&!Fl.nodeType&&Fl,qB=o6&&typeof ou=="object"&&ou&&!ou.nodeType&&ou,a6=qB&&qB.exports===o6,Cb=a6&&s6.process,VB=function(){try{return Cb&&Cb.binding&&Cb.binding("util")}catch{}}(),HB=VB&&VB.isTypedArray;function VY(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function yJ(t,e){var r=this.__data__,n=_g(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}di.prototype.clear=dJ;di.prototype.delete=hJ;di.prototype.get=pJ;di.prototype.has=gJ;di.prototype.set=yJ;function fo(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,d=!0,g=r&KB?new vg:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=YB}function y6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ql(t){return t!=null&&typeof t=="object"}var m6=HB?jY(HB):RJ;function WJ(t){return QJ(t)?NJ(t):BJ(t)}function $J(){return[]}function KJ(){return!1}ou.exports=zJ});var Ub=A((f0e,E6)=>{l();E6.exports=function(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],o=[],a={},u=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return s},entries:function(){return o},get:function(f){return a[f.toLowerCase()]},has:function(f){return f.toLowerCase()in a}}}};for(var c in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(f,d,g){s.push(d=d.toLowerCase()),o.push([d,g]),a[d]=a[d]?a[d]+","+g:g}),r(u())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(c,e.headers[c]);i.send(e.body||null)})}});var A6=A((h0e,v6)=>{l();v6.exports=self.fetch||(self.fetch=Ub().default||Ub())});var x8=A(Ee=>{"use strict";l();Object.defineProperty(Ee,"__esModule",{value:!0});var po=ti(),YJ=(V2(),ht(q2)),Gl=nD(),Qe=m1(),Ln=F1(),b6=(nl(),ht(M2)),JJ=(VP(),ht(qP)),te=Dl(),XJ=(HA(),ht(VA)),Ke=Zs(),ZJ=(OB(),ht(NB)),Sr=(Ll(),ht(rr)),eX=(MB(),ht(FB)),tX=w6(),rX=A6();function jl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function nX(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 iX=jl(po),sX=jl(YJ),Tg=nX(JJ),oX=jl(eX),aX=jl(tX),uX=jl(rX);function cX(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,E=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,E[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&E[T]===0;)T++;for(var B=u.repeat(b);T>>0,M=new Uint8Array(z);y[b];){var E=r[y.charCodeAt(b)];if(E===255)return;for(var S=0,N=z-1;(E!==0||S>>0,M[N]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");R=S,b++}if(y[b]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var b=g(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var lX=cX,fX=lX,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")},dX=t=>new TextEncoder().encode(t),hX=t=>new TextDecoder().decode(t),Hb=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")}},kb=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)}},Gb=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 Gb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),jb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Hb(e,r,n),this.decoder=new kb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Hg=({name:t,prefix:e,encode:r,decode:n})=>new jb(t,e,r,n),Ql=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=fX(r,e);return Hg({prefix:t,name:e,encode:n,decode:s=>q6(i(s))})},pX=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},gX=(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<Hg({prefix:e,name:t,encode(i){return gX(i,n,r)},decode(i){return pX(i,n,r,t)}}),yX=Hg({prefix:"\0",name:"identity",encode:t=>hX(t),decode:t=>dX(t)}),mX=Object.freeze({__proto__:null,identity:yX}),wX=zt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),EX=Object.freeze({__proto__:null,base2:wX}),vX=zt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),AX=Object.freeze({__proto__:null,base8:vX}),bX=Ql({prefix:"9",name:"base10",alphabet:"0123456789"}),IX=Object.freeze({__proto__:null,base10:bX}),_X=zt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),SX=zt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),TX=Object.freeze({__proto__:null,base16:_X,base16upper:SX}),CX=zt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xX=zt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),NX=zt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),OX=zt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),DX=zt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),PX=zt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),RX=zt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),BX=zt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),LX=zt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),FX=Object.freeze({__proto__:null,base32:CX,base32upper:xX,base32pad:NX,base32padupper:OX,base32hex:DX,base32hexupper:PX,base32hexpad:RX,base32hexpadupper:BX,base32z:LX}),MX=Ql({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),UX=Ql({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),qX=Object.freeze({__proto__:null,base36:MX,base36upper:UX}),VX=Ql({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),HX=Ql({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),kX=Object.freeze({__proto__:null,base58btc:VX,base58flickr:HX}),GX=zt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),jX=zt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),QX=zt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),zX=zt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),WX=Object.freeze({__proto__:null,base64:GX,base64pad:jX,base64url:QX,base64urlpad:zX}),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}"),$X=H6.reduce((t,e,r)=>(t[r]=e,t),[]),KX=H6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function YX(t){return t.reduce((e,r)=>(e+=$X[r],e),"")}function JX(t){let e=[];for(let r of t){let n=KX[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var XX=Hg({prefix:"\u{1F680}",name:"base256emoji",encode:YX,decode:JX}),ZX=Object.freeze({__proto__:null,base256emoji:XX}),eZ=k6,I6=128,tZ=127,rZ=~tZ,nZ=Math.pow(2,31);function k6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=nZ;)e[r++]=t&255|I6,t/=128;for(;t&rZ;)e[r++]=t&255|I6,t>>>=7;return e[r]=t|0,k6.bytes=r-n+1,e}var iZ=Qb,sZ=128,_6=127;function Qb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Qb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&_6)<=sZ);return Qb.bytes=s-n,r}var oZ=Math.pow(2,7),aZ=Math.pow(2,14),uZ=Math.pow(2,21),cZ=Math.pow(2,28),lZ=Math.pow(2,35),fZ=Math.pow(2,42),dZ=Math.pow(2,49),hZ=Math.pow(2,56),pZ=Math.pow(2,63),gZ=function(t){return t(G6.encode(t,e,r),e),T6=t=>G6.encodingLength(t),zb=(t,e)=>{let r=e.byteLength,n=T6(t),i=n+T6(r),s=new Uint8Array(i+r);return S6(t,s,0),S6(r,s,n),s.set(e,i),new Wb(t,r,e,s)},Wb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},j6=({name:t,code:e,encode:r})=>new $b(t,e,r),$b=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?zb(this.code,r):r.then(n=>zb(this.code,n))}else throw Error("Unknown type, must be binary type")}},Q6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),mZ=j6({name:"sha2-256",code:18,encode:Q6("SHA-256")}),wZ=j6({name:"sha2-512",code:19,encode:Q6("SHA-512")}),EZ=Object.freeze({__proto__:null,sha256:mZ,sha512:wZ}),z6=0,vZ="identity",W6=q6,AZ=t=>zb(z6,W6(t)),bZ={code:z6,name:vZ,encode:W6,digest:AZ},IZ=Object.freeze({__proto__:null,identity:bZ});new TextEncoder,new TextDecoder;var C6={...mX,...EX,...AX,...IX,...TX,...FX,...qX,...kX,...WX,...ZX};({...EZ,...IZ});function $6(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function _Z(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?$6(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function K6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var x6=K6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),qb=K6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=_Z(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}=te.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Og=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=Z6,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=Tg.generateKeyPair(i);return Tg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=te.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Tg.generateKeyPair(s),a=te.generateRandomBytes32(),u=e8;return await Tg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=te.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||te.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=te.validateEncoding(o),u=b6.safeJsonStringify(s);if(te.isTypeOneEnvelope(a)){let g=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(g,m)}let c=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return te.encrypt({type:f,symKey:c,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=te.validateDecoding(s,o);if(te.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,c=a.senderPublicKey;i=await this.generateSharedKey(u,c)}try{let u=this.getSymKey(i),c=te.decrypt({symKey:u,encoded:s});return b6.safeJsonParse(c)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=te.deserialize(i);return te.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=te.deserialize(i);return s.senderPublicKey?XJ.toString(s.senderPublicKey,te.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new Ng(this.core,this.logger)}get context(){return Qe.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(Kb)}catch{e=te.generateRandomBytes32(),await this.keychain.set(Kb,e)}return TZ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Dg=class extends Ln.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=n8,this.version=i8,this.initialized=!1,this.storagePrefix=hi,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=te.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=te.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Jb=class extends Ln.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new po.EventEmitter,this.name=o8,this.queue=new Map,this.publishTimeout=Ke.toMiliseconds(Ke.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||s8,u=te.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,d=s?.id||Sr.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:c,tag:f,id:d}},m=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await te.createExpiringPromise(this.rpcPublish(n,i,a,u,c,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(ar.publish,g)}catch(y){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),y;return}finally{clearTimeout(m)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},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=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,c,f,d;let g={method:te.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return te.isUndefined((u=g.params)==null?void 0:u.prompt)&&((c=g.params)==null||delete c.prompt),te.isUndefined((f=g.params)==null?void 0:f.tag)&&((d=g.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){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(Gl.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ar.connection_stalled);return}this.checkQueue()}),this.relayer.on(ar.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},Xb=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())}},DZ=Object.defineProperty,PZ=Object.defineProperties,RZ=Object.getOwnPropertyDescriptors,N6=Object.getOwnPropertySymbols,BZ=Object.prototype.hasOwnProperty,LZ=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?DZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hl=(t,e)=>{for(var r in e||(e={}))BZ.call(e,r)&&O6(t,r,e[r]);if(N6)for(var r of N6(e))LZ.call(e,r)&&O6(t,r,e[r]);return t},Vb=(t,e)=>PZ(t,RZ(e)),Pg=class extends Ln.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new Xb,this.events=new po.EventEmitter,this.name=y8,this.version=m8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),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=te.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 Ke.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)>=w8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!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.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+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=te.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=te.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:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}return te.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:te.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,Vb(Hl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Hl({},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,Hl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Gr.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}=te.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(Gr.deleted,Vb(Hl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Gr.sync)}async reset(){if(this.cached.length){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}=te.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);te.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>Vb(Hl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(ar.connect,async()=>{await this.onConnect()}),this.relayer.on(ar.disconnect,()=>{this.onDisconnect()}),this.events.on(Gr.created,async e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Gr.deleted,async e=>{let r=Gr.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}=te.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)})}},FZ=Object.defineProperty,D6=Object.getOwnPropertySymbols,MZ=Object.prototype.hasOwnProperty,UZ=Object.prototype.propertyIsEnumerable,P6=(t,e,r)=>e in t?FZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qZ=(t,e)=>{for(var r in e||(e={}))MZ.call(e,r)&&P6(t,r,e[r]);if(D6)for(var r of D6(e))UZ.call(e,r)&&P6(t,r,e[r]);return t},Rg=class extends Ln.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new po.EventEmitter,this.name=c8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,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.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(ar.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ar.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Bn.payload,this.onPayloadHandler),this.provider.on(Bn.connect,this.onConnectHandler),this.provider.on(Bn.disconnect,this.onDisconnectHandler),this.provider.on(Bn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||u8})),this.messages=new Dg(this.logger,e.core),this.subscriber=new Pg(this,this.logger),this.publisher=new Jb(this,this.logger),this.relayUrl=e?.relayUrl||eI,this.projectId=e.projectId,this.bundleId=te.getBundleId(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Yb}...`),await this.restartTransport(Yb)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},h8)}get context(){return Qe.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){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Gr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Gr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}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.hasExperiencedNetworkDisruption&&this.connected?await te.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Gr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await te.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Bn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await te.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ZJ.JsonRpcProvider(new oX.default(te.formatRelayRpcUrl({sdkVersion:d8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Sr.isJsonRpcRequest(e)){if(!e.method.endsWith(l8))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(qZ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else Sr.isJsonRpcResponse(e)&&this.events.emit(ar.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ar.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Sr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Bn.payload,this.onPayloadHandler),this.provider.off(Bn.connect,this.onConnectHandler),this.provider.off(Bn.disconnect,this.onDisconnectHandler),this.provider.off(Bn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(ar.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await te.isOnline();te.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(ar.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},Ke.toMiliseconds(f8)))}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},VZ=Object.defineProperty,R6=Object.getOwnPropertySymbols,HZ=Object.prototype.hasOwnProperty,kZ=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?VZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L6=(t,e)=>{for(var r in e||(e={}))HZ.call(e,r)&&B6(t,r,e[r]);if(R6)for(var r of R6(e))kZ.call(e,r)&&B6(t,r,e[r]);return t},Bg=class extends Ln.IStore{constructor(e,r,n,i=hi,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=p8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!te.isUndefined(o)?this.map.set(this.getKey(o),o):te.isProposalStruct(o)?this.map.set(o.id,o):te.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=>aX.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=L6(L6({},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=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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}=te.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}=te.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}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Lg=class{constructor(e,r){this.core=e,this.logger=r,this.name=E8,this.version=v8,this.events=new iX.default,this.initialized=!1,this.storagePrefix=hi,this.ignoredPayloadTypes=[te.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=te.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=te.calcExpiry(Ke.FIVE_MINUTES),o={protocol:a8},a={topic:i,expiry:s,relay:o,active:!1},u=te.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}=te.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);let u=te.calcExpiry(Ke.FIVE_MINUTES),c={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,c),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(kl.create,c),this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o})),c},this.activate=async({topic:n})=>{this.isInitialized();let i=te.calcExpiry(Ke.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}=te.createDelayedPromise();this.events.once(te.engineEvent("pairing_ping",s),({error:c})=>{c?u(c):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",te.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Sr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=uu[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Sr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=uu[u.request.method].res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Sr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=uu[u.request.method]?uu[u.request.method].res:uu.unregistered_method.res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,te.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=>te.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){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;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(kl.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(()=>{Sr.isJsonRpcResult(i)?this.events.emit(te.engineEvent("pairing_ping",s),{}):Sr.isJsonRpcError(i)&&this.events.emit(te.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(kl.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=te.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(te.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!te.isValidParams(n)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!te.isValidUrl(n.uri)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}let s=te.parseUri(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(o)}if(!(s!=null&&s.symKey)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(o)}},this.isValidPing=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!te.isValidString(n,!1)){let{message:i}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(te.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=te.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new Bg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ar.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{Sr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Sr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(kr.expired,async e=>{let{topic:r}=te.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(kl.expire,{topic:r}))})}},Fg=class extends Ln.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new po.EventEmitter,this.name=A8,this.version=b8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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,expiry:te.calcExpiry(Ke.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(rn.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=Sr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(rn.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(rn.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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:Sr.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(rn.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=te.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(rn.created,e=>{let r=rn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.updated,e=>{let r=rn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.deleted,e=>{let r=rn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{Ke.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Mg=class extends Ln.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new po.EventEmitter,this.name=I8,this.version=_8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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(kr.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(kr.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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 te.formatTopicTarget(e);if(typeof e=="number")return te.formatIdTarget(e);let{message:r}=te.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(kr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=te.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Ke.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(kr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(kr.created,e=>{let r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.expired,e=>{let r=kr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.deleted,e=>{let r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ug=class extends Ln.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=Cg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||te.isReactNative()||!te.isBrowser())return;let i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=xg;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=this.getVerifyUrl(n?.verifyUrl),s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,xg)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(Ke.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(Cg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=Cg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},Ke.toMiliseconds(Ke.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||cu;return S8.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${cu}`),i=cu),i},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=cu,this.abortController=new AbortController,this.isDevEnv=te.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Ke.toMiliseconds(e))}},qg=class extends Ln.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=T8,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${C8}/${this.projectId}/clients`;await uX.default(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=Qe.generateChildLogger(r,this.context)}},GZ=Object.defineProperty,F6=Object.getOwnPropertySymbols,jZ=Object.prototype.hasOwnProperty,QZ=Object.prototype.propertyIsEnumerable,M6=(t,e,r)=>e in t?GZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U6=(t,e)=>{for(var r in e||(e={}))jZ.call(e,r)&&M6(t,r,e[r]);if(F6)for(var r of F6(e))QZ.call(e,r)&&M6(t,r,e[r]);return t},Vg=class t extends Ln.ICore{constructor(e){super(e),this.protocol=Zb,this.version=Y6,this.name=kg,this.events=new po.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||eI,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||J6.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Gl.HeartBeat,this.crypto=new Og(this,this.logger,e?.keychain),this.history=new Fg(this,this.logger),this.expirer=new Mg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new sX.default(U6(U6({},X6),e?.storageOptions)),this.relayer=new Rg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Lg(this,this.logger),this.verify=new Ug(this.projectId||"",this.logger),this.echoClient=new qg(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(g8,n),r}get context(){return Qe.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}}},zZ=Vg;Ee.CORE_CONTEXT=kg,Ee.CORE_DEFAULT=J6,Ee.CORE_PROTOCOL=Zb,Ee.CORE_STORAGE_OPTIONS=X6,Ee.CORE_STORAGE_PREFIX=hi,Ee.CORE_VERSION=Y6,Ee.CRYPTO_CLIENT_SEED=Kb,Ee.CRYPTO_CONTEXT=Z6,Ee.CRYPTO_JWT_TTL=e8,Ee.Core=zZ,Ee.Crypto=Og,Ee.ECHO_CONTEXT=T8,Ee.ECHO_URL=C8,Ee.EXPIRER_CONTEXT=I8,Ee.EXPIRER_DEFAULT_TTL=OZ,Ee.EXPIRER_EVENTS=kr,Ee.EXPIRER_STORAGE_VERSION=_8,Ee.EchoClient=qg,Ee.Expirer=Mg,Ee.HISTORY_CONTEXT=A8,Ee.HISTORY_EVENTS=rn,Ee.HISTORY_STORAGE_VERSION=b8,Ee.JsonRpcHistory=Fg,Ee.KEYCHAIN_CONTEXT=t8,Ee.KEYCHAIN_STORAGE_VERSION=r8,Ee.KeyChain=Ng,Ee.MESSAGES_CONTEXT=n8,Ee.MESSAGES_STORAGE_VERSION=i8,Ee.MessageTracker=Dg,Ee.PAIRING_CONTEXT=E8,Ee.PAIRING_DEFAULT_TTL=NZ,Ee.PAIRING_EVENTS=kl,Ee.PAIRING_RPC_OPTS=uu,Ee.PAIRING_STORAGE_VERSION=v8,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=w8,Ee.PUBLISHER_CONTEXT=o8,Ee.PUBLISHER_DEFAULT_TTL=s8,Ee.Pairing=Lg,Ee.RELAYER_CONTEXT=c8,Ee.RELAYER_DEFAULT_LOGGER=u8,Ee.RELAYER_DEFAULT_PROTOCOL=a8,Ee.RELAYER_DEFAULT_RELAY_URL=eI,Ee.RELAYER_EVENTS=ar,Ee.RELAYER_FAILOVER_RELAY_URL=Yb,Ee.RELAYER_PROVIDER_EVENTS=Bn,Ee.RELAYER_RECONNECT_TIMEOUT=f8,Ee.RELAYER_SDK_VERSION=d8,Ee.RELAYER_STORAGE_OPTIONS=CZ,Ee.RELAYER_SUBSCRIBER_SUFFIX=l8,Ee.RELAYER_TRANSPORT_CUTOFF=h8,Ee.Relayer=Rg,Ee.STORE_STORAGE_VERSION=p8,Ee.SUBSCRIBER_CONTEXT=y8,Ee.SUBSCRIBER_DEFAULT_TTL=xZ,Ee.SUBSCRIBER_EVENTS=Gr,Ee.SUBSCRIBER_STORAGE_VERSION=m8,Ee.Store=Bg,Ee.Subscriber=Pg,Ee.TRUSTED_VERIFY_URLS=S8,Ee.VERIFY_CONTEXT=Cg,Ee.VERIFY_FALLBACK_SERVER=xg,Ee.VERIFY_SERVER=cu,Ee.Verify=Ug,Ee.WALLETCONNECT_CLIENT_ID=g8,Ee.default=Vg});var q8=A(Ye=>{"use strict";l();Object.defineProperty(Ye,"__esModule",{value:!0});var Mn=x8(),Gg=m1(),D8=F1(),G=Dl(),P8=ti(),tt=Zs(),wt=(Ll(),ht(rr));function WZ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var $Z=WZ(P8),sI="wc",oI=2,aI="client",$g=`${sI}@${oI}:${aI}:`,jg={name:aI,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},KZ={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"},YZ={database:":memory:"},tI="WALLETCONNECT_DEEPLINK_CHOICE",JZ={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},XZ="history",ZZ="0.3",R8="proposal",eee=tt.THIRTY_DAYS,B8="Proposal expired",L8="session",Wl=tt.SEVEN_DAYS,F8="engine",lu={wc_sessionPropose:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1115}}},Qg={min:tt.FIVE_MINUTES,max:tt.SEVEN_DAYS},Fn={idle:"IDLE",active:"ACTIVE"},M8="request",U8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],tee=Object.defineProperty,ree=Object.defineProperties,nee=Object.getOwnPropertyDescriptors,N8=Object.getOwnPropertySymbols,iee=Object.prototype.hasOwnProperty,see=Object.prototype.propertyIsEnumerable,O8=(t,e,r)=>e in t?tee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))iee.call(e,r)&&O8(t,r,e[r]);if(N8)for(var r of N8(e))see.call(e,r)&&O8(t,r,e[r]);return t},zl=(t,e)=>ree(t,nee(e)),rI=class extends D8.IEngine{constructor(e){super(e),this.name=F8,this.events=new $Z.default,this.initialized=!1,this.ignoredPayloadTypes=[G.TYPE_1],this.requestQueue={state:Fn.idle,queue:[]},this.sessionRequestQueue={state:Fn.idle,queue:[]},this.requestQueueDelay=tt.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(lu)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=zl(Er({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,c=i,f,d=!1;if(c&&(d=this.client.core.pairing.pairings.get(c).active),!c||!d){let{topic:M,uri:E}=await this.client.core.pairing.create();c=M,f=E}let g=await this.client.core.crypto.generateKeyPair(),m=Er({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Mn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:y,resolve:b,done:O}=G.createDelayedPromise(tt.FIVE_MINUTES,B8);if(this.events.once(G.engineEvent("session_connect"),async({error:M,session:E})=>{if(M)y(M);else if(E){E.self.publicKey=g;let S=zl(Er({},E),{requiredNamespaces:E.requiredNamespaces,optionalNamespaces:E.optionalNamespaces});await this.client.session.set(E.topic,S),await this.setExpiry(E.topic,E.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:E.peer.metadata}),b(S)}}),!c){let{message:M}=G.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(M)}let R=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:m}),z=G.calcExpiry(tt.FIVE_MINUTES);return await this.setProposal(R,Er({id:R,expiry:z},m)),{uri:f,approval:O}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await 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:c,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",G.isValidObject(f)||(f=G.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),m=c.publicKey,y=await this.client.core.crypto.generateSharedKey(g,m);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:c.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let b=Er({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:G.calcExpiry(Wl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(y),await this.sendRequest({topic:y,method:"wc_sessionSettle",params:b,throwOnFailedPublish:!0});let O=zl(Er({},b),{topic:y,pairingTopic:u,acknowledged:!1,self:b.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:g});return await this.client.session.set(y,O),await this.setExpiry(y,G.calcExpiry(Wl)),{topic:y,acknowledged:()=>new Promise(R=>setTimeout(()=>R(this.client.session.get(y)),500))}},this.reject=async r=>{await 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,G.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_update",s),({error:c})=>{c?u(c):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,G.calcExpiry(Wl)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=wt.payloadId(),{done:u,resolve:c,reject:f}=G.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(G.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):c(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await G.getDeepLink(this.client.core.storage,tI);G.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;wt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):wt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();this.events.once(G.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=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:G.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>G.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(tI).catch(s=>this.client.logger.warn(s)),this.getPendingSessionRequests().forEach(s=>{s.topic===r&&this.deletePendingSessionRequest(s.id,G.getSdkError("USER_DISCONNECTED"))})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,G.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.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Fn.idle)},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=lu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,G.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:c}=r,f=wt.formatJsonRpcRequest(i,s,u);if(G.isBrowser()&&U8.includes(i)){let m=G.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:m})}let d=await this.client.core.crypto.encode(n,f),g=lu[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),c?(g.internal=zl(Er({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(m=>this.client.logger.error(m)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=wt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),c=await this.client.core.history.get(i,n),f=lu[c.request.method].res;o?(f.internal=zl(Er({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=wt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=lu[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=>{G.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{G.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Fn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Fn.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Fn.idle},this.processRequest=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.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=G.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(Er({},n.params));let o=G.calcExpiry(tt.FIVE_MINUTES),a=Er({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=G.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:c})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(wt.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 c=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else wt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.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:c,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:m}=n.params,y=Er({topic:r,relay:o,expiry:u,namespaces:c,acknowledged:!0,pairingTopic:m,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(G.engineEvent("session_connect"),{session:y}),this.cleanupDuplicatePairings(y)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(G.engineEvent("session_approve",i),{})):wt.isJsonRpcError(n)&&(await this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(Er({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),G.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_update",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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,G.calcExpiry(Wl)),await this.sendResult({id:i,topic:r,result:!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;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_extend",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!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(()=>{wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_ping",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Mn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(Er({topic:r},s));let o=G.hashMessage(JSON.stringify(wt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),c={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(c),this.addSessionRequestToSessionRequestQueue(c),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Er({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),G.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Fn.idle,this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Fn.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Fn.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,wt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(G.isUndefined(n)||await this.isValidPairingTopic(n),!G.isValidRelays(a,!0)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!G.isUndefined(i)&&G.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!G.isUndefined(s)&&G.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=G.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!G.isValidParams(r))throw new Error(G.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=G.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let c=G.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!G.isValidString(s,!0)){let{message:f}=G.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!G.isValidParams(r)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!G.isValidErrorReason(i)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!G.isValidParams(r)){let{message:c}=G.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!G.isValidRelay(n)){let{message:c}=G.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let a=G.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=G.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(G.isExpired(o)){let{message:c}=G.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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=G.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=G.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(!G.isValidNamespacesChainId(a,s)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!G.isValidRequest(i)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!G.isValidNamespacesRequest(a,s,i.method)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!G.isValidRequestExpiry(o,Qg)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Qg.min} and ${Qg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!G.isValidParams(r)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!G.isValidResponse(s)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!G.isValidParams(r)){let{message:a}=G.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(!G.isValidNamespacesChainId(o,s)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!G.isValidEvent(i)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!G.isValidNamespacesEvent(o,s,i.name)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Mn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!G.isValidString(i,!1)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=G.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Mn.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);try{wt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):wt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Mn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=G.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,G.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}))})}registerPairingEvents(){this.client.core.pairing.events.on(Mn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=G.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=G.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(G.isValidString(e,!1)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!G.isValidId(e)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=G.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},nI=class extends Mn.Store{constructor(e,r){super(e,r,R8,$g),this.core=e,this.logger=r}},zg=class extends Mn.Store{constructor(e,r){super(e,r,L8,$g),this.core=e,this.logger=r}},iI=class extends Mn.Store{constructor(e,r){super(e,r,M8,$g,n=>n.id),this.core=e,this.logger=r}},Wg=class t extends D8.ISignClient{constructor(e){super(e),this.protocol=sI,this.version=oI,this.name=jg.name,this.events=new P8.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||jg.name,this.metadata=e?.metadata||G.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Gg.pino(Gg.getDefaultLoggerOptions({level:e?.logger||jg.logger}));this.core=e?.core||new Mn.Core(e),this.logger=Gg.generateChildLogger(r,this.name),this.session=new zg(this.core,this.logger),this.proposal=new nI(this.core,this.logger),this.pendingRequest=new iI(this.core,this.logger),this.engine=new rI(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Gg.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.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},oee=zg,aee=Wg;Ye.ENGINE_CONTEXT=F8,Ye.ENGINE_QUEUE_STATES=Fn,Ye.ENGINE_RPC_OPTS=lu,Ye.HISTORY_CONTEXT=XZ,Ye.HISTORY_EVENTS=JZ,Ye.HISTORY_STORAGE_VERSION=ZZ,Ye.METHODS_TO_VERIFY=U8,Ye.PROPOSAL_CONTEXT=R8,Ye.PROPOSAL_EXPIRY=eee,Ye.PROPOSAL_EXPIRY_MESSAGE=B8,Ye.REQUEST_CONTEXT=M8,Ye.SESSION_CONTEXT=L8,Ye.SESSION_EXPIRY=Wl,Ye.SESSION_REQUEST_EXPIRY_BOUNDARIES=Qg,Ye.SIGN_CLIENT_CONTEXT=aI,Ye.SIGN_CLIENT_DEFAULT=jg,Ye.SIGN_CLIENT_EVENTS=KZ,Ye.SIGN_CLIENT_PROTOCOL=sI,Ye.SIGN_CLIENT_STORAGE_OPTIONS=YZ,Ye.SIGN_CLIENT_STORAGE_PREFIX=$g,Ye.SIGN_CLIENT_VERSION=oI,Ye.SessionStore=oee,Ye.SignClient=aee,Ye.WALLETCONNECT_DEEPLINK_CHOICE=tI,Ye.default=Wg});var Kg=A(as=>{"use strict";l();Object.defineProperty(as,"__esModule",{value:!0});as.OptionalOperation=as.Operation=void 0;var uee;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(uee=as.Operation||(as.Operation={}));var cee;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(cee=as.OptionalOperation||(as.OptionalOperation={}))});var uI=A(Un=>{"use strict";l();Object.defineProperty(Un,"__esModule",{value:!0});Un.WALLETCONNECT_SIGN_LOGIN_DELAY=Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Un.WALLETCONNECT_MULTIVERSX_METHODS=Un.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var V8=Kg();Un.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Un.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(V8.Operation);Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(V8.OptionalOperation);Un.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var fI=A(nn=>{"use strict";l();Object.defineProperty(nn,"__esModule",{value:!0});nn.WalletConnectV2ProviderErrorMessagesEnum=nn.ErrBadAddress=nn.ErrNotImplemented=nn.Err=void 0;var $l=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};nn.Err=$l;var cI=class extends $l{constructor(){super("Method not yet implemented")}};nn.ErrNotImplemented=cI;var lI=class extends $l{constructor(e,r){super(`Bad address: ${e}`,r)}};nn.ErrBadAddress=lI;var lee;(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.unableToSign="WalletConnect could not sign the message",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",t.invalidGuardian="WalletConnect: Invalid Guardian"})(lee=nn.WalletConnectV2ProviderErrorMessagesEnum||(nn.WalletConnectV2ProviderErrorMessagesEnum={}))});var hI=A(Yg=>{"use strict";l();Object.defineProperty(Yg,"__esModule",{value:!0});Yg.Logger=void 0;var dI=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Yg.Logger=dI});var H8=A(()=>{"use strict";l();global.Buffer||(global.Buffer=Vs().Buffer)});var G8=A(k8=>{"use strict";l();Object.defineProperty(k8,"__esModule",{value:!0})});var Q8=A(j8=>{"use strict";l();Object.defineProperty(j8,"__esModule",{value:!0})});var z8=A(fu=>{"use strict";l();var fee=fu&&fu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fu,"__esModule",{value:!0});fu.RelayedTransactionV1Builder=void 0;var dee=fee(Yt()),pI=pt(),hee=Le(),pee=Yr(),gee=Yn(),gI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new hee.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new gee.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new pee.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new pI.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new pI.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new dee.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:h.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new pI.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?h.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?h.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};fu.RelayedTransactionV1Builder=gI});var W8=A(Jg=>{"use strict";l();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.Code=void 0;var yee=gE(),mee=32,yI=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}computeHash(){let e=yee(mee).update(this.valueOf()).digest();return h.Buffer.from(e)}};Jg.Code=yI});var J8=A(hu=>{"use strict";l();Object.defineProperty(hu,"__esModule",{value:!0});hu.bech32m=hu.bech32=void 0;var Xg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",K8={};for(let t=0;t>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 $8(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=du(e)^n>>5}e=du(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=$8(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");c=du(c)^g,f+=Xg.charAt(g)}for(let d=0;d<6;++d)c=du(c);c^=e;for(let d=0;d<6;++d){let g=c>>(5-d)*5&31;f+=Xg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),c=o.toUpperCase();if(o!==u&&o!==c)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let m=$8(d);if(typeof m=="string")return m;let y=[];for(let b=0;b=g.length)&&y.push(R)}return m!==e?"Invalid checksum for "+o:{prefix:d,words:y}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:wee,fromWordsUnsafe:Eee,fromWords:vee}}hu.bech32=Y8("bech32");hu.bech32m=Y8("bech32m")});var Z8=A(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.TokenTransferProperties=jr.TransactionMetadataTransfer=jr.TransactionMetadata=jr.TransactionToDecode=jr.TransactionDecoder=void 0;var X8=J8(),wI=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new go;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Zg;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new go;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new go;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return h.Buffer.from(e).toString("base64")}base64Decode(e){return h.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new go;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=h.Buffer.from(e,"hex"),n=X8.bech32.toWords(r);return X8.bech32.encode("erd",n)}isAddressValid(e){return h.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return h.Buffer.from(e,"base64").toString("hex")}hexToString(e){return h.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};jr.TransactionDecoder=wI;var Zg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};jr.TransactionToDecode=Zg;var go=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};jr.TransactionMetadata=go;var EI=class{constructor(){this.value=BigInt(0)}};jr.TransactionMetadataTransfer=EI;var vI=class{};jr.TokenTransferProperties=vI});var AI=A(ey=>{"use strict";l();Object.defineProperty(ey,"__esModule",{value:!0});ey.ReturnCode=void 0;var ze=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};ey.ReturnCode=ze;ze.None=new ze("");ze.Ok=new ze("ok");ze.FunctionNotFound=new ze("function not found");ze.FunctionWrongSignature=new ze("wrong signature for function");ze.ContractNotFound=new ze("contract not found");ze.UserError=new ze("user error");ze.OutOfGas=new ze("out of gas");ze.AccountCollision=new ze("account collision");ze.OutOfFunds=new ze("out of funds");ze.CallStackOverFlow=new ze("call stack overflow");ze.ContractInvalid=new ze("contract invalid");ze.ExecutionFailed=new ze("execution failed");ze.Unknown=new ze("unknown")});var rL=A(ty=>{"use strict";l();Object.defineProperty(ty,"__esModule",{value:!0});ty.ResultsParser=void 0;var Aee=Z8(),eL=pt(),tL=Le(),us=pa(),bee=na(),pu=AI(),gu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(gu||(gu={}));var bI;(function(t){t.TooMuchGas="@too much gas provided for processing"})(bI||(bI={}));var Iee={argsSerializer:new bee.ArgSerializer},II=class{constructor(e){e=Object.assign(Object.assign({},Iee),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new pu.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new pu.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return us.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return us.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return us.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return us.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return us.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return us.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return us.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return us.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new tL.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new Aee.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:pu.ReturnCode.None,returnMessage:pu.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:pu.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(gu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(gu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(bI.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new eL.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(gu.OnWriteLog,u=>u.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new eL.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(gu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),c=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&c});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||h.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new tL.ErrCannotParseContractResults("no return code");return{returnCode:pu.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){var n,i;let s={},o=e.topics.map(m=>h.Buffer.from(m.valueOf())).slice(1),a=((n=e.dataPayload)===null||n===void 0?void 0:n.valueOf())||h.Buffer.from([]),u=((i=e.additionalData)===null||i===void 0?void 0:i.map(m=>h.Buffer.from(m.valueOf())))||[];u.length==0&&a.length>0&&u.push(h.Buffer.from(a));let c=r.inputs.filter(m=>m.indexed),f=this.argsSerializer.buffersToValues(o,c);for(let m=0;m!m.indexed),g=this.argsSerializer.buffersToValues(u,d);for(let m=0;m{"use strict";l();var _ee=_t&&_t.__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]}),ur=_t&&_t.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_ee(e,t,r)};Object.defineProperty(_t,"__esModule",{value:!0});ur(na(),_t);ur(W8(),_t);ur(Bw(),_t);ur(NE(),_t);ur(qc(),_t);ur(UE(),_t);ur(RE(),_t);ur(Rv(),_t);ur(HE(),_t);ur(Vc(),_t);ur(rL(),_t);ur(AI(),_t);ur(Dv(),_t);ur($E(),_t);ur(xt(),_t)});var iL=A(ry=>{"use strict";l();Object.defineProperty(ry,"__esModule",{value:!0});ry.RelayedTransactionV2Builder=void 0;var nL=Le(),Kl=_I(),See=Yr(),Tee=Yn(),SI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new nL.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new nL.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Kl.ArgSerializer().valuesToString([new Kl.AddressValue(this.innerTransaction.getReceiver()),new Kl.U64Value(this.innerTransaction.getNonce().valueOf()),new Kl.BytesValue(this.innerTransaction.getData().valueOf()),new Kl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new Tee.TransactionPayload(r),i=new See.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};ry.RelayedTransactionV2Builder=SI});var CI=A(lt=>{"use strict";l();var Cee=lt&<.__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]}),xee=lt&<.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sL=lt&<.__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)&&Cee(e,t,r);return xee(e,t),e},Nee=lt&<.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lt,"__esModule",{value:!0});lt.addressToHex=lt.bufferToHex=lt.utf8ToHex=lt.bigIntToHex=lt.bigIntToBuffer=lt.bufferToBigInt=lt.stringToBuffer=void 0;var Oee=Nee(Yt()),Dee=pt(),TI=sL(Tc()),oL=sL(Md());function Pee(t){return h.Buffer.from(t)}lt.stringToBuffer=Pee;function Ree(t){return t.length==0?new Oee.default(0):TI.bufferToBigInt(t)}lt.bufferToBigInt=Ree;function Bee(t){return t==0?h.Buffer.from([]):TI.bigIntToBuffer(t)}lt.bigIntToBuffer=Bee;function Lee(t){return t==0?"":TI.getHexMagnitudeOfBigInt(t)}lt.bigIntToHex=Lee;function Fee(t){let e=h.Buffer.from(t).toString("hex");return oL.zeroPadStringIfOddLength(e)}lt.utf8ToHex=Fee;function Mee(t){let e=t.toString("hex");return oL.zeroPadStringIfOddLength(e)}lt.bufferToHex=Mee;function Uee(t){return Dee.Address.fromBech32(t.toString()).pubkey().toString("hex")}lt.addressToHex=Uee});var uL=A(ny=>{"use strict";l();Object.defineProperty(ny,"__esModule",{value:!0});ny.TokenOperationsFactory=void 0;var xI=Os(),qee=pa(),aL=xc(),Vee=Yr(),Hee=Yn(),ne=CI(),NI=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true"),this.falseAsHex=ne.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){qee.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex(e.tokenType),ne.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleLocalMint?[ne.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ne.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ne.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ne.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ne.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.initialQuantity),ne.utf8ToHex(e.name),ne.bigIntToHex(e.royalties),ne.utf8ToHex(e.hash),ne.bufferToHex(e.attributes),...e.uris.map(ne.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:a,dataParts:u}){let c=this.buildTransactionPayload(u),f=o||this.computeGasLimit(c,a),d=new rL.TransactionVersion(_I.TRANSACTION_VERSION_DEFAULT),g=new rL.TransactionOptions(_I.TRANSACTION_OPTIONS_DEFAULT);return new xee.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:c,version:d,options:g})}buildTransactionPayload(e){let r=e.join(_I.ARGUMENTS_SEPARATOR);return new Nee.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};ny.TokenOperationsFactory=SI});var iL=v(iy=>{"use strict";l();Object.defineProperty(iy,"__esModule",{value:!0});iy.TokenOperationsFactoryConfig=void 0;var Oee=pt(),TI=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=Oee.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};iy.TokenOperationsFactoryConfig=TI});var oL=v(sy=>{"use strict";l();Object.defineProperty(sy,"__esModule",{value:!0});sy.TokenOperationsOutcomeParser=void 0;var Dee=pt(),CI=Le(),sL=II(),xI=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=h.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new CI.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new CI.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new CI.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return sL.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return sL.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return Dee.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};sy.TokenOperationsOutcomeParser=xI});var aL=v(pi=>{"use strict";l();var Pee=pi&&pi.__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]}),NI=pi&&pi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pee(e,t,r)};Object.defineProperty(pi,"__esModule",{value:!0});NI(nL(),pi);NI(iL(),pi);NI(oL(),pi)});var uL=v(rt=>{"use strict";l();var Ree=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]}),Dt=rt&&rt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ree(e,t,r)};Object.defineProperty(rt,"__esModule",{value:!0});B8();Dt(ha(),rt);Dt(pt(),rt);Dt(CE(),rt);Dt(Le(),rt);Dt(IE(),rt);Dt(F8(),rt);Dt(U8(),rt);Dt(pa(),rt);Dt(xc(),rt);Dt(q8(),rt);Dt(Z8(),rt);Dt(Wh(),rt);Dt(vI(),rt);Dt(aL(),rt);Dt(Hm(),rt);Dt(Yr(),rt);Dt(Yn(),rt);Dt(Ih(),rt);Dt(AE(),rt);Dt(br(),rt)});var pL=v(Pt=>{"use strict";l();var Bee=Pt&&Pt.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.sleep=Pt.getMetadata=Pt.applyTransactionSignature=Pt.getAddressFromSession=Pt.addressIsValid=Pt.getConnectionParams=Pt.getCurrentTopic=Pt.getCurrentSession=void 0;var fL=uL(),cL=Rc(),Lee=Dl(),oy=iI(),gi=aI(),OI=cI(),lL=Kg();function dL(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(hL(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw OI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Pt.getCurrentSession=dL;function Fee(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=dL(t,e);if(!r?.topic)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Pt.getCurrentTopic=Fee;function hL(t,e){var r,n,i;let s=[...oy.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(lL.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(lL.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${oy.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Pt.getConnectionParams=hL;function Mee(t){try{return!fL.Address.fromBech32(t).isEmpty()}catch{return!1}}Pt.addressIsValid=Mee;function Uee(t){let e=t.namespaces[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Pt.getAddressFromSession=Uee;function qee({transaction:t,response:e}){if(!e)throw OI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw OI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(fL.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new cL.Signature(r)),n&&t.applyGuardianSignature(new cL.Signature(n)),t}Pt.applyTransactionSignature=qee;function Vee(t){if(t)return Object.assign(Object.assign({},t),{url:Lee.getAppMetadata().url})}Pt.getMetadata=Vee;function Hee(t){return Bee(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}Pt.sleep=Hee});var Yl=v(vr=>{"use strict";l();var St=vr&&vr.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},kee=vr&&vr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vr,"__esModule",{value:!0});vr.WalletConnectV2Provider=vr.OptionalOperation=vr.Operation=vr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var Gee=Rc(),jee=kee(P8()),DI=Dl(),yo=iI(),we=aI();Object.defineProperty(vr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return we.WalletConnectV2ProviderErrorMessagesEnum}});var Fe=cI(),us=Kg();Object.defineProperty(vr,"Operation",{enumerable:!0,get:function(){return us.Operation}});Object.defineProperty(vr,"OptionalOperation",{enumerable:!0,get:function(){return us.OptionalOperation}});var Wt=pL(),PI=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,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.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return St(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Wt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield jee.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(we.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){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Wt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Fe.Logger.error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return St(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(we.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){yield Wt.sleep(yo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Wt.getAddressFromSession(n),o=n.namespaces[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(us.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?us.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:us.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Wt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:DI.getSdkError("USER_DISCONNECTED")});else{let r=Wt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:DI.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.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 St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:us.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new Gee.Signature(n))}catch{throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:us.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Wt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:us.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Wt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Wt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return St(this,void 0,void 0,function*(){return e?Wt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Fe.Logger.error(`${we.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return St(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Wt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.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&&Wt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.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:c}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>St(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>St(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Fe.Logger.error(we.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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Wt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,c;return St(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(!DI.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(c=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||c===void 0?void 0:c.unsubscribe(d.topic)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};vr.WalletConnectV2Provider=PI});var yL=v((tme,gL)=>{"use strict";l();gL.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 EL=v((nme,wL)=>{"use strict";l();var mL=typeof Symbol<"u"&&Symbol,Qee=yL();wL.exports=function(){return typeof mL!="function"||typeof Symbol!="function"||typeof mL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Qee()}});var bL=v((sme,AL)=>{"use strict";l();var vL={foo:{}},zee=Object;AL.exports=function(){return{__proto__:vL}.foo===vL.foo&&!({__proto__:null}instanceof zee)}});var SL=v((ame,_L)=>{"use strict";l();var Wee="Function.prototype.bind called on incompatible ",$ee=Object.prototype.toString,Kee=Math.max,Yee="[object Function]",IL=function(e,r){for(var n=[],i=0;i{"use strict";l();var Zee=SL();TL.exports=Function.prototype.bind||Zee});var xL=v((fme,CL)=>{"use strict";l();var ete=Function.prototype.call,tte=Object.prototype.hasOwnProperty,rte=ay();CL.exports=rte.call(ete,tte)});var cs=v((hme,RL)=>{"use strict";l();var Re,mu=SyntaxError,PL=Function,yu=TypeError,RI=function(t){try{return PL('"use strict"; return ('+t+").constructor;")()}catch{}},mo=Object.getOwnPropertyDescriptor;if(mo)try{mo({},"")}catch{mo=null}var BI=function(){throw new yu},nte=mo?function(){try{return arguments.callee,BI}catch{try{return mo(arguments,"callee").get}catch{return BI}}}():BI,pu=EL()(),ite=bL()(),kt=Object.getPrototypeOf||(ite?function(t){return t.__proto__}:null),gu={},ste=typeof Uint8Array>"u"||!kt?Re:kt(Uint8Array),wo={"%AggregateError%":typeof AggregateError>"u"?Re:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Re:ArrayBuffer,"%ArrayIteratorPrototype%":pu&&kt?kt([][Symbol.iterator]()):Re,"%AsyncFromSyncIteratorPrototype%":Re,"%AsyncFunction%":gu,"%AsyncGenerator%":gu,"%AsyncGeneratorFunction%":gu,"%AsyncIteratorPrototype%":gu,"%Atomics%":typeof Atomics>"u"?Re:Atomics,"%BigInt%":typeof BigInt>"u"?Re:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Re:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Re:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Re:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Re:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Re:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Re:FinalizationRegistry,"%Function%":PL,"%GeneratorFunction%":gu,"%Int8Array%":typeof Int8Array>"u"?Re:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Re:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Re:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":pu&&kt?kt(kt([][Symbol.iterator]())):Re,"%JSON%":typeof JSON=="object"?JSON:Re,"%Map%":typeof Map>"u"?Re:Map,"%MapIteratorPrototype%":typeof Map>"u"||!pu||!kt?Re:kt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Re:Promise,"%Proxy%":typeof Proxy>"u"?Re:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Re:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Re:Set,"%SetIteratorPrototype%":typeof Set>"u"||!pu||!kt?Re:kt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Re:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":pu&&kt?kt(""[Symbol.iterator]()):Re,"%Symbol%":pu?Symbol:Re,"%SyntaxError%":mu,"%ThrowTypeError%":nte,"%TypedArray%":ste,"%TypeError%":yu,"%Uint8Array%":typeof Uint8Array>"u"?Re:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Re:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Re:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Re:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Re:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Re:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Re:WeakSet};if(kt)try{null.error}catch(t){NL=kt(kt(t)),wo["%Error.prototype%"]=NL}var NL,ote=function t(e){var r;if(e==="%AsyncFunction%")r=RI("async function () {}");else if(e==="%GeneratorFunction%")r=RI("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=RI("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&kt&&(r=kt(i.prototype))}return wo[e]=r,r},OL={"%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=ay(),uy=xL(),ate=Jl.call(Function.call,Array.prototype.concat),ute=Jl.call(Function.apply,Array.prototype.splice),DL=Jl.call(Function.call,String.prototype.replace),cy=Jl.call(Function.call,String.prototype.slice),cte=Jl.call(Function.call,RegExp.prototype.exec),lte=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,fte=/\\(\\)?/g,dte=function(e){var r=cy(e,0,1),n=cy(e,-1);if(r==="%"&&n!=="%")throw new mu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new mu("invalid intrinsic syntax, expected opening `%`");var i=[];return DL(e,lte,function(s,o,a,u){i[i.length]=a?DL(u,fte,"$1"):o||s}),i},hte=function(e,r){var n=e,i;if(uy(OL,n)&&(i=OL[n],n="%"+i[0]+"%"),uy(wo,n)){var s=wo[n];if(s===gu&&(s=ote(n)),typeof s>"u"&&!r)throw new yu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new mu("intrinsic "+e+" does not exist!")};RL.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new yu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new yu('"allowMissing" argument must be a boolean');if(cte(/^%?[^%]*%?$/,e)===null)throw new mu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=dte(e),i=n.length>0?n[0]:"",s=hte("%"+i+"%",r),o=s.name,a=s.value,u=!1,c=s.alias;c&&(i=c[0],ute(n,ate([0,1],c)));for(var f=1,d=!0;f=n.length){var A=mo(a,g);d=!!A,d&&"get"in A&&!("originalValue"in A.get)?a=A.get:a=a[g]}else d=uy(a,g),a=a[g];d&&!u&&(wo[o]=a)}}return a}});var MI=v((gme,BL)=>{"use strict";l();var pte=cs(),LI=pte("%Object.defineProperty%",!0),FI=function(){if(LI)try{return LI({},"a",{value:1}),!0}catch{return!1}return!1};FI.hasArrayLengthDefineBug=function(){if(!FI())return null;try{return LI([],"length",{value:1}).length!==1}catch{return!0}};BL.exports=FI});var UI=v((mme,LL)=>{"use strict";l();var gte=cs(),ly=gte("%Object.getOwnPropertyDescriptor%",!0);if(ly)try{ly([],"length")}catch{ly=null}LL.exports=ly});var UL=v((Eme,ML)=>{"use strict";l();var yte=MI()(),qI=cs(),Xl=yte&&qI("%Object.defineProperty%",!0);if(Xl)try{Xl({},"a",{value:1})}catch{Xl=!1}var mte=qI("%SyntaxError%"),wu=qI("%TypeError%"),FL=UI();ML.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new wu("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new wu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new wu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new wu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new wu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new wu("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!FL&&FL(e,r);if(Xl)Xl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new mte("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var jL=v((Ame,GL)=>{"use strict";l();var kL=cs(),qL=UL(),wte=MI()(),VL=UI(),HL=kL("%TypeError%"),Ete=kL("%Math.floor%");GL.exports=function(e,r){if(typeof e!="function")throw new HL("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Ete(r)!==r)throw new HL("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&VL){var o=VL(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(wte?qL(e,"length",r,!0,!0):qL(e,"length",r)),e}});var KL=v((Ime,fy)=>{"use strict";l();var VI=ay(),Eu=cs(),vte=jL(),Ate=Eu("%TypeError%"),zL=Eu("%Function.prototype.apply%"),WL=Eu("%Function.prototype.call%"),$L=Eu("%Reflect.apply%",!0)||VI.call(WL,zL),Zl=Eu("%Object.defineProperty%",!0),bte=Eu("%Math.max%");if(Zl)try{Zl({},"a",{value:1})}catch{Zl=null}fy.exports=function(e){if(typeof e!="function")throw new Ate("a function is required");var r=$L(VI,WL,arguments);return vte(r,1+bte(0,e.length-(arguments.length-1)),!0)};var QL=function(){return $L(VI,zL,arguments)};Zl?Zl(fy.exports,"apply",{value:QL}):fy.exports.apply=QL});var ZL=v((Sme,XL)=>{"use strict";l();var YL=cs(),JL=KL(),Ite=JL(YL("String.prototype.indexOf"));XL.exports=function(e,r){var n=YL(e,!!r);return typeof n=="function"&&Ite(e,".prototype.")>-1?JL(n):n}});var eF=v(()=>{l()});var vF=v((Ome,EF)=>{l();var YI=typeof Map=="function"&&Map.prototype,HI=Object.getOwnPropertyDescriptor&&YI?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,hy=YI&&HI&&typeof HI.get=="function"?HI.get:null,tF=YI&&Map.prototype.forEach,JI=typeof Set=="function"&&Set.prototype,kI=Object.getOwnPropertyDescriptor&&JI?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,py=JI&&kI&&typeof kI.get=="function"?kI.get:null,rF=JI&&Set.prototype.forEach,_te=typeof WeakMap=="function"&&WeakMap.prototype,tf=_te?WeakMap.prototype.has:null,Ste=typeof WeakSet=="function"&&WeakSet.prototype,rf=Ste?WeakSet.prototype.has:null,Tte=typeof WeakRef=="function"&&WeakRef.prototype,nF=Tte?WeakRef.prototype.deref:null,Cte=Boolean.prototype.valueOf,xte=Object.prototype.toString,Nte=Function.prototype.toString,Ote=String.prototype.match,XI=String.prototype.slice,fs=String.prototype.replace,Dte=String.prototype.toUpperCase,iF=String.prototype.toLowerCase,hF=RegExp.prototype.test,sF=Array.prototype.concat,qn=Array.prototype.join,Pte=Array.prototype.slice,oF=Math.floor,QI=typeof BigInt=="function"?BigInt.prototype.valueOf:null,GI=Object.getOwnPropertySymbols,zI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,vu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",nr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===vu||!0)?Symbol.toStringTag:null,pF=Object.prototype.propertyIsEnumerable,aF=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function uF(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||hF.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-oF(-t):oF(t);if(n!==t){var i=String(n),s=XI.call(e,i.length+1);return fs.call(i,r,"$&_")+"."+fs.call(fs.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fs.call(e,r,"$&_")}var WI=eF(),cF=WI.custom,lF=yF(cF)?cF:null;EF.exports=function t(e,r,n,i){var s=r||{};if(ls(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ls(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=ls(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(ls(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(ls(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 wF(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?uF(e,u):u}if(typeof e=="bigint"){var c=String(e)+"n";return a?uF(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return $I(e)?"[Array]":"[Object]";var d=Yte(s,n);if(typeof i>"u")i=[];else if(mF(i,e)>=0)return"[Circular]";function g(j,K,me){if(K&&(i=Pte.call(i),i.push(K)),me){var ce={depth:s.depth};return ls(s,"quoteStyle")&&(ce.quoteStyle=s.quoteStyle),t(j,ce,n+1,i)}return t(j,s,n+1,i)}if(typeof e=="function"&&!fF(e)){var m=Hte(e),y=dy(e,g);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(y.length>0?" { "+qn.call(y,", ")+" }":"")}if(yF(e)){var A=vu?fs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):zI.call(e);return typeof e=="object"&&!vu?ef(A):A}if(Wte(e)){for(var O="<"+iF.call(String(e.nodeName)),R=e.attributes||[],z=0;z",O}if($I(e)){if(e.length===0)return"[]";var M=dy(e,g);return d&&!Kte(M)?"["+KI(M,d)+"]":"[ "+qn.call(M,", ")+" ]"}if(Lte(e)){var b=dy(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!pF.call(e,"cause")?"{ ["+String(e)+"] "+qn.call(sF.call("[cause]: "+g(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+qn.call(b,", ")+" }"}if(typeof e=="object"&&o){if(lF&&typeof e[lF]=="function"&&WI)return WI(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(kte(e)){var S=[];return tF&&tF.call(e,function(j,K){S.push(g(K,e,!0)+" => "+g(j,e))}),dF("Map",hy.call(e),S,d)}if(Qte(e)){var N=[];return rF&&rF.call(e,function(j){N.push(g(j,e))}),dF("Set",py.call(e),N,d)}if(Gte(e))return jI("WeakMap");if(zte(e))return jI("WeakSet");if(jte(e))return jI("WeakRef");if(Mte(e))return ef(g(Number(e)));if(qte(e))return ef(g(QI.call(e)));if(Ute(e))return ef(Cte.call(e));if(Fte(e))return ef(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Bte(e)&&!fF(e)){var _=dy(e,g),T=aF?aF(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",X=!T&&nr&&Object(e)===e&&nr in e?XI.call(ds(e),8,-1):B?"Object":"",Q=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=Q+(X||B?"["+qn.call(sF.call([],X||[],B||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+KI(_,d)+"}":H+"{ "+qn.call(_,", ")+" }"}return String(e)};function gF(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Rte(t){return fs.call(String(t),/"/g,""")}function $I(t){return ds(t)==="[object Array]"&&(!nr||!(typeof t=="object"&&nr in t))}function Bte(t){return ds(t)==="[object Date]"&&(!nr||!(typeof t=="object"&&nr in t))}function fF(t){return ds(t)==="[object RegExp]"&&(!nr||!(typeof t=="object"&&nr in t))}function Lte(t){return ds(t)==="[object Error]"&&(!nr||!(typeof t=="object"&&nr in t))}function Fte(t){return ds(t)==="[object String]"&&(!nr||!(typeof t=="object"&&nr in t))}function Mte(t){return ds(t)==="[object Number]"&&(!nr||!(typeof t=="object"&&nr in t))}function Ute(t){return ds(t)==="[object Boolean]"&&(!nr||!(typeof t=="object"&&nr in t))}function yF(t){if(vu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!zI)return!1;try{return zI.call(t),!0}catch{}return!1}function qte(t){if(!t||typeof t!="object"||!QI)return!1;try{return QI.call(t),!0}catch{}return!1}var Vte=Object.prototype.hasOwnProperty||function(t){return t in this};function ls(t,e){return Vte.call(t,e)}function ds(t){return xte.call(t)}function Hte(t){if(t.name)return t.name;var e=Ote.call(Nte.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function mF(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 wF(XI.call(t,0,e.maxStringLength),e)+n}var i=fs.call(fs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$te);return gF(i,"single",e)}function $te(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":"")+Dte.call(e.toString(16))}function ef(t){return"Object("+t+")"}function jI(t){return t+" { ? }"}function dF(t,e,r,n){var i=n?KI(r,n):qn.call(r,", ");return t+" ("+e+") {"+i+"}"}function Kte(t){for(var e=0;e=0)return!1;return!0}function Yte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=qn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:qn.call(Array(e+1),r)}}function KI(t,e){if(t.length===0)return"";var r=` +Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex(e.tokenType),ne.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleLocalMint?[ne.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ne.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ne.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ne.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ne.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.initialQuantity),ne.utf8ToHex(e.name),ne.bigIntToHex(e.royalties),ne.utf8ToHex(e.hash),ne.bufferToHex(e.attributes),...e.uris.map(ne.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:a,dataParts:u}){let c=this.buildTransactionPayload(u),f=o||this.computeGasLimit(c,a),d=new aL.TransactionVersion(xI.TRANSACTION_VERSION_DEFAULT),g=new aL.TransactionOptions(xI.TRANSACTION_OPTIONS_DEFAULT);return new Vee.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:c,version:d,options:g})}buildTransactionPayload(e){let r=e.join(xI.ARGUMENTS_SEPARATOR);return new Hee.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};ny.TokenOperationsFactory=NI});var cL=A(iy=>{"use strict";l();Object.defineProperty(iy,"__esModule",{value:!0});iy.TokenOperationsFactoryConfig=void 0;var kee=pt(),OI=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=kee.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};iy.TokenOperationsFactoryConfig=OI});var fL=A(sy=>{"use strict";l();Object.defineProperty(sy,"__esModule",{value:!0});sy.TokenOperationsOutcomeParser=void 0;var Gee=pt(),DI=Le(),lL=CI(),PI=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=h.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new DI.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new DI.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new DI.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return lL.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return lL.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return Gee.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};sy.TokenOperationsOutcomeParser=PI});var dL=A(pi=>{"use strict";l();var jee=pi&&pi.__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]}),RI=pi&&pi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jee(e,t,r)};Object.defineProperty(pi,"__esModule",{value:!0});RI(uL(),pi);RI(cL(),pi);RI(fL(),pi)});var hL=A(rt=>{"use strict";l();var Qee=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]}),Dt=rt&&rt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qee(e,t,r)};Object.defineProperty(rt,"__esModule",{value:!0});H8();Dt(ha(),rt);Dt(pt(),rt);Dt(TE(),rt);Dt(Le(),rt);Dt(bE(),rt);Dt(G8(),rt);Dt(Q8(),rt);Dt(pa(),rt);Dt(xc(),rt);Dt(z8(),rt);Dt(iL(),rt);Dt(Wh(),rt);Dt(_I(),rt);Dt(dL(),rt);Dt(Vm(),rt);Dt(Yr(),rt);Dt(Yn(),rt);Dt(Ih(),rt);Dt(vE(),rt);Dt(br(),rt)});var EL=A(Pt=>{"use strict";l();var zee=Pt&&Pt.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.sleep=Pt.getMetadata=Pt.applyTransactionSignature=Pt.getAddressFromSession=Pt.addressIsValid=Pt.getConnectionParams=Pt.getCurrentTopic=Pt.getCurrentSession=void 0;var yL=hL(),pL=Rc(),Wee=Dl(),oy=uI(),gi=fI(),BI=hI(),gL=Kg();function mL(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(wL(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw BI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Pt.getCurrentSession=mL;function $ee(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=mL(t,e);if(!r?.topic)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Pt.getCurrentTopic=$ee;function wL(t,e){var r,n,i;let s=[...oy.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(gL.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(gL.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${oy.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Pt.getConnectionParams=wL;function Kee(t){try{return!yL.Address.fromBech32(t).isEmpty()}catch{return!1}}Pt.addressIsValid=Kee;function Yee(t){let e=t.namespaces[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Pt.getAddressFromSession=Yee;function Jee({transaction:t,response:e}){if(!e)throw BI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw BI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(yL.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new pL.Signature(r)),n&&t.applyGuardianSignature(new pL.Signature(n)),t}Pt.applyTransactionSignature=Jee;function Xee(t){if(t)return Object.assign(Object.assign({},t),{url:Wee.getAppMetadata().url})}Pt.getMetadata=Xee;function Zee(t){return zee(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}Pt.sleep=Zee});var Yl=A(vr=>{"use strict";l();var St=vr&&vr.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},ete=vr&&vr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vr,"__esModule",{value:!0});vr.WalletConnectV2Provider=vr.OptionalOperation=vr.Operation=vr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var tte=Rc(),rte=ete(q8()),LI=Dl(),yo=uI(),we=fI();Object.defineProperty(vr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return we.WalletConnectV2ProviderErrorMessagesEnum}});var Fe=hI(),cs=Kg();Object.defineProperty(vr,"Operation",{enumerable:!0,get:function(){return cs.Operation}});Object.defineProperty(vr,"OptionalOperation",{enumerable:!0,get:function(){return cs.OptionalOperation}});var Wt=EL(),FI=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,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.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return St(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Wt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield rte.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(we.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){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Wt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Fe.Logger.error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return St(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(we.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){yield Wt.sleep(yo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Wt.getAddressFromSession(n),o=n.namespaces[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(cs.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?cs.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:cs.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Wt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:LI.getSdkError("USER_DISCONNECTED")});else{let r=Wt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:LI.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.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 St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:cs.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new tte.Signature(n))}catch{throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:cs.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Wt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:cs.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Wt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Wt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return St(this,void 0,void 0,function*(){return e?Wt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Fe.Logger.error(`${we.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return St(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Wt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.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&&Wt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.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:c}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>St(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>St(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Fe.Logger.error(we.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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Wt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,c;return St(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(!LI.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(c=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||c===void 0?void 0:c.unsubscribe(d.topic)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};vr.WalletConnectV2Provider=FI});var AL=A((dme,vL)=>{"use strict";l();vL.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 _L=A((pme,IL)=>{"use strict";l();var bL=typeof Symbol<"u"&&Symbol,nte=AL();IL.exports=function(){return typeof bL!="function"||typeof Symbol!="function"||typeof bL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:nte()}});var CL=A((yme,TL)=>{"use strict";l();var SL={foo:{}},ite=Object;TL.exports=function(){return{__proto__:SL}.foo===SL.foo&&!({__proto__:null}instanceof ite)}});var OL=A((wme,NL)=>{"use strict";l();var ste="Function.prototype.bind called on incompatible ",ote=Object.prototype.toString,ate=Math.max,ute="[object Function]",xL=function(e,r){for(var n=[],i=0;i{"use strict";l();var fte=OL();DL.exports=Function.prototype.bind||fte});var RL=A((bme,PL)=>{"use strict";l();var dte=Function.prototype.call,hte=Object.prototype.hasOwnProperty,pte=ay();PL.exports=pte.call(dte,hte)});var ls=A((_me,UL)=>{"use strict";l();var Re,Eu=SyntaxError,ML=Function,wu=TypeError,MI=function(t){try{return ML('"use strict"; return ('+t+").constructor;")()}catch{}},mo=Object.getOwnPropertyDescriptor;if(mo)try{mo({},"")}catch{mo=null}var UI=function(){throw new wu},gte=mo?function(){try{return arguments.callee,UI}catch{try{return mo(arguments,"callee").get}catch{return UI}}}():UI,yu=_L()(),yte=CL()(),Gt=Object.getPrototypeOf||(yte?function(t){return t.__proto__}:null),mu={},mte=typeof Uint8Array>"u"||!Gt?Re:Gt(Uint8Array),wo={"%AggregateError%":typeof AggregateError>"u"?Re:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Re:ArrayBuffer,"%ArrayIteratorPrototype%":yu&&Gt?Gt([][Symbol.iterator]()):Re,"%AsyncFromSyncIteratorPrototype%":Re,"%AsyncFunction%":mu,"%AsyncGenerator%":mu,"%AsyncGeneratorFunction%":mu,"%AsyncIteratorPrototype%":mu,"%Atomics%":typeof Atomics>"u"?Re:Atomics,"%BigInt%":typeof BigInt>"u"?Re:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Re:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Re:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Re:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Re:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Re:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Re:FinalizationRegistry,"%Function%":ML,"%GeneratorFunction%":mu,"%Int8Array%":typeof Int8Array>"u"?Re:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Re:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Re:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":yu&&Gt?Gt(Gt([][Symbol.iterator]())):Re,"%JSON%":typeof JSON=="object"?JSON:Re,"%Map%":typeof Map>"u"?Re:Map,"%MapIteratorPrototype%":typeof Map>"u"||!yu||!Gt?Re:Gt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Re:Promise,"%Proxy%":typeof Proxy>"u"?Re:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Re:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Re:Set,"%SetIteratorPrototype%":typeof Set>"u"||!yu||!Gt?Re:Gt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Re:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":yu&&Gt?Gt(""[Symbol.iterator]()):Re,"%Symbol%":yu?Symbol:Re,"%SyntaxError%":Eu,"%ThrowTypeError%":gte,"%TypedArray%":mte,"%TypeError%":wu,"%Uint8Array%":typeof Uint8Array>"u"?Re:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Re:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Re:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Re:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Re:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Re:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Re:WeakSet};if(Gt)try{null.error}catch(t){BL=Gt(Gt(t)),wo["%Error.prototype%"]=BL}var BL,wte=function t(e){var r;if(e==="%AsyncFunction%")r=MI("async function () {}");else if(e==="%GeneratorFunction%")r=MI("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=MI("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Gt&&(r=Gt(i.prototype))}return wo[e]=r,r},LL={"%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=ay(),uy=RL(),Ete=Jl.call(Function.call,Array.prototype.concat),vte=Jl.call(Function.apply,Array.prototype.splice),FL=Jl.call(Function.call,String.prototype.replace),cy=Jl.call(Function.call,String.prototype.slice),Ate=Jl.call(Function.call,RegExp.prototype.exec),bte=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ite=/\\(\\)?/g,_te=function(e){var r=cy(e,0,1),n=cy(e,-1);if(r==="%"&&n!=="%")throw new Eu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Eu("invalid intrinsic syntax, expected opening `%`");var i=[];return FL(e,bte,function(s,o,a,u){i[i.length]=a?FL(u,Ite,"$1"):o||s}),i},Ste=function(e,r){var n=e,i;if(uy(LL,n)&&(i=LL[n],n="%"+i[0]+"%"),uy(wo,n)){var s=wo[n];if(s===mu&&(s=wte(n)),typeof s>"u"&&!r)throw new wu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Eu("intrinsic "+e+" does not exist!")};UL.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new wu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new wu('"allowMissing" argument must be a boolean');if(Ate(/^%?[^%]*%?$/,e)===null)throw new Eu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=_te(e),i=n.length>0?n[0]:"",s=Ste("%"+i+"%",r),o=s.name,a=s.value,u=!1,c=s.alias;c&&(i=c[0],vte(n,Ete([0,1],c)));for(var f=1,d=!0;f=n.length){var b=mo(a,g);d=!!b,d&&"get"in b&&!("originalValue"in b.get)?a=b.get:a=a[g]}else d=uy(a,g),a=a[g];d&&!u&&(wo[o]=a)}}return a}});var HI=A((Tme,qL)=>{"use strict";l();var Tte=ls(),qI=Tte("%Object.defineProperty%",!0),VI=function(){if(qI)try{return qI({},"a",{value:1}),!0}catch{return!1}return!1};VI.hasArrayLengthDefineBug=function(){if(!VI())return null;try{return qI([],"length",{value:1}).length!==1}catch{return!0}};qL.exports=VI});var kI=A((xme,VL)=>{"use strict";l();var Cte=ls(),ly=Cte("%Object.getOwnPropertyDescriptor%",!0);if(ly)try{ly([],"length")}catch{ly=null}VL.exports=ly});var GL=A((Ome,kL)=>{"use strict";l();var xte=HI()(),GI=ls(),Xl=xte&&GI("%Object.defineProperty%",!0);if(Xl)try{Xl({},"a",{value:1})}catch{Xl=!1}var Nte=GI("%SyntaxError%"),vu=GI("%TypeError%"),HL=kI();kL.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new vu("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new vu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new vu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new vu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new vu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new vu("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!HL&&HL(e,r);if(Xl)Xl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new Nte("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var KL=A((Pme,$L)=>{"use strict";l();var WL=ls(),jL=GL(),Ote=HI()(),QL=kI(),zL=WL("%TypeError%"),Dte=WL("%Math.floor%");$L.exports=function(e,r){if(typeof e!="function")throw new zL("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Dte(r)!==r)throw new zL("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&QL){var o=QL(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Ote?jL(e,"length",r,!0,!0):jL(e,"length",r)),e}});var eF=A((Bme,fy)=>{"use strict";l();var jI=ay(),Au=ls(),Pte=KL(),Rte=Au("%TypeError%"),JL=Au("%Function.prototype.apply%"),XL=Au("%Function.prototype.call%"),ZL=Au("%Reflect.apply%",!0)||jI.call(XL,JL),Zl=Au("%Object.defineProperty%",!0),Bte=Au("%Math.max%");if(Zl)try{Zl({},"a",{value:1})}catch{Zl=null}fy.exports=function(e){if(typeof e!="function")throw new Rte("a function is required");var r=ZL(jI,XL,arguments);return Pte(r,1+Bte(0,e.length-(arguments.length-1)),!0)};var YL=function(){return ZL(jI,JL,arguments)};Zl?Zl(fy.exports,"apply",{value:YL}):fy.exports.apply=YL});var iF=A((Fme,nF)=>{"use strict";l();var tF=ls(),rF=eF(),Lte=rF(tF("String.prototype.indexOf"));nF.exports=function(e,r){var n=tF(e,!!r);return typeof n=="function"&&Lte(e,".prototype.")>-1?rF(n):n}});var sF=A(()=>{l()});var SF=A((Hme,_F)=>{l();var e_=typeof Map=="function"&&Map.prototype,QI=Object.getOwnPropertyDescriptor&&e_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,hy=e_&&QI&&typeof QI.get=="function"?QI.get:null,oF=e_&&Map.prototype.forEach,t_=typeof Set=="function"&&Set.prototype,zI=Object.getOwnPropertyDescriptor&&t_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,py=t_&&zI&&typeof zI.get=="function"?zI.get:null,aF=t_&&Set.prototype.forEach,Fte=typeof WeakMap=="function"&&WeakMap.prototype,tf=Fte?WeakMap.prototype.has:null,Mte=typeof WeakSet=="function"&&WeakSet.prototype,rf=Mte?WeakSet.prototype.has:null,Ute=typeof WeakRef=="function"&&WeakRef.prototype,uF=Ute?WeakRef.prototype.deref:null,qte=Boolean.prototype.valueOf,Vte=Object.prototype.toString,Hte=Function.prototype.toString,kte=String.prototype.match,r_=String.prototype.slice,ds=String.prototype.replace,Gte=String.prototype.toUpperCase,cF=String.prototype.toLowerCase,wF=RegExp.prototype.test,lF=Array.prototype.concat,qn=Array.prototype.join,jte=Array.prototype.slice,fF=Math.floor,KI=typeof BigInt=="function"?BigInt.prototype.valueOf:null,WI=Object.getOwnPropertySymbols,YI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,bu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",nr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===bu||!0)?Symbol.toStringTag:null,EF=Object.prototype.propertyIsEnumerable,dF=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function hF(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||wF.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-fF(-t):fF(t);if(n!==t){var i=String(n),s=r_.call(e,i.length+1);return ds.call(i,r,"$&_")+"."+ds.call(ds.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ds.call(e,r,"$&_")}var JI=sF(),pF=JI.custom,gF=AF(pF)?pF:null;_F.exports=function t(e,r,n,i){var s=r||{};if(fs(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fs(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=fs(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(fs(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(fs(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 IF(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?hF(e,u):u}if(typeof e=="bigint"){var c=String(e)+"n";return a?hF(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return XI(e)?"[Array]":"[Object]";var d=ure(s,n);if(typeof i>"u")i=[];else if(bF(i,e)>=0)return"[Circular]";function g(j,K,me){if(K&&(i=jte.call(i),i.push(K)),me){var ce={depth:s.depth};return fs(s,"quoteStyle")&&(ce.quoteStyle=s.quoteStyle),t(j,ce,n+1,i)}return t(j,s,n+1,i)}if(typeof e=="function"&&!yF(e)){var m=Zte(e),y=dy(e,g);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(y.length>0?" { "+qn.call(y,", ")+" }":"")}if(AF(e)){var b=bu?ds.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):YI.call(e);return typeof e=="object"&&!bu?ef(b):b}if(sre(e)){for(var O="<"+cF.call(String(e.nodeName)),R=e.attributes||[],z=0;z",O}if(XI(e)){if(e.length===0)return"[]";var M=dy(e,g);return d&&!are(M)?"["+ZI(M,d)+"]":"[ "+qn.call(M,", ")+" ]"}if(Wte(e)){var E=dy(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!EF.call(e,"cause")?"{ ["+String(e)+"] "+qn.call(lF.call("[cause]: "+g(e.cause),E),", ")+" }":E.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+qn.call(E,", ")+" }"}if(typeof e=="object"&&o){if(gF&&typeof e[gF]=="function"&&JI)return JI(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ere(e)){var S=[];return oF&&oF.call(e,function(j,K){S.push(g(K,e,!0)+" => "+g(j,e))}),mF("Map",hy.call(e),S,d)}if(nre(e)){var N=[];return aF&&aF.call(e,function(j){N.push(g(j,e))}),mF("Set",py.call(e),N,d)}if(tre(e))return $I("WeakMap");if(ire(e))return $I("WeakSet");if(rre(e))return $I("WeakRef");if(Kte(e))return ef(g(Number(e)));if(Jte(e))return ef(g(KI.call(e)));if(Yte(e))return ef(qte.call(e));if($te(e))return ef(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!zte(e)&&!yF(e)){var _=dy(e,g),T=dF?dF(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",X=!T&&nr&&Object(e)===e&&nr in e?r_.call(hs(e),8,-1):B?"Object":"",Q=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=Q+(X||B?"["+qn.call(lF.call([],X||[],B||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+ZI(_,d)+"}":H+"{ "+qn.call(_,", ")+" }"}return String(e)};function vF(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Qte(t){return ds.call(String(t),/"/g,""")}function XI(t){return hs(t)==="[object Array]"&&(!nr||!(typeof t=="object"&&nr in t))}function zte(t){return hs(t)==="[object Date]"&&(!nr||!(typeof t=="object"&&nr in t))}function yF(t){return hs(t)==="[object RegExp]"&&(!nr||!(typeof t=="object"&&nr in t))}function Wte(t){return hs(t)==="[object Error]"&&(!nr||!(typeof t=="object"&&nr in t))}function $te(t){return hs(t)==="[object String]"&&(!nr||!(typeof t=="object"&&nr in t))}function Kte(t){return hs(t)==="[object Number]"&&(!nr||!(typeof t=="object"&&nr in t))}function Yte(t){return hs(t)==="[object Boolean]"&&(!nr||!(typeof t=="object"&&nr in t))}function AF(t){if(bu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!YI)return!1;try{return YI.call(t),!0}catch{}return!1}function Jte(t){if(!t||typeof t!="object"||!KI)return!1;try{return KI.call(t),!0}catch{}return!1}var Xte=Object.prototype.hasOwnProperty||function(t){return t in this};function fs(t,e){return Xte.call(t,e)}function hs(t){return Vte.call(t)}function Zte(t){if(t.name)return t.name;var e=kte.call(Hte.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function bF(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 IF(r_.call(t,0,e.maxStringLength),e)+n}var i=ds.call(ds.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ore);return vF(i,"single",e)}function ore(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":"")+Gte.call(e.toString(16))}function ef(t){return"Object("+t+")"}function $I(t){return t+" { ? }"}function mF(t,e,r,n){var i=n?ZI(r,n):qn.call(r,", ");return t+" ("+e+") {"+i+"}"}function are(t){for(var e=0;e=0)return!1;return!0}function ure(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=qn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:qn.call(Array(e+1),r)}}function ZI(t,e){if(t.length===0)return"";var r=` `+e.prev+e.base;return r+qn.call(t,","+r)+` -`+e.prev}function dy(t,e){var r=$I(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";l();var ZI=cs(),Au=ZL(),Jte=vF(),Xte=ZI("%TypeError%"),gy=ZI("%WeakMap%",!0),yy=ZI("%Map%",!0),Zte=Au("WeakMap.prototype.get",!0),ere=Au("WeakMap.prototype.set",!0),tre=Au("WeakMap.prototype.has",!0),rre=Au("Map.prototype.get",!0),nre=Au("Map.prototype.set",!0),ire=Au("Map.prototype.has",!0),e_=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},sre=function(t,e){var r=e_(t,e);return r&&r.value},ore=function(t,e,r){var n=e_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},are=function(t,e){return!!e_(t,e)};AF.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Xte("Side channel does not contain "+Jte(s))},get:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Zte(e,s)}else if(yy){if(r)return rre(r,s)}else if(n)return sre(n,s)},has:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return tre(e,s)}else if(yy){if(r)return ire(r,s)}else if(n)return are(n,s);return!1},set:function(s,o){gy&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new gy),ere(e,s,o)):yy?(r||(r=new yy),nre(r,s,o)):(n||(n={key:{},next:null}),ore(n,s,o))}};return i}});var my=v((Bme,IF)=>{"use strict";l();var ure=String.prototype.replace,cre=/%20/g,t_={RFC1738:"RFC1738",RFC3986:"RFC3986"};IF.exports={default:t_.RFC3986,formatters:{RFC1738:function(t){return ure.call(t,cre,"+")},RFC3986:function(t){return String(t)}},RFC1738:t_.RFC1738,RFC3986:t_.RFC3986}});var n_=v((Fme,SF)=>{"use strict";l();var lre=my(),r_=Object.prototype.hasOwnProperty,Eo=Array.isArray,Vn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),fre=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Eo(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===lre.RFC1738&&(c===40||c===41)){a+=o.charAt(u);continue}if(c<128){a=a+Vn[c];continue}if(c<2048){a=a+(Vn[192|c>>6]+Vn[128|c&63]);continue}if(c<55296||c>=57344){a=a+(Vn[224|c>>12]+Vn[128|c>>6&63]+Vn[128|c&63]);continue}u+=1,c=65536+((c&1023)<<10|o.charCodeAt(u)&1023),a+=Vn[240|c>>18]+Vn[128|c>>12&63]+Vn[128|c>>6&63]+Vn[128|c&63]}return a},yre=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";l();var xF=bF(),s_=n_(),nf=my(),Are=Object.prototype.hasOwnProperty,TF={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},vo=Array.isArray,bre=String.prototype.split,Ire=Array.prototype.push,NF=function(t,e){Ire.apply(t,vo(e)?e:[e])},_re=Date.prototype.toISOString,CF=nf.default,$t={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:s_.encode,encodeValuesOnly:!1,format:CF,formatter:nf.formatters[CF],indices:!1,serializeDate:function(e){return _re.call(e)},skipNulls:!1,strictNullHandling:!1},Sre=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},i_={},Tre=function t(e,r,n,i,s,o,a,u,c,f,d,g,m,y,A){for(var O=e,R=A,z=0,M=!1;(R=R.get(i_))!==void 0&&!M;){var b=R.get(e);if(z+=1,typeof b<"u"){if(b===z)throw new RangeError("Cyclic object value");M=!0}typeof R.get(i_)>"u"&&(z=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&vo(O)&&(O=s_.maybeMap(O,function(ie){return ie instanceof Date?f(ie):ie})),O===null){if(i)return o&&!m?o(r,$t.encoder,y,"key",d):r;O=""}if(Sre(O)||s_.isBuffer(O)){if(o){var S=m?r:o(r,$t.encoder,y,"key",d);if(n==="comma"&&m){for(var N=bre.call(String(O),","),_="",T=0;T"u")return B;var X;if(n==="comma"&&vo(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(vo(a))X=a;else{var Q=Object.keys(O);X=u?Q.sort(u):Q}for(var H=0;H"u"?$t.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:$t.charsetSentinel,delimiter:typeof e.delimiter>"u"?$t.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:$t.encode,encoder:typeof e.encoder=="function"?e.encoder:$t.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:$t.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:$t.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:$t.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:$t.strictNullHandling}};OF.exports=function(t,e){var r=t,n=Cre(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):vo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in TF?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=TF[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=xF(),f=0;f0?m+g:""}});var BF=v((Vme,RF)=>{"use strict";l();var bu=n_(),o_=Object.prototype.hasOwnProperty,xre=Array.isArray,Gt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:bu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Nre=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},PF=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Ore="utf8=%26%2310003%3B",Dre="utf8=%E2%9C%93",Pre=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,c=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(y=xre(y)?[y]:y),o_.call(n,m)?n[m]=bu.combine(n[m],y):n[m]=y}return n},Rre=function(t,e,r,n){for(var i=n?e:PF(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,c=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(c)&&a!==u&&String(c)===u&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Bre=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),c=u?s.slice(0,u.index):s,f=[];if(c){if(!n.plainObjects&&o_.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Gt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Gt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Gt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Gt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Gt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Gt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Gt.comma,decoder:typeof e.decoder=="function"?e.decoder:Gt.decoder,delimiter:typeof e.delimiter=="string"||bu.isRegExp(e.delimiter)?e.delimiter:Gt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Gt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Gt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Gt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Gt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Gt.strictNullHandling}};RF.exports=function(t,e){var r=Lre(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Pre(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";l();var Fre=DF(),Mre=BF(),Ure=my();LF.exports={formats:Ure,parse:Mre,stringify:Fre}});var a_=v(Ge=>{"use strict";l();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Ge.WALLET_PROVIDER_CALLBACK_PARAM=Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL=Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL=Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL=Ge.WALLET_PROVIDER_DISCONNECT_URL=Ge.WALLET_PROVIDER_CONNECT_URL=Ge.XALIAS_PROVIDER_TESTNET=Ge.XALIAS_PROVIDER_DEVNET=Ge.XALIAS_PROVIDER_MAINNET=Ge.WALLET_PROVIDER_TESTNET=Ge.WALLET_PROVIDER_DEVNET=Ge.WALLET_PROVIDER_MAINNET=void 0;Ge.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";Ge.XALIAS_PROVIDER_MAINNET="https://xalias.com";Ge.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";Ge.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";Ge.WALLET_PROVIDER_CONNECT_URL="hook/login";Ge.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";Ge.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var MF=v(Iu=>{"use strict";l();Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ErrCannotSignedMessage=Iu.ErrCannotGetSignedTransactions=void 0;var u_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};Iu.ErrCannotGetSignedTransactions=u_;var c_=class extends Error{constructor(){super("Cannot get signed message")}};Iu.ErrCannotSignedMessage=c_});var UF=v(wy=>{"use strict";l();Object.defineProperty(wy,"__esModule",{value:!0});wy.PlainSignedTransaction=void 0;var l_=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.signature="",Object.assign(this,e)}};wy.PlainSignedTransaction=l_});var _u=v(gs=>{"use strict";l();var hs=gs&&gs.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},qre=gs&&gs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gs,"__esModule",{value:!0});gs.WalletProvider=void 0;var f_=qre(FF()),ps=a_(),d_=MF(),Vre=UF(),h_=class t{constructor(e){this.walletUrl=e}login(e){return hs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ps.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return hs(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 hs(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return hs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ps.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return hs(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ps.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=f_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new d_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return hs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ps.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return hs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ps.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return hs(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=f_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ps.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ps.WALLET_PROVIDER_CALLBACK_PARAM]===ps.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new d_.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new d_.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let a=t.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}};gs.WalletProvider=h_});var wM=v((Xme,mM)=>{"use strict";l();function YF(t,e){return function(){return t.apply(e,arguments)}}var{toString:Hre}=Object.prototype,{getPrototypeOf:S_}=Object,by=(t=>e=>{let r=Hre.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),kn=t=>(t=t.toLowerCase(),e=>by(e)===t),Iy=t=>e=>typeof e===t,{isArray:xu}=Array,of=Iy("undefined");function kre(t){return t!==null&&!of(t)&&t.constructor!==null&&!of(t.constructor)&&Qr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var JF=kn("ArrayBuffer");function Gre(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&JF(t.buffer),e}var jre=Iy("string"),Qr=Iy("function"),XF=Iy("number"),_y=t=>t!==null&&typeof t=="object",Qre=t=>t===!0||t===!1,Ey=t=>{if(by(t)!=="object")return!1;let e=S_(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},zre=kn("Date"),Wre=kn("File"),$re=kn("Blob"),Kre=kn("FileList"),Yre=t=>_y(t)&&Qr(t.pipe),Jre=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Qr(t.append)&&((e=by(t))==="formdata"||e==="object"&&Qr(t.toString)&&t.toString()==="[object FormData]"))},Xre=kn("URLSearchParams"),Zre=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function af(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),xu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var eM=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,tM=t=>!of(t)&&t!==eM;function w_(){let{caseless:t}=tM(this)&&this||{},e={},r=(n,i)=>{let s=t&&ZF(e,i)||i;Ey(e[s])&&Ey(n)?e[s]=w_(e[s],n):Ey(n)?e[s]=w_({},n):xu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(af(e,(i,s)=>{r&&Qr(i)?t[s]=YF(i,r):t[s]=i},{allOwnKeys:n}),t),tne=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rne=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},nne=(t,e,r,n)=>{let i,s,o,a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&S_(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ine=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},sne=t=>{if(!t)return null;if(xu(t))return t;let e=t.length;if(!XF(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},one=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&S_(Uint8Array)),ane=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},une=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},cne=kn("HTMLFormElement"),lne=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),qF=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),fne=kn("RegExp"),rM=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};af(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},dne=t=>{rM(t,(e,r)=>{if(Qr(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(Qr(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},hne=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return xu(t)?n(t):n(String(t).split(e)),r},pne=()=>{},gne=(t,e)=>(t=+t,Number.isFinite(t)?t:e),p_="abcdefghijklmnopqrstuvwxyz",VF="0123456789",nM={DIGIT:VF,ALPHA:p_,ALPHA_DIGIT:p_+p_.toUpperCase()+VF},yne=(t=16,e=nM.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function mne(t){return!!(t&&Qr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var wne=t=>{let e=new Array(10),r=(n,i)=>{if(_y(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=xu(n)?[]:{};return af(n,(o,a)=>{let u=r(o,i+1);!of(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},Ene=kn("AsyncFunction"),vne=t=>t&&(_y(t)||Qr(t))&&Qr(t.then)&&Qr(t.catch),Y={isArray:xu,isArrayBuffer:JF,isBuffer:kre,isFormData:Jre,isArrayBufferView:Gre,isString:jre,isNumber:XF,isBoolean:Qre,isObject:_y,isPlainObject:Ey,isUndefined:of,isDate:zre,isFile:Wre,isBlob:$re,isRegExp:fne,isFunction:Qr,isStream:Yre,isURLSearchParams:Xre,isTypedArray:one,isFileList:Kre,forEach:af,merge:w_,extend:ene,trim:Zre,stripBOM:tne,inherits:rne,toFlatObject:nne,kindOf:by,kindOfTest:kn,endsWith:ine,toArray:sne,forEachEntry:ane,matchAll:une,isHTMLForm:cne,hasOwnProperty:qF,hasOwnProp:qF,reduceDescriptors:rM,freezeMethods:dne,toObjectSet:hne,toCamelCase:lne,noop:pne,toFiniteNumber:gne,findKey:ZF,global:eM,isContextDefined:tM,ALPHABET:nM,generateString:yne,isSpecCompliantForm:mne,toJSONObject:wne,isAsyncFn:Ene,isThenable:vne};function Me(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Y.inherits(Me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Y.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var iM=Me.prototype,sM={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{sM[t]={value:t}});Object.defineProperties(Me,sM);Object.defineProperty(iM,"isAxiosError",{value:!0});Me.from=(t,e,r,n,i,s)=>{let o=Object.create(iM);return Y.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),Me.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var Ane=null;function E_(t){return Y.isPlainObject(t)||Y.isArray(t)}function oM(t){return Y.endsWith(t,"[]")?t.slice(0,-2):t}function HF(t,e,r){return t?t.concat(e).map(function(i,s){return i=oM(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function bne(t){return Y.isArray(t)&&!t.some(E_)}var Ine=Y.toFlatObject(Y,{},null,function(e){return/^is[A-Z]/.test(e)});function Sy(t,e,r){if(!Y.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Y.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(A,O){return!Y.isUndefined(O[A])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Y.isSpecCompliantForm(e);if(!Y.isFunction(i))throw new TypeError("visitor must be a function");function c(y){if(y===null)return"";if(Y.isDate(y))return y.toISOString();if(!u&&Y.isBlob(y))throw new Me("Blob is not supported. Use a Buffer instead.");return Y.isArrayBuffer(y)||Y.isTypedArray(y)?u&&typeof Blob=="function"?new Blob([y]):h.Buffer.from(y):y}function f(y,A,O){let R=y;if(y&&!O&&typeof y=="object"){if(Y.endsWith(A,"{}"))A=n?A:A.slice(0,-2),y=JSON.stringify(y);else if(Y.isArray(y)&&bne(y)||(Y.isFileList(y)||Y.endsWith(A,"[]"))&&(R=Y.toArray(y)))return A=oM(A),R.forEach(function(M,b){!(Y.isUndefined(M)||M===null)&&e.append(o===!0?HF([A],b,s):o===null?A:A+"[]",c(M))}),!1}return E_(y)?!0:(e.append(HF(O,A,s),c(y)),!1)}let d=[],g=Object.assign(Ine,{defaultVisitor:f,convertValue:c,isVisitable:E_});function m(y,A){if(!Y.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+A.join("."));d.push(y),Y.forEach(y,function(R,z){(!(Y.isUndefined(R)||R===null)&&i.call(e,R,Y.isString(z)?z.trim():z,A,g))===!0&&m(R,A?A.concat(z):[z])}),d.pop()}}if(!Y.isObject(t))throw new TypeError("data must be an object");return m(t),e}function kF(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function T_(t,e){this._pairs=[],t&&Sy(t,this,e)}var aM=T_.prototype;aM.append=function(e,r){this._pairs.push([e,r])};aM.toString=function(e){let r=e?function(n){return e.call(this,n,kF)}:kF;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function _ne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function uM(t,e,r){if(!e)return t;let n=r&&r.encode||_ne,i=r&&r.serialize,s;if(i?s=i(e,r):s=Y.isURLSearchParams(e)?e.toString():new T_(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var v_=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Y.forEach(this.handlers,function(n){n!==null&&e(n)})}},GF=v_,cM={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Sne=typeof URLSearchParams<"u"?URLSearchParams:T_,Tne=typeof FormData<"u"?FormData:null,Cne=typeof Blob<"u"?Blob:null,xne={isBrowser:!0,classes:{URLSearchParams:Sne,FormData:Tne,Blob:Cne},protocols:["http","https","file","blob","url","data"]},lM=typeof window<"u"&&typeof document<"u",Nne=(t=>lM&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),One=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dne=Object.freeze({__proto__:null,hasBrowserEnv:lM,hasStandardBrowserWebWorkerEnv:One,hasStandardBrowserEnv:Nne}),Hn={...Dne,...xne};function Pne(t,e){return Sy(t,new Hn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Hn.isNode&&Y.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Rne(t){return Y.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Bne(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&Y.isArray(i)?i.length:o,u?(Y.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Y.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Y.isArray(i[o])&&(i[o]=Bne(i[o])),!a)}if(Y.isFormData(t)&&Y.isFunction(t.entries)){let r={};return Y.forEachEntry(t,(n,i)=>{e(Rne(n),i,r,0)}),r}return null}function Lne(t,e,r){if(Y.isString(t))try{return(e||JSON.parse)(t),Y.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var C_={transitional:cM,adapter:["xhr","http"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Y.isObject(e);if(s&&Y.isHTMLForm(e)&&(e=new FormData(e)),Y.isFormData(e))return i&&i?JSON.stringify(fM(e)):e;if(Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e))return e;if(Y.isArrayBufferView(e))return e.buffer;if(Y.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Pne(e,this.formSerializer).toString();if((a=Y.isFileList(e))||n.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return Sy(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Lne(e)):e}],transformResponse:[function(e){let r=this.transitional||C_.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&Y.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Me.from(a,Me.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hn.classes.FormData,Blob:Hn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(["delete","get","head","post","put","patch"],t=>{C_.headers[t]={}});var x_=C_,Fne=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Mne=t=>{let e={},r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&Fne[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},jF=Symbol("internals");function sf(t){return t&&String(t).trim().toLowerCase()}function vy(t){return t===!1||t==null?t:Y.isArray(t)?t.map(vy):String(t)}function Une(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var qne=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function g_(t,e,r,n,i){if(Y.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Y.isString(e)){if(Y.isString(n))return e.indexOf(n)!==-1;if(Y.isRegExp(n))return n.test(e)}}function Vne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Hne(t,e){let r=Y.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Su=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(a,u,c){let f=sf(u);if(!f)throw new Error("header name must be a non-empty string");let d=Y.findKey(i,f);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||u]=vy(a))}let o=(a,u)=>Y.forEach(a,(c,f)=>s(c,f,u));return Y.isPlainObject(e)||e instanceof this.constructor?o(e,r):Y.isString(e)&&(e=e.trim())&&!qne(e)?o(Mne(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return Une(i);if(Y.isFunction(r))return r.call(this,i,n);if(Y.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||g_(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=sf(o),o){let a=Y.findKey(n,o);a&&(!r||g_(n,n[a],a,r))&&(delete n[a],i=!0)}}return Y.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||g_(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return Y.forEach(this,(i,s)=>{let o=Y.findKey(n,s);if(o){r[o]=vy(i),delete r[s];return}let a=e?Vne(s):String(s).trim();a!==s&&delete r[s],r[a]=vy(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return Y.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Y.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[jF]=this[jF]={accessors:{}}).accessors,i=this.prototype;function s(o){let a=sf(o);n[a]||(Hne(i,o),n[a]=!0)}return Y.isArray(e)?e.forEach(s):s(e),this}};Su.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Y.reduceDescriptors(Su.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});Y.freezeMethods(Su);var yi=Su;function y_(t,e){let r=this||x_,n=e||r,i=yi.from(n.headers),s=n.data;return Y.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function dM(t){return!!(t&&t.__CANCEL__)}function uf(t,e,r){Me.call(this,t??"canceled",Me.ERR_CANCELED,e,r),this.name="CanceledError"}Y.inherits(uf,Me,{__CANCEL__:!0});function kne(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Me("Request failed with status code "+r.status,[Me.ERR_BAD_REQUEST,Me.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var Gne=Hn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];Y.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&o.push("path="+n),Y.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function jne(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Qne(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function hM(t,e){return t&&!jne(e)?Qne(t,e):e}var zne=Hn.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let a=Y.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function Wne(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function $ne(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){let c=Date.now(),f=n[s];o||(o=c),r[i]=u,n[i]=c;let d=s,g=0;for(;d!==i;)g+=r[d++],d=d%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o{let s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,u=n(a),c=s<=o;r=s;let f={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&c?(o-s)/u:void 0,event:i};f[e?"download":"upload"]=!0,t(f)}}var Kne=typeof XMLHttpRequest<"u",Yne=Kne&&function(t){return new Promise(function(r,n){let i=t.data,s=yi.from(t.headers).normalize(),{responseType:o,withXSRFToken:a}=t,u;function c(){t.cancelToken&&t.cancelToken.unsubscribe(u),t.signal&&t.signal.removeEventListener("abort",u)}let f;if(Y.isFormData(i)){if(Hn.hasStandardBrowserEnv||Hn.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((f=s.getContentType())!==!1){let[A,...O]=f?f.split(";").map(R=>R.trim()).filter(Boolean):[];s.setContentType([A||"multipart/form-data",...O].join("; "))}}let d=new XMLHttpRequest;if(t.auth){let A=t.auth.username||"",O=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(A+":"+O))}let g=hM(t.baseURL,t.url);d.open(t.method.toUpperCase(),uM(g,t.params,t.paramsSerializer),!0),d.timeout=t.timeout;function m(){if(!d)return;let A=yi.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),R={data:!o||o==="text"||o==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:A,config:t,request:d};kne(function(M){r(M),c()},function(M){n(M),c()},R),d=null}if("onloadend"in d?d.onloadend=m:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(m)},d.onabort=function(){d&&(n(new Me("Request aborted",Me.ECONNABORTED,t,d)),d=null)},d.onerror=function(){n(new Me("Network Error",Me.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let O=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",R=t.transitional||cM;t.timeoutErrorMessage&&(O=t.timeoutErrorMessage),n(new Me(O,R.clarifyTimeoutError?Me.ETIMEDOUT:Me.ECONNABORTED,t,d)),d=null},Hn.hasStandardBrowserEnv&&(a&&Y.isFunction(a)&&(a=a(t)),a||a!==!1&&zne(g))){let A=t.xsrfHeaderName&&t.xsrfCookieName&&Gne.read(t.xsrfCookieName);A&&s.set(t.xsrfHeaderName,A)}i===void 0&&s.setContentType(null),"setRequestHeader"in d&&Y.forEach(s.toJSON(),function(O,R){d.setRequestHeader(R,O)}),Y.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),o&&o!=="json"&&(d.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&d.addEventListener("progress",QF(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",QF(t.onUploadProgress)),(t.cancelToken||t.signal)&&(u=A=>{d&&(n(!A||A.type?new uf(null,t,d):A),d.abort(),d=null)},t.cancelToken&&t.cancelToken.subscribe(u),t.signal&&(t.signal.aborted?u():t.signal.addEventListener("abort",u)));let y=Wne(g);if(y&&Hn.protocols.indexOf(y)===-1){n(new Me("Unsupported protocol "+y+":",Me.ERR_BAD_REQUEST,t));return}d.send(i||null)})},A_={http:Ane,xhr:Yne};Y.forEach(A_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var zF=t=>`- ${t}`,Jne=t=>Y.isFunction(t)||t===null||t===!1,pM={getAdapter:t=>{t=Y.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : -`+s.map(zF).join(` -`):" "+zF(s[0]):"as no adapter specified";throw new Me("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:A_};function m_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new uf(null,t)}function WF(t){return m_(t),t.headers=yi.from(t.headers),t.data=y_.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),pM.getAdapter(t.adapter||x_.adapter)(t).then(function(n){return m_(t),n.data=y_.call(t,t.transformResponse,n),n.headers=yi.from(n.headers),n},function(n){return dM(n)||(m_(t),n&&n.response&&(n.response.data=y_.call(t,t.transformResponse,n.response),n.response.headers=yi.from(n.response.headers))),Promise.reject(n)})}var $F=t=>t instanceof yi?t.toJSON():t;function Tu(t,e){e=e||{};let r={};function n(c,f,d){return Y.isPlainObject(c)&&Y.isPlainObject(f)?Y.merge.call({caseless:d},c,f):Y.isPlainObject(f)?Y.merge({},f):Y.isArray(f)?f.slice():f}function i(c,f,d){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c,d)}else return n(c,f,d)}function s(c,f){if(!Y.isUndefined(f))return n(void 0,f)}function o(c,f){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c)}else return n(void 0,f)}function a(c,f,d){if(d in e)return n(c,f);if(d in t)return n(void 0,c)}let u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,f)=>i($F(c),$F(f),!0)};return Y.forEach(Object.keys(Object.assign({},t,e)),function(f){let d=u[f]||i,g=d(t[f],e[f],f);Y.isUndefined(g)&&d!==a||(r[f]=g)}),r}var gM="1.6.5",N_={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{N_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var KF={};N_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+gM+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new Me(i(o," has been removed"+(r?" in "+r:"")),Me.ERR_DEPRECATED);return r&&!KF[o]&&(KF[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Xne(t,e,r){if(typeof t!="object")throw new Me("options must be an object",Me.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new Me("option "+s+" must be "+u,Me.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Me("Unknown option "+s,Me.ERR_BAD_OPTION)}}var b_={assertOptions:Xne,validators:N_},ys=b_.validators,Cu=class{constructor(e){this.defaults=e,this.interceptors={request:new GF,response:new GF}}request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Tu(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&b_.assertOptions(n,{silentJSONParsing:ys.transitional(ys.boolean),forcedJSONParsing:ys.transitional(ys.boolean),clarifyTimeoutError:ys.transitional(ys.boolean)},!1),i!=null&&(Y.isFunction(i)?r.paramsSerializer={serialize:i}:b_.assertOptions(i,{encode:ys.function,serialize:ys.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Y.merge(s.common,s[r.method]);s&&Y.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),r.headers=yi.concat(o,s);let a=[],u=!0;this.interceptors.request.forEach(function(A){typeof A.runWhen=="function"&&A.runWhen(r)===!1||(u=u&&A.synchronous,a.unshift(A.fulfilled,A.rejected))});let c=[];this.interceptors.response.forEach(function(A){c.push(A.fulfilled,A.rejected)});let f,d=0,g;if(!u){let y=[WF.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,c),g=y.length,f=Promise.resolve(r);d{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new uf(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Zne=I_;function eie(t){return function(r){return t.apply(null,r)}}function tie(t){return Y.isObject(t)&&t.isAxiosError===!0}var __={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(__).forEach(([t,e])=>{__[e]=t});var rie=__;function yM(t){let e=new Ay(t),r=YF(Ay.prototype.request,e);return Y.extend(r,Ay.prototype,e,{allOwnKeys:!0}),Y.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return yM(Tu(t,i))},r}var Rt=yM(x_);Rt.Axios=Ay;Rt.CanceledError=uf;Rt.CancelToken=Zne;Rt.isCancel=dM;Rt.VERSION=gM;Rt.toFormData=Sy;Rt.AxiosError=Me;Rt.Cancel=Rt.CanceledError;Rt.all=function(e){return Promise.all(e)};Rt.spread=eie;Rt.isAxiosError=tie;Rt.mergeConfig=Tu;Rt.AxiosHeaders=yi;Rt.formToJSON=t=>fM(Y.isHTMLForm(t)?new FormData(t):t);Rt.getAdapter=pM.getAdapter;Rt.HttpStatusCode=rie;Rt.default=Rt;mM.exports=Rt});var EM=v(Ty=>{"use strict";l();Object.defineProperty(Ty,"__esModule",{value:!0});Ty.NativeAuthClientConfig=void 0;var O_=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Ty.NativeAuthClientConfig=O_});var P_=v(Nu=>{"use strict";l();var Ao=Nu&&Nu.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.NativeAuthClient=void 0;var nie=wM(),iie=EM(),D_=class{constructor(e){this.config=Object.assign(new iie.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Ao(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return Ao(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Ao(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return Ao(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return Ao(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return Ao(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(h.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return Ao(this,void 0,void 0,function*(){return yield nie.default.get(e,{headers:this.config.extraRequestHeaders})})}};Nu.NativeAuthClient=D_});var _M=v(Oy=>{"use strict";l();Object.defineProperty(Oy,"__esModule",{value:!0});Oy.TransactionStatus=void 0;var R_=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("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}};Oy.TransactionStatus=R_});var Pu=v(jt=>{"use strict";l();var sie=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]}),oie=jt&&jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aie=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)&&sie(e,t,r);return oie(e,t),e};Object.defineProperty(jt,"__esModule",{value:!0});jt.zeroPadStringIfOddLength=jt.isPaddedHex=jt.numberToPaddedHex=jt.Nonce=jt.Address=void 0;var SM=aie(rw()),uie="erd",B_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=SM.toWords(e),n=SM.encode(uie,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};jt.Address=B_;var L_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return TM(this.value)}};jt.Nonce=L_;function TM(t){let e=t.toString(16);return CM(e)}jt.numberToPaddedHex=TM;function cie(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}jt.isPaddedHex=cie;function CM(t){return t=t||"",t.length%2==1?"0"+t:t}jt.zeroPadStringIfOddLength=CM});var NM=v(Dy=>{"use strict";l();Object.defineProperty(Dy,"__esModule",{value:!0});Dy.TransactionReceipt=void 0;var xM=Pu(),F_=class t{constructor(){this.value="",this.sender=new xM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new xM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Dy.TransactionReceipt=F_});var OM=v(Gn=>{"use strict";l();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ErrContractQuery=Gn.ErrNetworkProvider=Gn.ErrUnexpectedCondition=Gn.Err=void 0;var Ru=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Gn.Err=Ru;var M_=class extends Ru{constructor(e){super(`Unexpected condition: [${e}]`)}};Gn.ErrUnexpectedCondition=M_;var U_=class extends Ru{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Gn.ErrNetworkProvider=U_;var q_=class extends Ru{constructor(e){super(e.message.replace("executeQuery:",""))}};Gn.ErrContractQuery=q_});var PM=v(ms=>{"use strict";l();Object.defineProperty(ms,"__esModule",{value:!0});ms.TransactionEventTopic=ms.TransactionEventData=ms.TransactionEvent=void 0;var DM=Pu(),V_=class t{constructor(e){this.address=new DM.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new Bu(h.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new DM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Py(n)),r.dataPayload=Bu.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(Bu.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};ms.TransactionEvent=V_;var Bu=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(h.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ms.TransactionEventData=Bu;var Py=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}};ms.TransactionEventTopic=Py});var k_=v(Ry=>{"use strict";l();Object.defineProperty(Ry,"__esModule",{value:!0});Ry.TransactionLogs=void 0;var lie=OM(),RM=Pu(),fie=PM(),H_=class t{constructor(e){this.address=new RM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new RM.Address(e.address),r.events=(e.events||[]).map(n=>fie.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new lie.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}};Ry.TransactionLogs=H_});var LM=v(Lu=>{"use strict";l();Object.defineProperty(Lu,"__esModule",{value:!0});Lu.ContractResultItem=Lu.ContractResults=void 0;var BM=k_(),By=Pu(),G_=class t{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=>cf.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>cf.fromApiHttpResponse(n));return new t(r)}};Lu.ContractResults=G_;var cf=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new By.Address(""),this.sender=new By.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new BM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new By.Address(e.receiver),r.sender=new By.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=BM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Lu.ContractResultItem=cf});var FM=v(ws=>{"use strict";l();var die=ws&&ws.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ws,"__esModule",{value:!0});ws.EsdtContractAddress=ws.MaxUint64AsBigNumber=void 0;var hie=die(Yt()),pie=Pu();ws.MaxUint64AsBigNumber=new hie.default("18446744073709551615");ws.EsdtContractAddress=new pie.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var MM=v(Fu=>{"use strict";l();var gie=Fu&&Fu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ContractQueryResponse=void 0;var yie=gie(Yt()),mie=FM(),j_=class t{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 yie.default(e.gasRemaining||e.GasRemaining||0),o=mie.MaxUint64AsBigNumber.minus(s).toNumber();return new t({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()}}};Fu.ContractQueryResponse=j_});var UM=v(Ly=>{"use strict";l();Object.defineProperty(Ly,"__esModule",{value:!0});Ly.ContractQueryRequest=void 0;var Q_=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}};Ly.ContractQueryRequest=Q_});var $M=v((cEe,WM)=>{l();WM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Es=v(bo=>{l();var z_,wie=[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];bo.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};bo.getSymbolTotalCodewords=function(e){return wie[e]};bo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};bo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');z_=e};bo.isKanjiModeEnabled=function(){return typeof z_<"u"};bo.toSJIS=function(e){return z_(e)}});var Uy=v(zr=>{l();zr.L={bit:1};zr.M={bit:0};zr.Q={bit:3};zr.H={bit:2};function Eie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return zr.L;case"m":case"medium":return zr.M;case"q":case"quartile":return zr.Q;case"h":case"high":return zr.H;default:throw new Error("Unknown EC Level: "+t)}}zr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};zr.from=function(e,r){if(zr.isValid(e))return e;try{return Eie(e)}catch{return r}}});var JM=v((gEe,YM)=>{l();function KM(){this.buffer=[],this.length=0}KM.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++}};YM.exports=KM});var ZM=v((mEe,XM)=>{l();function lf(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)}lf.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};lf.prototype.get=function(t,e){return this.data[t*this.size+e]};lf.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};lf.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};XM.exports=lf});var eU=v(qy=>{l();var vie=Es().getSymbolSize;qy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=vie(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{l();var Aie=Es().getSymbolSize,tU=7;rU.getPositions=function(e){let r=Aie(e);return[[0,0],[r-tU,0],[0,r-tU]]}});var iU=v(nt=>{l();nt.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Io={N1:3,N2:3,N3:40,N4:10};nt.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};nt.from=function(e){return nt.isValid(e)?parseInt(e,10):void 0};nt.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Io.N1+(i-5)),o=f,i=1),f=e.get(c,u),f===a?s++:(s>=5&&(n+=Io.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Io.N1+(i-5)),s>=5&&(n+=Io.N1+(s-5))}return n};nt.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*Io.N3};nt.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{l();var vs=Uy(),Vy=[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],Hy=[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];W_.getBlocksCount=function(e,r){switch(r){case vs.L:return Vy[(e-1)*4+0];case vs.M:return Vy[(e-1)*4+1];case vs.Q:return Vy[(e-1)*4+2];case vs.H:return Vy[(e-1)*4+3];default:return}};W_.getTotalCodewordsCount=function(e,r){switch(r){case vs.L:return Hy[(e-1)*4+0];case vs.M:return Hy[(e-1)*4+1];case vs.Q:return Hy[(e-1)*4+2];case vs.H:return Hy[(e-1)*4+3];default:return}}});var sU=v(Gy=>{l();var ff=new Uint8Array(512),ky=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ff[r]=e,ky[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ff[r]=ff[r-255]})();Gy.log=function(e){if(e<1)throw new Error("log("+e+")");return ky[e]};Gy.exp=function(e){return ff[e]};Gy.mul=function(e,r){return e===0||r===0?0:ff[ky[e]+ky[r]]}});var oU=v(df=>{l();var K_=sU();df.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{l();var aU=oU();function Y_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}Y_.prototype.initialize=function(e){this.degree=e,this.genPoly=aU.generateECPolynomial(this.degree)};Y_.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=aU.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};uU.exports=Y_});var J_=v(lU=>{l();lU.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var X_=v(wi=>{l();var fU="[0-9]+",Iie="[A-Z $%*+\\-./:]+",hf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";hf=hf.replace(/u/g,"\\u");var _ie="(?:(?![A-Z0-9 $%*+\\-./:]|"+hf+`)(?:.|[\r -]))+`;wi.KANJI=new RegExp(hf,"g");wi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");wi.BYTE=new RegExp(_ie,"g");wi.NUMERIC=new RegExp(fU,"g");wi.ALPHANUMERIC=new RegExp(Iie,"g");var Sie=new RegExp("^"+hf+"$"),Tie=new RegExp("^"+fU+"$"),Cie=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");wi.testKanji=function(e){return Sie.test(e)};wi.testNumeric=function(e){return Tie.test(e)};wi.testAlphanumeric=function(e){return Cie.test(e)}});var As=v(Bt=>{l();var xie=J_(),Z_=X_();Bt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Bt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Bt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Bt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Bt.MIXED={bit:-1};Bt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!xie.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Bt.getBestModeForData=function(e){return Z_.testNumeric(e)?Bt.NUMERIC:Z_.testAlphanumeric(e)?Bt.ALPHANUMERIC:Z_.testKanji(e)?Bt.KANJI:Bt.BYTE};Bt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Bt.isValid=function(e){return e&&e.bit&&e.ccBits};function Nie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Bt.NUMERIC;case"alphanumeric":return Bt.ALPHANUMERIC;case"kanji":return Bt.KANJI;case"byte":return Bt.BYTE;default:throw new Error("Unknown mode: "+t)}}Bt.from=function(e,r){if(Bt.isValid(e))return e;try{return Nie(e)}catch{return r}}});var yU=v(_o=>{l();var jy=Es(),Oie=$_(),dU=Uy(),bs=As(),eS=J_(),pU=7973,hU=jy.getBCHDigit(pU);function Die(t,e,r){for(let n=1;n<=40;n++)if(e<=_o.getCapacity(n,r,t))return n}function gU(t,e){return bs.getCharCountIndicator(t,e)+4}function Pie(t,e){let r=0;return t.forEach(function(n){let i=gU(n.mode,e);r+=i+n.getBitsLength()}),r}function Rie(t,e){for(let r=1;r<=40;r++)if(Pie(t,r)<=_o.getCapacity(r,e,bs.MIXED))return r}_o.from=function(e,r){return eS.isValid(e)?parseInt(e,10):r};_o.getCapacity=function(e,r,n){if(!eS.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=bs.BYTE);let i=jy.getSymbolTotalCodewords(e),s=Oie.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===bs.MIXED)return o;let a=o-gU(n,e);switch(n){case bs.NUMERIC:return Math.floor(a/10*3);case bs.ALPHANUMERIC:return Math.floor(a/11*2);case bs.KANJI:return Math.floor(a/13);case bs.BYTE:default:return Math.floor(a/8)}};_o.getBestVersionForData=function(e,r){let n,i=dU.from(r,dU.M);if(Array.isArray(e)){if(e.length>1)return Rie(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Die(n.mode,n.getLength(),i)};_o.getEncodedBits=function(e){if(!eS.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;jy.getBCHDigit(r)-hU>=0;)r^=pU<{l();var tS=Es(),wU=1335,Bie=21522,mU=tS.getBCHDigit(wU);EU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;tS.getBCHDigit(i)-mU>=0;)i^=wU<{l();var Lie=As();function Mu(t){this.mode=Lie.NUMERIC,this.data=t.toString()}Mu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Mu.prototype.getLength=function(){return this.data.length};Mu.prototype.getBitsLength=function(){return Mu.getBitsLength(this.data.length)};Mu.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))};AU.exports=Mu});var _U=v((QEe,IU)=>{l();var Fie=As(),rS=["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 Uu(t){this.mode=Fie.ALPHANUMERIC,this.data=t}Uu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Uu.prototype.getLength=function(){return this.data.length};Uu.prototype.getBitsLength=function(){return Uu.getBitsLength(this.data.length)};Uu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=rS.indexOf(this.data[r])*45;n+=rS.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(rS.indexOf(this.data[r]),6)};IU.exports=Uu});var TU=v((WEe,SU)=>{"use strict";l();SU.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 xU=v((KEe,CU)=>{l();var Mie=TU(),Uie=As();function qu(t){this.mode=Uie.BYTE,typeof t=="string"&&(t=Mie(t)),this.data=new Uint8Array(t)}qu.getBitsLength=function(e){return e*8};qu.prototype.getLength=function(){return this.data.length};qu.prototype.getBitsLength=function(){return qu.getBitsLength(this.data.length)};qu.prototype.write=function(t){for(let e=0,r=this.data.length;e{l();var qie=As(),Vie=Es();function Vu(t){this.mode=qie.KANJI,this.data=t}Vu.getBitsLength=function(e){return e*13};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.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)}};NU.exports=Vu});var DU=v((ZEe,nS)=>{"use strict";l();var pf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=pf.PriorityQueue.make();s.push(e,0);for(var o,a,u,c,f,d,g,m,y;!s.empty();){o=s.pop(),a=o.value,c=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=c+d,m=i[u],y=typeof i[u]>"u",(y||m>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var A=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(A)}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=pf.single_source_shortest_paths(t,e,r);return pf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=pf.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 nS<"u"&&(nS.exports=pf)});var qU=v(Hu=>{l();var je=As(),BU=bU(),LU=_U(),FU=xU(),MU=OU(),gf=X_(),Qy=Es(),Hie=DU();function PU(t){return unescape(encodeURIComponent(t)).length}function yf(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 UU(t){let e=yf(gf.NUMERIC,je.NUMERIC,t),r=yf(gf.ALPHANUMERIC,je.ALPHANUMERIC,t),n,i;return Qy.isKanjiModeEnabled()?(n=yf(gf.BYTE,je.BYTE,t),i=yf(gf.KANJI,je.KANJI,t)):(n=yf(gf.BYTE_KANJI,je.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 iS(t,e){switch(e){case je.NUMERIC:return BU.getBitsLength(t);case je.ALPHANUMERIC:return LU.getBitsLength(t);case je.KANJI:return MU.getBitsLength(t);case je.BYTE:return FU.getBitsLength(t)}}function kie(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 Gie(t){let e=[];for(let r=0;r{l();var Wy=Es(),sS=Uy(),Qie=JM(),zie=ZM(),Wie=eU(),$ie=nU(),uS=iU(),cS=$_(),Kie=cU(),zy=yU(),Yie=vU(),Jie=As(),oS=qU();function Xie(t,e){let r=t.size,n=$ie.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 Zie(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 aS(t,e,r){let n=t.size,i=Yie.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 rse(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 c=!1;o>>s&1)===1),t.set(i,a-u,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function nse(t,e,r){let n=new Qie;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Jie.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Wy.getSymbolTotalCodewords(t),s=cS.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";l();var n_=ls(),Iu=iF(),cre=SF(),lre=n_("%TypeError%"),gy=n_("%WeakMap%",!0),yy=n_("%Map%",!0),fre=Iu("WeakMap.prototype.get",!0),dre=Iu("WeakMap.prototype.set",!0),hre=Iu("WeakMap.prototype.has",!0),pre=Iu("Map.prototype.get",!0),gre=Iu("Map.prototype.set",!0),yre=Iu("Map.prototype.has",!0),i_=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},mre=function(t,e){var r=i_(t,e);return r&&r.value},wre=function(t,e,r){var n=i_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Ere=function(t,e){return!!i_(t,e)};TF.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new lre("Side channel does not contain "+cre(s))},get:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return fre(e,s)}else if(yy){if(r)return pre(r,s)}else if(n)return mre(n,s)},has:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return hre(e,s)}else if(yy){if(r)return yre(r,s)}else if(n)return Ere(n,s);return!1},set:function(s,o){gy&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new gy),dre(e,s,o)):yy?(r||(r=new yy),gre(r,s,o)):(n||(n={key:{},next:null}),wre(n,s,o))}};return i}});var my=A((Qme,xF)=>{"use strict";l();var vre=String.prototype.replace,Are=/%20/g,s_={RFC1738:"RFC1738",RFC3986:"RFC3986"};xF.exports={default:s_.RFC3986,formatters:{RFC1738:function(t){return vre.call(t,Are,"+")},RFC3986:function(t){return String(t)}},RFC1738:s_.RFC1738,RFC3986:s_.RFC3986}});var a_=A((Wme,OF)=>{"use strict";l();var bre=my(),o_=Object.prototype.hasOwnProperty,Eo=Array.isArray,Vn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Ire=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Eo(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===bre.RFC1738&&(c===40||c===41)){a+=o.charAt(u);continue}if(c<128){a=a+Vn[c];continue}if(c<2048){a=a+(Vn[192|c>>6]+Vn[128|c&63]);continue}if(c<55296||c>=57344){a=a+(Vn[224|c>>12]+Vn[128|c>>6&63]+Vn[128|c&63]);continue}u+=1,c=65536+((c&1023)<<10|o.charCodeAt(u)&1023),a+=Vn[240|c>>18]+Vn[128|c>>12&63]+Vn[128|c>>6&63]+Vn[128|c&63]}return a},xre=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";l();var RF=CF(),c_=a_(),nf=my(),Rre=Object.prototype.hasOwnProperty,DF={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},vo=Array.isArray,Bre=String.prototype.split,Lre=Array.prototype.push,BF=function(t,e){Lre.apply(t,vo(e)?e:[e])},Fre=Date.prototype.toISOString,PF=nf.default,$t={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:c_.encode,encodeValuesOnly:!1,format:PF,formatter:nf.formatters[PF],indices:!1,serializeDate:function(e){return Fre.call(e)},skipNulls:!1,strictNullHandling:!1},Mre=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},u_={},Ure=function t(e,r,n,i,s,o,a,u,c,f,d,g,m,y,b){for(var O=e,R=b,z=0,M=!1;(R=R.get(u_))!==void 0&&!M;){var E=R.get(e);if(z+=1,typeof E<"u"){if(E===z)throw new RangeError("Cyclic object value");M=!0}typeof R.get(u_)>"u"&&(z=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&vo(O)&&(O=c_.maybeMap(O,function(ie){return ie instanceof Date?f(ie):ie})),O===null){if(i)return o&&!m?o(r,$t.encoder,y,"key",d):r;O=""}if(Mre(O)||c_.isBuffer(O)){if(o){var S=m?r:o(r,$t.encoder,y,"key",d);if(n==="comma"&&m){for(var N=Bre.call(String(O),","),_="",T=0;T"u")return B;var X;if(n==="comma"&&vo(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(vo(a))X=a;else{var Q=Object.keys(O);X=u?Q.sort(u):Q}for(var H=0;H"u"?$t.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:$t.charsetSentinel,delimiter:typeof e.delimiter>"u"?$t.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:$t.encode,encoder:typeof e.encoder=="function"?e.encoder:$t.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:$t.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:$t.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:$t.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:$t.strictNullHandling}};LF.exports=function(t,e){var r=t,n=qre(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):vo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in DF?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=DF[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=RF(),f=0;f0?m+g:""}});var qF=A((Jme,UF)=>{"use strict";l();var _u=a_(),l_=Object.prototype.hasOwnProperty,Vre=Array.isArray,jt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:_u.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Hre=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},MF=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},kre="utf8=%26%2310003%3B",Gre="utf8=%E2%9C%93",jre=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,c=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(y=Vre(y)?[y]:y),l_.call(n,m)?n[m]=_u.combine(n[m],y):n[m]=y}return n},Qre=function(t,e,r,n){for(var i=n?e:MF(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,c=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(c)&&a!==u&&String(c)===u&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},zre=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),c=u?s.slice(0,u.index):s,f=[];if(c){if(!n.plainObjects&&l_.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?jt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?jt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:jt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:jt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:jt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:jt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:jt.comma,decoder:typeof e.decoder=="function"?e.decoder:jt.decoder,delimiter:typeof e.delimiter=="string"||_u.isRegExp(e.delimiter)?e.delimiter:jt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:jt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:jt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:jt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:jt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:jt.strictNullHandling}};UF.exports=function(t,e){var r=Wre(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?jre(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";l();var $re=FF(),Kre=qF(),Yre=my();VF.exports={formats:Yre,parse:Kre,stringify:$re}});var f_=A(Ge=>{"use strict";l();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Ge.WALLET_PROVIDER_CALLBACK_PARAM=Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL=Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL=Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL=Ge.WALLET_PROVIDER_DISCONNECT_URL=Ge.WALLET_PROVIDER_CONNECT_URL=Ge.XALIAS_PROVIDER_TESTNET=Ge.XALIAS_PROVIDER_DEVNET=Ge.XALIAS_PROVIDER_MAINNET=Ge.WALLET_PROVIDER_TESTNET=Ge.WALLET_PROVIDER_DEVNET=Ge.WALLET_PROVIDER_MAINNET=void 0;Ge.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";Ge.XALIAS_PROVIDER_MAINNET="https://xalias.com";Ge.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";Ge.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";Ge.WALLET_PROVIDER_CONNECT_URL="hook/login";Ge.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";Ge.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var kF=A(Su=>{"use strict";l();Object.defineProperty(Su,"__esModule",{value:!0});Su.ErrCannotSignedMessage=Su.ErrCannotGetSignedTransactions=void 0;var d_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};Su.ErrCannotGetSignedTransactions=d_;var h_=class extends Error{constructor(){super("Cannot get signed message")}};Su.ErrCannotSignedMessage=h_});var GF=A(wy=>{"use strict";l();Object.defineProperty(wy,"__esModule",{value:!0});wy.PlainSignedTransaction=void 0;var p_=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.signature="",Object.assign(this,e)}};wy.PlainSignedTransaction=p_});var Tu=A(ys=>{"use strict";l();var ps=ys&&ys.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},Jre=ys&&ys.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ys,"__esModule",{value:!0});ys.WalletProvider=void 0;var g_=Jre(HF()),gs=f_(),y_=kF(),Xre=GF(),m_=class t{constructor(e){this.walletUrl=e}login(e){return ps(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:gs.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return ps(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 ps(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return ps(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:gs.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return ps(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:gs.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=g_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new y_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return ps(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(gs.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return ps(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(gs.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return ps(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=g_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(gs.WALLET_PROVIDER_CALLBACK_PARAM)&&e[gs.WALLET_PROVIDER_CALLBACK_PARAM]===gs.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new y_.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new y_.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let a=t.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}};ys.WalletProvider=m_});var IM=A((cwe,bM)=>{"use strict";l();function tM(t,e){return function(){return t.apply(e,arguments)}}var{toString:Zre}=Object.prototype,{getPrototypeOf:N_}=Object,by=(t=>e=>{let r=Zre.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),kn=t=>(t=t.toLowerCase(),e=>by(e)===t),Iy=t=>e=>typeof e===t,{isArray:Ou}=Array,of=Iy("undefined");function ene(t){return t!==null&&!of(t)&&t.constructor!==null&&!of(t.constructor)&&Qr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var rM=kn("ArrayBuffer");function tne(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&rM(t.buffer),e}var rne=Iy("string"),Qr=Iy("function"),nM=Iy("number"),_y=t=>t!==null&&typeof t=="object",nne=t=>t===!0||t===!1,Ey=t=>{if(by(t)!=="object")return!1;let e=N_(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ine=kn("Date"),sne=kn("File"),one=kn("Blob"),ane=kn("FileList"),une=t=>_y(t)&&Qr(t.pipe),cne=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Qr(t.append)&&((e=by(t))==="formdata"||e==="object"&&Qr(t.toString)&&t.toString()==="[object FormData]"))},lne=kn("URLSearchParams"),fne=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function af(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var sM=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,oM=t=>!of(t)&&t!==sM;function b_(){let{caseless:t}=oM(this)&&this||{},e={},r=(n,i)=>{let s=t&&iM(e,i)||i;Ey(e[s])&&Ey(n)?e[s]=b_(e[s],n):Ey(n)?e[s]=b_({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(af(e,(i,s)=>{r&&Qr(i)?t[s]=tM(i,r):t[s]=i},{allOwnKeys:n}),t),hne=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),pne=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},gne=(t,e,r,n)=>{let i,s,o,a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&N_(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},yne=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},mne=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!nM(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},wne=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&N_(Uint8Array)),Ene=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},vne=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Ane=kn("HTMLFormElement"),bne=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),jF=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ine=kn("RegExp"),aM=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};af(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},_ne=t=>{aM(t,(e,r)=>{if(Qr(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(Qr(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Sne=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},Tne=()=>{},Cne=(t,e)=>(t=+t,Number.isFinite(t)?t:e),w_="abcdefghijklmnopqrstuvwxyz",QF="0123456789",uM={DIGIT:QF,ALPHA:w_,ALPHA_DIGIT:w_+w_.toUpperCase()+QF},xne=(t=16,e=uM.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function Nne(t){return!!(t&&Qr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var One=t=>{let e=new Array(10),r=(n,i)=>{if(_y(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=Ou(n)?[]:{};return af(n,(o,a)=>{let u=r(o,i+1);!of(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},Dne=kn("AsyncFunction"),Pne=t=>t&&(_y(t)||Qr(t))&&Qr(t.then)&&Qr(t.catch),Y={isArray:Ou,isArrayBuffer:rM,isBuffer:ene,isFormData:cne,isArrayBufferView:tne,isString:rne,isNumber:nM,isBoolean:nne,isObject:_y,isPlainObject:Ey,isUndefined:of,isDate:ine,isFile:sne,isBlob:one,isRegExp:Ine,isFunction:Qr,isStream:une,isURLSearchParams:lne,isTypedArray:wne,isFileList:ane,forEach:af,merge:b_,extend:dne,trim:fne,stripBOM:hne,inherits:pne,toFlatObject:gne,kindOf:by,kindOfTest:kn,endsWith:yne,toArray:mne,forEachEntry:Ene,matchAll:vne,isHTMLForm:Ane,hasOwnProperty:jF,hasOwnProp:jF,reduceDescriptors:aM,freezeMethods:_ne,toObjectSet:Sne,toCamelCase:bne,noop:Tne,toFiniteNumber:Cne,findKey:iM,global:sM,isContextDefined:oM,ALPHABET:uM,generateString:xne,isSpecCompliantForm:Nne,toJSONObject:One,isAsyncFn:Dne,isThenable:Pne};function Me(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Y.inherits(Me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Y.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var cM=Me.prototype,lM={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{lM[t]={value:t}});Object.defineProperties(Me,lM);Object.defineProperty(cM,"isAxiosError",{value:!0});Me.from=(t,e,r,n,i,s)=>{let o=Object.create(cM);return Y.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),Me.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var Rne=null;function I_(t){return Y.isPlainObject(t)||Y.isArray(t)}function fM(t){return Y.endsWith(t,"[]")?t.slice(0,-2):t}function zF(t,e,r){return t?t.concat(e).map(function(i,s){return i=fM(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function Bne(t){return Y.isArray(t)&&!t.some(I_)}var Lne=Y.toFlatObject(Y,{},null,function(e){return/^is[A-Z]/.test(e)});function Sy(t,e,r){if(!Y.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Y.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,O){return!Y.isUndefined(O[b])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Y.isSpecCompliantForm(e);if(!Y.isFunction(i))throw new TypeError("visitor must be a function");function c(y){if(y===null)return"";if(Y.isDate(y))return y.toISOString();if(!u&&Y.isBlob(y))throw new Me("Blob is not supported. Use a Buffer instead.");return Y.isArrayBuffer(y)||Y.isTypedArray(y)?u&&typeof Blob=="function"?new Blob([y]):h.Buffer.from(y):y}function f(y,b,O){let R=y;if(y&&!O&&typeof y=="object"){if(Y.endsWith(b,"{}"))b=n?b:b.slice(0,-2),y=JSON.stringify(y);else if(Y.isArray(y)&&Bne(y)||(Y.isFileList(y)||Y.endsWith(b,"[]"))&&(R=Y.toArray(y)))return b=fM(b),R.forEach(function(M,E){!(Y.isUndefined(M)||M===null)&&e.append(o===!0?zF([b],E,s):o===null?b:b+"[]",c(M))}),!1}return I_(y)?!0:(e.append(zF(O,b,s),c(y)),!1)}let d=[],g=Object.assign(Lne,{defaultVisitor:f,convertValue:c,isVisitable:I_});function m(y,b){if(!Y.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+b.join("."));d.push(y),Y.forEach(y,function(R,z){(!(Y.isUndefined(R)||R===null)&&i.call(e,R,Y.isString(z)?z.trim():z,b,g))===!0&&m(R,b?b.concat(z):[z])}),d.pop()}}if(!Y.isObject(t))throw new TypeError("data must be an object");return m(t),e}function WF(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function O_(t,e){this._pairs=[],t&&Sy(t,this,e)}var dM=O_.prototype;dM.append=function(e,r){this._pairs.push([e,r])};dM.toString=function(e){let r=e?function(n){return e.call(this,n,WF)}:WF;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Fne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function hM(t,e,r){if(!e)return t;let n=r&&r.encode||Fne,i=r&&r.serialize,s;if(i?s=i(e,r):s=Y.isURLSearchParams(e)?e.toString():new O_(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var __=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Y.forEach(this.handlers,function(n){n!==null&&e(n)})}},$F=__,pM={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mne=typeof URLSearchParams<"u"?URLSearchParams:O_,Une=typeof FormData<"u"?FormData:null,qne=typeof Blob<"u"?Blob:null,Vne={isBrowser:!0,classes:{URLSearchParams:Mne,FormData:Une,Blob:qne},protocols:["http","https","file","blob","url","data"]},gM=typeof window<"u"&&typeof document<"u",Hne=(t=>gM&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),kne=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gne=Object.freeze({__proto__:null,hasBrowserEnv:gM,hasStandardBrowserWebWorkerEnv:kne,hasStandardBrowserEnv:Hne}),Hn={...Gne,...Vne};function jne(t,e){return Sy(t,new Hn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Hn.isNode&&Y.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Qne(t){return Y.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function zne(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&Y.isArray(i)?i.length:o,u?(Y.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Y.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Y.isArray(i[o])&&(i[o]=zne(i[o])),!a)}if(Y.isFormData(t)&&Y.isFunction(t.entries)){let r={};return Y.forEachEntry(t,(n,i)=>{e(Qne(n),i,r,0)}),r}return null}function Wne(t,e,r){if(Y.isString(t))try{return(e||JSON.parse)(t),Y.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var D_={transitional:pM,adapter:["xhr","http"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Y.isObject(e);if(s&&Y.isHTMLForm(e)&&(e=new FormData(e)),Y.isFormData(e))return i&&i?JSON.stringify(yM(e)):e;if(Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e))return e;if(Y.isArrayBufferView(e))return e.buffer;if(Y.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return jne(e,this.formSerializer).toString();if((a=Y.isFileList(e))||n.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return Sy(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Wne(e)):e}],transformResponse:[function(e){let r=this.transitional||D_.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&Y.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Me.from(a,Me.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hn.classes.FormData,Blob:Hn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(["delete","get","head","post","put","patch"],t=>{D_.headers[t]={}});var P_=D_,$ne=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Kne=t=>{let e={},r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&$ne[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},KF=Symbol("internals");function sf(t){return t&&String(t).trim().toLowerCase()}function vy(t){return t===!1||t==null?t:Y.isArray(t)?t.map(vy):String(t)}function Yne(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var Jne=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function E_(t,e,r,n,i){if(Y.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Y.isString(e)){if(Y.isString(n))return e.indexOf(n)!==-1;if(Y.isRegExp(n))return n.test(e)}}function Xne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Zne(t,e){let r=Y.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Cu=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(a,u,c){let f=sf(u);if(!f)throw new Error("header name must be a non-empty string");let d=Y.findKey(i,f);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||u]=vy(a))}let o=(a,u)=>Y.forEach(a,(c,f)=>s(c,f,u));return Y.isPlainObject(e)||e instanceof this.constructor?o(e,r):Y.isString(e)&&(e=e.trim())&&!Jne(e)?o(Kne(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return Yne(i);if(Y.isFunction(r))return r.call(this,i,n);if(Y.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||E_(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=sf(o),o){let a=Y.findKey(n,o);a&&(!r||E_(n,n[a],a,r))&&(delete n[a],i=!0)}}return Y.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||E_(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return Y.forEach(this,(i,s)=>{let o=Y.findKey(n,s);if(o){r[o]=vy(i),delete r[s];return}let a=e?Xne(s):String(s).trim();a!==s&&delete r[s],r[a]=vy(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return Y.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Y.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[KF]=this[KF]={accessors:{}}).accessors,i=this.prototype;function s(o){let a=sf(o);n[a]||(Zne(i,o),n[a]=!0)}return Y.isArray(e)?e.forEach(s):s(e),this}};Cu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Y.reduceDescriptors(Cu.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});Y.freezeMethods(Cu);var yi=Cu;function v_(t,e){let r=this||P_,n=e||r,i=yi.from(n.headers),s=n.data;return Y.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function mM(t){return!!(t&&t.__CANCEL__)}function uf(t,e,r){Me.call(this,t??"canceled",Me.ERR_CANCELED,e,r),this.name="CanceledError"}Y.inherits(uf,Me,{__CANCEL__:!0});function eie(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Me("Request failed with status code "+r.status,[Me.ERR_BAD_REQUEST,Me.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var tie=Hn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];Y.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&o.push("path="+n),Y.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function rie(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function nie(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function wM(t,e){return t&&!rie(e)?nie(t,e):e}var iie=Hn.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let a=Y.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function sie(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function oie(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){let c=Date.now(),f=n[s];o||(o=c),r[i]=u,n[i]=c;let d=s,g=0;for(;d!==i;)g+=r[d++],d=d%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o{let s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,u=n(a),c=s<=o;r=s;let f={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&c?(o-s)/u:void 0,event:i};f[e?"download":"upload"]=!0,t(f)}}var aie=typeof XMLHttpRequest<"u",uie=aie&&function(t){return new Promise(function(r,n){let i=t.data,s=yi.from(t.headers).normalize(),{responseType:o,withXSRFToken:a}=t,u;function c(){t.cancelToken&&t.cancelToken.unsubscribe(u),t.signal&&t.signal.removeEventListener("abort",u)}let f;if(Y.isFormData(i)){if(Hn.hasStandardBrowserEnv||Hn.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((f=s.getContentType())!==!1){let[b,...O]=f?f.split(";").map(R=>R.trim()).filter(Boolean):[];s.setContentType([b||"multipart/form-data",...O].join("; "))}}let d=new XMLHttpRequest;if(t.auth){let b=t.auth.username||"",O=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(b+":"+O))}let g=wM(t.baseURL,t.url);d.open(t.method.toUpperCase(),hM(g,t.params,t.paramsSerializer),!0),d.timeout=t.timeout;function m(){if(!d)return;let b=yi.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),R={data:!o||o==="text"||o==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:b,config:t,request:d};eie(function(M){r(M),c()},function(M){n(M),c()},R),d=null}if("onloadend"in d?d.onloadend=m:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(m)},d.onabort=function(){d&&(n(new Me("Request aborted",Me.ECONNABORTED,t,d)),d=null)},d.onerror=function(){n(new Me("Network Error",Me.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let O=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",R=t.transitional||pM;t.timeoutErrorMessage&&(O=t.timeoutErrorMessage),n(new Me(O,R.clarifyTimeoutError?Me.ETIMEDOUT:Me.ECONNABORTED,t,d)),d=null},Hn.hasStandardBrowserEnv&&(a&&Y.isFunction(a)&&(a=a(t)),a||a!==!1&&iie(g))){let b=t.xsrfHeaderName&&t.xsrfCookieName&&tie.read(t.xsrfCookieName);b&&s.set(t.xsrfHeaderName,b)}i===void 0&&s.setContentType(null),"setRequestHeader"in d&&Y.forEach(s.toJSON(),function(O,R){d.setRequestHeader(R,O)}),Y.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),o&&o!=="json"&&(d.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&d.addEventListener("progress",YF(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",YF(t.onUploadProgress)),(t.cancelToken||t.signal)&&(u=b=>{d&&(n(!b||b.type?new uf(null,t,d):b),d.abort(),d=null)},t.cancelToken&&t.cancelToken.subscribe(u),t.signal&&(t.signal.aborted?u():t.signal.addEventListener("abort",u)));let y=sie(g);if(y&&Hn.protocols.indexOf(y)===-1){n(new Me("Unsupported protocol "+y+":",Me.ERR_BAD_REQUEST,t));return}d.send(i||null)})},S_={http:Rne,xhr:uie};Y.forEach(S_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var JF=t=>`- ${t}`,cie=t=>Y.isFunction(t)||t===null||t===!1,EM={getAdapter:t=>{t=Y.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : +`+s.map(JF).join(` +`):" "+JF(s[0]):"as no adapter specified";throw new Me("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:S_};function A_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new uf(null,t)}function XF(t){return A_(t),t.headers=yi.from(t.headers),t.data=v_.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),EM.getAdapter(t.adapter||P_.adapter)(t).then(function(n){return A_(t),n.data=v_.call(t,t.transformResponse,n),n.headers=yi.from(n.headers),n},function(n){return mM(n)||(A_(t),n&&n.response&&(n.response.data=v_.call(t,t.transformResponse,n.response),n.response.headers=yi.from(n.response.headers))),Promise.reject(n)})}var ZF=t=>t instanceof yi?t.toJSON():t;function xu(t,e){e=e||{};let r={};function n(c,f,d){return Y.isPlainObject(c)&&Y.isPlainObject(f)?Y.merge.call({caseless:d},c,f):Y.isPlainObject(f)?Y.merge({},f):Y.isArray(f)?f.slice():f}function i(c,f,d){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c,d)}else return n(c,f,d)}function s(c,f){if(!Y.isUndefined(f))return n(void 0,f)}function o(c,f){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c)}else return n(void 0,f)}function a(c,f,d){if(d in e)return n(c,f);if(d in t)return n(void 0,c)}let u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,f)=>i(ZF(c),ZF(f),!0)};return Y.forEach(Object.keys(Object.assign({},t,e)),function(f){let d=u[f]||i,g=d(t[f],e[f],f);Y.isUndefined(g)&&d!==a||(r[f]=g)}),r}var vM="1.6.5",R_={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{R_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var eM={};R_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+vM+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new Me(i(o," has been removed"+(r?" in "+r:"")),Me.ERR_DEPRECATED);return r&&!eM[o]&&(eM[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function lie(t,e,r){if(typeof t!="object")throw new Me("options must be an object",Me.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new Me("option "+s+" must be "+u,Me.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Me("Unknown option "+s,Me.ERR_BAD_OPTION)}}var T_={assertOptions:lie,validators:R_},ms=T_.validators,Nu=class{constructor(e){this.defaults=e,this.interceptors={request:new $F,response:new $F}}request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=xu(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&T_.assertOptions(n,{silentJSONParsing:ms.transitional(ms.boolean),forcedJSONParsing:ms.transitional(ms.boolean),clarifyTimeoutError:ms.transitional(ms.boolean)},!1),i!=null&&(Y.isFunction(i)?r.paramsSerializer={serialize:i}:T_.assertOptions(i,{encode:ms.function,serialize:ms.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Y.merge(s.common,s[r.method]);s&&Y.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),r.headers=yi.concat(o,s);let a=[],u=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(u=u&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});let c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let f,d=0,g;if(!u){let y=[XF.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,c),g=y.length,f=Promise.resolve(r);d{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new uf(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},fie=C_;function die(t){return function(r){return t.apply(null,r)}}function hie(t){return Y.isObject(t)&&t.isAxiosError===!0}var x_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(x_).forEach(([t,e])=>{x_[e]=t});var pie=x_;function AM(t){let e=new Ay(t),r=tM(Ay.prototype.request,e);return Y.extend(r,Ay.prototype,e,{allOwnKeys:!0}),Y.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return AM(xu(t,i))},r}var Rt=AM(P_);Rt.Axios=Ay;Rt.CanceledError=uf;Rt.CancelToken=fie;Rt.isCancel=mM;Rt.VERSION=vM;Rt.toFormData=Sy;Rt.AxiosError=Me;Rt.Cancel=Rt.CanceledError;Rt.all=function(e){return Promise.all(e)};Rt.spread=die;Rt.isAxiosError=hie;Rt.mergeConfig=xu;Rt.AxiosHeaders=yi;Rt.formToJSON=t=>yM(Y.isHTMLForm(t)?new FormData(t):t);Rt.getAdapter=EM.getAdapter;Rt.HttpStatusCode=pie;Rt.default=Rt;bM.exports=Rt});var _M=A(Ty=>{"use strict";l();Object.defineProperty(Ty,"__esModule",{value:!0});Ty.NativeAuthClientConfig=void 0;var B_=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Ty.NativeAuthClientConfig=B_});var F_=A(Du=>{"use strict";l();var Ao=Du&&Du.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Du,"__esModule",{value:!0});Du.NativeAuthClient=void 0;var gie=IM(),yie=_M(),L_=class{constructor(e){this.config=Object.assign(new yie.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Ao(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return Ao(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Ao(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return Ao(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return Ao(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return Ao(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(h.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return Ao(this,void 0,void 0,function*(){return yield gie.default.get(e,{headers:this.config.extraRequestHeaders})})}};Du.NativeAuthClient=L_});var OM=A(Ny=>{"use strict";l();Object.defineProperty(Ny,"__esModule",{value:!0});Ny.TransactionStatus=void 0;var U_=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("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}};Ny.TransactionStatus=U_});var PM=A(Oy=>{"use strict";l();Object.defineProperty(Oy,"__esModule",{value:!0});Oy.TransactionReceipt=void 0;var DM=Ta(),q_=class t{constructor(){this.value="",this.sender=new DM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new DM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Oy.TransactionReceipt=q_});var RM=A(Gn=>{"use strict";l();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ErrContractQuery=Gn.ErrNetworkProvider=Gn.ErrUnexpectedCondition=Gn.Err=void 0;var Bu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Gn.Err=Bu;var V_=class extends Bu{constructor(e){super(`Unexpected condition: [${e}]`)}};Gn.ErrUnexpectedCondition=V_;var H_=class extends Bu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Gn.ErrNetworkProvider=H_;var k_=class extends Bu{constructor(e){super(e.message.replace("executeQuery:",""))}};Gn.ErrContractQuery=k_});var LM=A(ws=>{"use strict";l();Object.defineProperty(ws,"__esModule",{value:!0});ws.TransactionEventTopic=ws.TransactionEventData=ws.TransactionEvent=void 0;var BM=Ta(),G_=class t{constructor(e){this.address=new BM.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new Lu(h.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new BM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Dy(n)),r.dataPayload=Lu.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(Lu.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};ws.TransactionEvent=G_;var Lu=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(h.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ws.TransactionEventData=Lu;var Dy=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}};ws.TransactionEventTopic=Dy});var Q_=A(Py=>{"use strict";l();Object.defineProperty(Py,"__esModule",{value:!0});Py.TransactionLogs=void 0;var Eie=RM(),FM=Ta(),vie=LM(),j_=class t{constructor(e){this.address=new FM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new FM.Address(e.address),r.events=(e.events||[]).map(n=>vie.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new Eie.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}};Py.TransactionLogs=j_});var UM=A(Fu=>{"use strict";l();Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ContractResultItem=Fu.ContractResults=void 0;var MM=Q_(),Ry=Ta(),z_=class t{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=>cf.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>cf.fromApiHttpResponse(n));return new t(r)}};Fu.ContractResults=z_;var cf=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Ry.Address(""),this.sender=new Ry.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new MM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Ry.Address(e.receiver),r.sender=new Ry.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=MM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Fu.ContractResultItem=cf});var qM=A(By=>{"use strict";l();Object.defineProperty(By,"__esModule",{value:!0});By.ContractQueryRequest=void 0;var W_=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}};By.ContractQueryRequest=W_});var KM=A((pEe,$M)=>{l();$M.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Es=A(bo=>{l();var $_,Aie=[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];bo.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};bo.getSymbolTotalCodewords=function(e){return Aie[e]};bo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};bo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');$_=e};bo.isKanjiModeEnabled=function(){return typeof $_<"u"};bo.toSJIS=function(e){return $_(e)}});var My=A(zr=>{l();zr.L={bit:1};zr.M={bit:0};zr.Q={bit:3};zr.H={bit:2};function bie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return zr.L;case"m":case"medium":return zr.M;case"q":case"quartile":return zr.Q;case"h":case"high":return zr.H;default:throw new Error("Unknown EC Level: "+t)}}zr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};zr.from=function(e,r){if(zr.isValid(e))return e;try{return bie(e)}catch{return r}}});var XM=A((vEe,JM)=>{l();function YM(){this.buffer=[],this.length=0}YM.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++}};JM.exports=YM});var eU=A((bEe,ZM)=>{l();function lf(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)}lf.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};lf.prototype.get=function(t,e){return this.data[t*this.size+e]};lf.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};lf.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};ZM.exports=lf});var tU=A(Uy=>{l();var Iie=Es().getSymbolSize;Uy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=Iie(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{l();var _ie=Es().getSymbolSize,rU=7;nU.getPositions=function(e){let r=_ie(e);return[[0,0],[r-rU,0],[0,r-rU]]}});var sU=A(nt=>{l();nt.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Io={N1:3,N2:3,N3:40,N4:10};nt.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};nt.from=function(e){return nt.isValid(e)?parseInt(e,10):void 0};nt.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Io.N1+(i-5)),o=f,i=1),f=e.get(c,u),f===a?s++:(s>=5&&(n+=Io.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Io.N1+(i-5)),s>=5&&(n+=Io.N1+(s-5))}return n};nt.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*Io.N3};nt.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{l();var vs=My(),qy=[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],Vy=[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];K_.getBlocksCount=function(e,r){switch(r){case vs.L:return qy[(e-1)*4+0];case vs.M:return qy[(e-1)*4+1];case vs.Q:return qy[(e-1)*4+2];case vs.H:return qy[(e-1)*4+3];default:return}};K_.getTotalCodewordsCount=function(e,r){switch(r){case vs.L:return Vy[(e-1)*4+0];case vs.M:return Vy[(e-1)*4+1];case vs.Q:return Vy[(e-1)*4+2];case vs.H:return Vy[(e-1)*4+3];default:return}}});var oU=A(ky=>{l();var ff=new Uint8Array(512),Hy=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ff[r]=e,Hy[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ff[r]=ff[r-255]})();ky.log=function(e){if(e<1)throw new Error("log("+e+")");return Hy[e]};ky.exp=function(e){return ff[e]};ky.mul=function(e,r){return e===0||r===0?0:ff[Hy[e]+Hy[r]]}});var aU=A(df=>{l();var J_=oU();df.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{l();var uU=aU();function X_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}X_.prototype.initialize=function(e){this.degree=e,this.genPoly=uU.generateECPolynomial(this.degree)};X_.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=uU.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};cU.exports=X_});var Z_=A(fU=>{l();fU.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var eS=A(wi=>{l();var dU="[0-9]+",Tie="[A-Z $%*+\\-./:]+",hf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";hf=hf.replace(/u/g,"\\u");var Cie="(?:(?![A-Z0-9 $%*+\\-./:]|"+hf+`)(?:.|[\r +]))+`;wi.KANJI=new RegExp(hf,"g");wi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");wi.BYTE=new RegExp(Cie,"g");wi.NUMERIC=new RegExp(dU,"g");wi.ALPHANUMERIC=new RegExp(Tie,"g");var xie=new RegExp("^"+hf+"$"),Nie=new RegExp("^"+dU+"$"),Oie=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");wi.testKanji=function(e){return xie.test(e)};wi.testNumeric=function(e){return Nie.test(e)};wi.testAlphanumeric=function(e){return Oie.test(e)}});var As=A(Bt=>{l();var Die=Z_(),tS=eS();Bt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Bt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Bt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Bt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Bt.MIXED={bit:-1};Bt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Die.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Bt.getBestModeForData=function(e){return tS.testNumeric(e)?Bt.NUMERIC:tS.testAlphanumeric(e)?Bt.ALPHANUMERIC:tS.testKanji(e)?Bt.KANJI:Bt.BYTE};Bt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Bt.isValid=function(e){return e&&e.bit&&e.ccBits};function Pie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Bt.NUMERIC;case"alphanumeric":return Bt.ALPHANUMERIC;case"kanji":return Bt.KANJI;case"byte":return Bt.BYTE;default:throw new Error("Unknown mode: "+t)}}Bt.from=function(e,r){if(Bt.isValid(e))return e;try{return Pie(e)}catch{return r}}});var mU=A(_o=>{l();var Gy=Es(),Rie=Y_(),hU=My(),bs=As(),rS=Z_(),gU=7973,pU=Gy.getBCHDigit(gU);function Bie(t,e,r){for(let n=1;n<=40;n++)if(e<=_o.getCapacity(n,r,t))return n}function yU(t,e){return bs.getCharCountIndicator(t,e)+4}function Lie(t,e){let r=0;return t.forEach(function(n){let i=yU(n.mode,e);r+=i+n.getBitsLength()}),r}function Fie(t,e){for(let r=1;r<=40;r++)if(Lie(t,r)<=_o.getCapacity(r,e,bs.MIXED))return r}_o.from=function(e,r){return rS.isValid(e)?parseInt(e,10):r};_o.getCapacity=function(e,r,n){if(!rS.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=bs.BYTE);let i=Gy.getSymbolTotalCodewords(e),s=Rie.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===bs.MIXED)return o;let a=o-yU(n,e);switch(n){case bs.NUMERIC:return Math.floor(a/10*3);case bs.ALPHANUMERIC:return Math.floor(a/11*2);case bs.KANJI:return Math.floor(a/13);case bs.BYTE:default:return Math.floor(a/8)}};_o.getBestVersionForData=function(e,r){let n,i=hU.from(r,hU.M);if(Array.isArray(e)){if(e.length>1)return Fie(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Bie(n.mode,n.getLength(),i)};_o.getEncodedBits=function(e){if(!rS.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Gy.getBCHDigit(r)-pU>=0;)r^=gU<{l();var nS=Es(),EU=1335,Mie=21522,wU=nS.getBCHDigit(EU);vU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;nS.getBCHDigit(i)-wU>=0;)i^=EU<{l();var Uie=As();function Mu(t){this.mode=Uie.NUMERIC,this.data=t.toString()}Mu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Mu.prototype.getLength=function(){return this.data.length};Mu.prototype.getBitsLength=function(){return Mu.getBitsLength(this.data.length)};Mu.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))};bU.exports=Mu});var SU=A((YEe,_U)=>{l();var qie=As(),iS=["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 Uu(t){this.mode=qie.ALPHANUMERIC,this.data=t}Uu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Uu.prototype.getLength=function(){return this.data.length};Uu.prototype.getBitsLength=function(){return Uu.getBitsLength(this.data.length)};Uu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=iS.indexOf(this.data[r])*45;n+=iS.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(iS.indexOf(this.data[r]),6)};_U.exports=Uu});var CU=A((XEe,TU)=>{"use strict";l();TU.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 NU=A((eve,xU)=>{l();var Vie=CU(),Hie=As();function qu(t){this.mode=Hie.BYTE,typeof t=="string"&&(t=Vie(t)),this.data=new Uint8Array(t)}qu.getBitsLength=function(e){return e*8};qu.prototype.getLength=function(){return this.data.length};qu.prototype.getBitsLength=function(){return qu.getBitsLength(this.data.length)};qu.prototype.write=function(t){for(let e=0,r=this.data.length;e{l();var kie=As(),Gie=Es();function Vu(t){this.mode=kie.KANJI,this.data=t}Vu.getBitsLength=function(e){return e*13};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.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)}};OU.exports=Vu});var PU=A((ive,sS)=>{"use strict";l();var pf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=pf.PriorityQueue.make();s.push(e,0);for(var o,a,u,c,f,d,g,m,y;!s.empty();){o=s.pop(),a=o.value,c=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=c+d,m=i[u],y=typeof i[u]>"u",(y||m>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var b=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(b)}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=pf.single_source_shortest_paths(t,e,r);return pf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=pf.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 sS<"u"&&(sS.exports=pf)});var VU=A(Hu=>{l();var je=As(),LU=IU(),FU=SU(),MU=NU(),UU=DU(),gf=eS(),jy=Es(),jie=PU();function RU(t){return unescape(encodeURIComponent(t)).length}function yf(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 qU(t){let e=yf(gf.NUMERIC,je.NUMERIC,t),r=yf(gf.ALPHANUMERIC,je.ALPHANUMERIC,t),n,i;return jy.isKanjiModeEnabled()?(n=yf(gf.BYTE,je.BYTE,t),i=yf(gf.KANJI,je.KANJI,t)):(n=yf(gf.BYTE_KANJI,je.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 oS(t,e){switch(e){case je.NUMERIC:return LU.getBitsLength(t);case je.ALPHANUMERIC:return FU.getBitsLength(t);case je.KANJI:return UU.getBitsLength(t);case je.BYTE:return MU.getBitsLength(t)}}function Qie(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 zie(t){let e=[];for(let r=0;r{l();var zy=Es(),aS=My(),$ie=XM(),Kie=eU(),Yie=tU(),Jie=iU(),lS=sU(),fS=Y_(),Xie=lU(),Qy=mU(),Zie=AU(),ese=As(),uS=VU();function tse(t,e){let r=t.size,n=Jie.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 rse(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 cS(t,e,r){let n=t.size,i=Zie.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 sse(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 c=!1;o>>s&1)===1),t.set(i,a-u,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function ose(t,e,r){let n=new $ie;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),ese.getCharCountIndicator(u.mode,t)),u.write(n)});let i=zy.getSymbolTotalCodewords(t),s=fS.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&&tse(u,e),rse(u,o),isNaN(n)&&(n=uS.getBestMask(u,aS.bind(null,u,r))),uS.applyMask(n,u),aS(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}VU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=sS.M,i,s;return typeof r<"u"&&(n=sS.from(r.errorCorrectionLevel,sS.M),i=zy.from(r.version),s=uS.from(r.maskPattern),r.toSJISFunc&&Wy.setToSJISFunction(r.toSJISFunc)),sse(e,i,n,s)}});var lS=v(So=>{l();function kU(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("")}}So.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:kU(e.color.dark||"#000000ff"),light:kU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};So.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};So.getImageWidth=function(e,r){let n=So.getScale(e,r);return Math.floor((e+r.margin*2)*n)};So.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=So.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{l();var fS=lS();function ose(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 ase(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}$y.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=ase()),i=fS.getOptions(i);let o=fS.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return fS.qrToImageData(u.data,e,i),ose(a,s,o),a.putImageData(u,0,0),s};$y.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=$y.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var zU=v(QU=>{l();var use=lS();function jU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function dS(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function cse(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?dS("M",u+r,.5+c+r):dS("m",i,0),i=0,s=!1),u+1':"",c="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+c+` -`;return typeof n=="function"&&n(null,g),g}});var $U=v(mf=>{l();var lse=$M(),hS=HU(),WU=GU(),fse=zU();function pS(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!lse())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,c){try{let f=hS.create(r,n);u(t(f,e,n))}catch(f){c(f)}})}try{let u=hS.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}mf.create=hS.create;mf.toCanvas=pS.bind(null,WU.render);mf.toDataURL=pS.bind(null,WU.renderToDataURL);mf.toString=pS.bind(null,function(t,e,r){return fse.render(t,r)})});var s4=v(Is=>{"use strict";l();var bse=Is&&Is.__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]}),i4=Is&&Is.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bse(e,t,r)};Object.defineProperty(Is,"__esModule",{value:!0});i4(_u(),Is);i4(a_(),Is)});l();var Sse=Se(Hm(),1),Tse=Se(AE(),1),Cse=Se(IE(),1),xse=Se(pt(),1),Nse=Se(ha(),1),Ose=Se(Yr(),1),Dse=Se(Yn(),1),Pse=Se(Ih(),1),Rse=Se(Pv(),1),Bse=Se(qc(),1),Lse=Se(Wh(),1),C4=Se(_i(),1),jn=Se(Ec(),1),x4=Se(tc(),1),N4=Se(ko(),1);l();l();var p2=Se(Fv(),1);l();l();var $h="elvenjs_state",f2="https://devnet-api.multiversx.com";var Gi="/dapp/init",Kh="devnet",d2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",h2=["wss://relay.walletconnect.com"],Zt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.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",xAliasAddress:"https://testnet.xalias.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",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var ve={get(t){let e=localStorage.getItem($h);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($h,JSON.stringify(r))},clear(){localStorage.removeItem($h)}};var Yh=async()=>{let t=p2.ExtensionProvider.getInstance();try{let e=await t.init(),r=ve.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var vS=Se(Fv(),1),AS=Se(Yl(),1),bS=Se(_u(),1),T4=Se(P_(),1),s0=Se(Wh(),1);l();var bM=Se(Yl(),1);l();l();var ye=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};l();var Cy=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(Cy||{});l();var Et=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Ou=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");ye.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(ve.clear(),ye.run("onLogoutSuccess")),e}catch(e){let r=Et(e);console.warn(`Something went wrong trying to logout the user: ${r}`),ye.run("onLogoutFailure",r)}finally{ye.run("onLogoutEnd")}};l();var vM=Se(pt(),1),AM=Se(ha(),1);l();var Du=()=>new Date().setHours(new Date().getHours()+24),xy=t=>Date.now()>t;var mi=async t=>{let e=ve.get("address"),r=ve.get("expires");if(!(r&&xy(r))&&e&&t.networkProvider){let i=new vM.Address(e),s=new AM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);ve.set("address",e),ve.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),ve.set("nonce",o.nonce.valueOf()),ve.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Et(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};l();function Ny(t){return t[Math.floor(Math.random()*t.length)]}var IM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{mi(t),ye.run("onLoginSuccess")},onClientLogout:()=>Ou(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Ny(t.initOptions.walletConnectV2RelayAddresses),n=new bM.WalletConnectV2Provider(e,Zt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};l();var Fy=Se(pt(),1),qM=Se(_M(),1),VM=Se(NM(),1),HM=Se(k_(),1),kM=Se(LM(),1),GM=Se(MM(),1),jM=Se(UM(),1),QM=Se(Vc(),1);var My=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Kh,this.apiUrl=e||Zt[this.chainType]?.apiAddress,this.apiTimeout=n||Zt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let c=u?.error||a.status;return clearTimeout(s),Promise.reject(c)}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)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new Fy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new qM.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 Fy.Address(r.sender),receiver:new Fy.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:VM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:HM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:kM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new QM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new jM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return GM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};l();var zM=async(t,e,r,n="/")=>{let i=await Yh(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i)if(await i.login(o))ye.run("onLoginStart");else throw new Error("There were problems while logging in!")}catch(u){let c=Et(u);throw new Error(c)}if(!i)throw new Error("There were problems with auth provider initialization!");let{signature:a}=i.account;if(ve.set("loginToken",e),a&&ve.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");ve.set("address",u),ve.set("loginMethod","browser-extension"),ve.set("expires",Du()),await mi(t),ye.run("onLoginSuccess");let c=r.getToken(u,e,a);return ve.set("accessToken",c),i}catch(u){throw new Error(`Something went wrong trying to synchronize the user account: ${u?.message}`)}};l();l();var KU=Se($U(),1),YU=Se(Yl(),1);var dse=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},hse=t=>{let e=`${d2}?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},pse=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},gse=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},gS={},yse=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",gS[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:gS[t.topic].signal}),r},Ky={},mse=(t,e,r)=>{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=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=yse(t,e);return n.appendChild(s),Ky[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ky[t.topic].signal}),n},wse=()=>{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},Ese=t=>{if(!t)return;document.getElementById(t)?.remove()},vse=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Ase=async t=>t?await KU.default.toString(t,{type:"svg"}):void 0,JU=async(t,e,r,n)=>{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=await Ase(e),o;if(s&&(o=dse(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),vse()&&i.appendChild(hse(e))),i&&r instanceof YU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),Ese(f))}catch(d){let g=Et(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ky[f].abort()}},c=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(wse()),await r.login({approval:d,token:n})}catch(d){let g=Et(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values(Ky))d?.abort();for(let d of Object.values(gS))d?.abort()}};if(a&&a.length>0){let f=pse();i.appendChild(f);let d=gse();f.appendChild(d);for(let g of a){let m=mse(g,u,c);f.appendChild(m)}}}return i};var Yy=Se(Yl(),1);var XU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=Ny(t.initOptions.walletConnectV2RelayAddresses);if(!i||!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 s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Yy.WalletConnectV2Provider){ye.run("onLoginStart");let u=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();ve.set("address",u),ve.set("loginMethod","mobile"),ve.set("expires",Du()),await mi(t),c&&ve.set("signature",c),ve.set("loginToken",e);let f=r.getToken(u,e,c);ve.set("accessToken",f),ye.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Yy.WalletConnectV2Provider&&await Ou(t)},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Yy.WalletConnectV2Provider(o,Zt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,ye.run("onQrPending"),await a.init();let{uri:u,approval:c}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await JU(n,f,a,e),ye.run("onQrLoaded")),await a.login({approval:c,token:e}),a}}catch(u){let c=Et(u);console.warn(`Something went wrong trying to login the user: ${c}`),ye.run("onLoginFailure",c)}};l();var ZU=Se(_u(),1);var yS=async(t,e,r,n)=>{let i=new ZU.WalletProvider(`${t}${Gi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return ye.run("onLoginStart"),ve.set("loginMethod",Zt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),ve.set("expires",Du()),ve.set("loginToken",e),i}catch(a){let u=Et(a);console.warn(`Something went wrong trying to login the user: ${u}`),ve.set("loginMethod",""),ye.run("onLoginFailure",u)}};l();var Ar=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};l();var e4=Se(_u(),1);var t4=Se(P_(),1),mS=async(t,e)=>{let r=Ar("signature"),n=Ar("address"),i=ve.get("address"),s=ve.get("loginToken");if(r&&ve.set("signature",r),n||i){n&&(ve.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new e4.WalletProvider(`${t}${Gi}`);if(r&&e&&n){let u=new t4.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);ve.set("accessToken",u)}return o}};l();var r4=Se(ha(),1),n4=Se(Ih(),1);var Jy=async(t,e)=>{ye.run("onTxSent",t),await new n4.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new r4.Account(n),s=await e.getAccount(n);i.update(s),ve.set("address",i.address.bech32()),ve.set("balance",i.balance.toString()),ye.run("onTxFinalized",t)};l();var ku=Se(s4(),1),a4=Se(Yr(),1);l();var o4=Se(ha(),1);var Xy=t=>{let e=t.getSender(),r=new o4.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),ve.set("nonce",n+1)};var u4=async(t,e,r,n)=>{if(Ar(ku.WALLET_PROVIDER_CALLBACK_PARAM)===ku.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=ve.get("activeGuardian"),o=ve.get("loginMethod"),a=Ar("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new ku.WalletProvider(`${r}${Gi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let c=a4.Transaction.fromPlainObject(u);c.setNonce(n),Xy(c);try{ye.run("onTxStart",c),await e.sendTransaction(c),await Jy(c,e)}catch(f){let g=`Getting transaction information failed! ${Et(f)}`;throw ye.run("onTxFailure",c,g),new Error(g)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};l();var Zy=Se(xc(),1),c4=Se(pt(),1),l4=Se(_u(),1);var f4=t=>{let e=ve.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Zy.TransactionVersion.withTxOptions()),t.setOptions(Zy.TransactionOptions.withOptions(r)),t.setGuardian(c4.Address.fromBech32(e))}return t},d4=async(t,e)=>{let r=new l4.WalletProvider(`${e}${Gi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},h4=t=>{let e=ve.get("activeGuardian");return!(!ve.get("address")||!e||t.isGuardedTransaction())};l();var p4=()=>{let t=!Ar("walletProviderStatus"),e=Ar("status")==="signed",r=Ar("message"),n=Ar("signature");t&&e&&r&&n&&(ye.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};l();var ES=Se(Yr(),1);l();var g4=(e=>(e.reloginResponse="RELOGIN_RESPONSE",e))(g4||{}),y4=(a=>(a.handshakeResponse="HANDSHAKE_RESPONSE",a.loginResponse="LOGIN_RESPONSE",a.disconnectResponse="DISCONNECT_RESPONSE",a.cancelResponse="CANCEL_RESPONSE",a.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",a.signMessageResponse="SIGN_MESSAGE_RESPONSE",a.noneResponse="NONE_RESPONSE",a))(y4||{}),wS={...y4,...g4},m4=(r=>(r.signTransactionsWithGuardianResponse="SIGN_TRANSACTIONS_WITH_GUARDIAN_RESPONSE",r.reloginRequest="RELOGIN_REQUEST",r))(m4||{}),w4=(o=>(o.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",o.signMessageRequest="SIGN_MESSAGE_REQUEST",o.loginRequest="LOGIN_REQUEST",o.logoutRequest="LOGOUT_REQUEST",o.cancelAction="CANCEL_ACTION_REQUEST",o.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",o))(w4||{}),To={...w4,...m4};l();var E4=typeof window<"u"?window:{},v4=()=>E4.ReactNativeWebView?"reactNative":E4.webkit?"ios":"web",Co=()=>typeof window<"u"&&typeof window?.location<"u"?window?.parent?.origin??"*":"*",e0=t=>Object.prototype.toString.call(t)==="[object String]";l();var t0={signTransactions:{ios:t=>window.webkit.messageHandlers.signTransactions.postMessage(t,Co()),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t}),Co())},signMessage:{ios:t=>window.webkit.messageHandlers.signMessage.postMessage(t),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signMessageRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signMessageRequest,message:t}),Co())},logout:{ios:()=>window.webkit.messageHandlers.logout.postMessage(),reactNative:()=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.logoutRequest})),web:()=>window?.postMessage(JSON.stringify({type:To.logoutRequest}),Co())}};var r0=v4(),n0="message",A4=t=>{let e=r=>{let n=r.data;if(!(r.target.origin!=Co()&&r0!="reactNative"))try{n=JSON.parse(n),t(n)}catch{console.error("error parsing response")}};document&&document.addEventListener(n0,e),window&&window.addEventListener(n0,e)},_s=class{constructor(){}async logout(){return t0.logout[r0](),new Promise(e=>{e(!0)})}async signMessage(e){try{return t0.signMessage[r0](e),await new Promise((n,i)=>{window.signMessageResponse=(o,a)=>{if(a){i(a),window.signMessageResponse=null;return}n(o),window.signMessageResponse=null};function s(o){let{message:a,type:u}=o;if(u===wS.signMessageResponse&&a!=null){let{signedMessage:c,error:f}=a;f?i(f):n(c)}document?.removeEventListener(n0,s)}A4(s)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransactions(e){try{let r=e.map(i=>i.toPlainObject());return t0.signTransactions[r0](r),await new Promise((i,s)=>{window.transactionsSigned=(a,u)=>{if(a=JSON.parse(a),u){s(u),window.transactionsSigned=null;return}i(a.map(c=>ES.Transaction.fromPlainObject(c))),window.transactionsSigned=null};function o(a){let{message:u,type:c}=a;if(c===wS.signTransactionsResponse){let{transactions:f,error:d}=u;try{d?s(d):i(f.map(g=>ES.Transaction.fromPlainObject(g)))}catch{s("Unable to sign")}}document&&document.removeEventListener(n0,o)}A4(o)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransaction(e){return(await this.signTransactions([e]))[0]}};l();l();l();function _se(t){try{let e=atob(t),r=btoa(e),n=h.Buffer.from(t,"base64").toString(),i=h.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Gu(t){return _se(t)?atob(t):t}l();var b4=t=>{if(!t||!e0(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Gu(s)),a=Gu(r);return{ttl:Number(i),extraInfo:o,origin:a,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var I4=t=>{if(!t||!e0(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Gu(r),o=Gu(n),a=b4(o);if(!a)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let u={...a,address:s,body:o,signature:i};return a.extraInfo?.timestamp||delete u.extraInfo,u}catch{return null}};function _4(t,e){let r=I4(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(ve.set("loginToken",s),ve.set("accessToken",t),ve.set("signature",n),ve.set("address",i),ve.set("loginMethod","x-portal-hub"),e.dappProvider=new _s)}l();var S4=t=>{t.onLoginStart&&ye.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&ye.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&ye.set("onLoginFailure",t.onLoginFailure),t.onLoginEnd&&ye.set("onLoginEnd",t.onLoginEnd),t.onLogoutStart&&ye.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&ye.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&ye.set("onLogoutFailure",t.onLogoutFailure),t.onLogoutEnd&&ye.set("onLogoutEnd",t.onLogoutEnd),t.onQrPending&&ye.set("onQrPending",t.onQrPending),t.onQrLoaded&&ye.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&ye.set("onTxStart",t.onTxStart),t.onTxSent&&ye.set("onTxSent",t.onTxSent),t.onTxFinalized&&ye.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&ye.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&ye.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&ye.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&ye.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&ye.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&ye.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&ye.set("onQueryFailure",t.onQueryFailure)};l();var i0=async t=>{ye.run("onLoginStart");try{await t(()=>{ye.run("onLoginSuccess")})}catch(e){let r=Et(e);console.warn(`Something went wrong trying to login the user: ${r}`),ye.run("onLoginFailure",r)}finally{ye.run("onLoginEnd")}};var IS=class{static async init(e){let r=ve.get();if(r.expires&&xy(r.expires)){ve.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Kh,apiUrl:f2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:h2,...e},this.networkProvider=new My(this.initOptions),S4(this.initOptions);let n=Ar("accessToken");n&&await i0(async s=>{_4(n,this),await mi(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Ar("address"))&&r?.loginMethod&&(await i0(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await Yh()),r.loginMethod==="mobile"&&(this.dappProvider=await IM(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new _s),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await mS(Zt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await mS(Zt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await mi(this),s()}),this.initOptions?.chainType&&(await u4(this.dappProvider,this.networkProvider,Zt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),p4()))}static async login(e,r){if(!Object.values(Cy).includes(e)){let i="Wrong login method!";throw ye.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw ye.run("onLoginFailure",i),new Error(i)}await i0(async i=>{let s=new T4.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),o=await s.initialize();if(e==="browser-extension"){let a=await zM(this,o,s,r?.callbackRoute);this.dappProvider=a,i()}if(e==="mobile"){let a=await XU(this,o,s,r?.qrCodeContainer);this.dappProvider=a,i()}if(e==="web-wallet"&&this.initOptions?.chainType){let a=await yS(Zt[this.initOptions.chainType].walletAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}if(e==="x-alias"&&this.initOptions?.chainType){let a=await yS(Zt[this.initOptions.chainType].xAliasAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}})}static async logout(){try{let e=await Ou(this);return this.dappProvider=void 0,e}catch(e){let r=Et(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw ye.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw ye.run("onTxFailure",e,n),new Error(n)}let r=f4(e);try{ye.run("onTxStart",e);let n=ve.get();if(e.setNonce(n.nonce),this.dappProvider instanceof vS.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof AS.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _s&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof bS.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=h4(r);if(i||Xy(r),i&&this.initOptions?.chainType){await d4(r,Zt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Jy(r,this.networkProvider)}}catch(n){let i=Et(n);throw ye.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(ye.run("onSignMsgStart",e),this.dappProvider instanceof vS.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new s0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof AS.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new s0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof _s&&(n=await this.dappProvider.signMessage(e)),this.dappProvider instanceof bS.WalletProvider){let i=o=>encodeURIComponent(o).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),s=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new s0.SignableMessage({message:h.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${s}${s.includes("?")?"&":"?"}message=${i(e)}`)})}return ye.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Et(i);throw ye.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{ye.run("onQueryStart",o);let a=await this.networkProvider.queryContract(o);return ye.run("onQueryFinalized",a),a}catch(a){let u=Et(a);throw ye.run("onQueryFinalized",o,u),new Error(`Smart contract query failed! ${u}`)}}static{this.storage=ve}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,ye.clear()}}};var export_Account=Nse.Account;var export_Address=xse.Address;var export_AddressType=N4.AddressType;var export_AddressValue=N4.AddressValue;var export_BigUIntType=jn.BigUIntType;var export_BigUIntValue=jn.BigUIntValue;var export_BooleanType=x4.BooleanType;var export_BooleanValue=x4.BooleanValue;var export_BytesType=C4.BytesType;var export_BytesValue=C4.BytesValue;var export_ContractFunction=Bse.ContractFunction;var export_GasEstimator=Cse.GasEstimator;var export_SignableMessage=Lse.SignableMessage;var export_SmartContract=Rse.SmartContract;var export_TokenTransfer=Sse.TokenTransfer;var export_Transaction=Ose.Transaction;var export_TransactionPayload=Dse.TransactionPayload;var export_TransactionWatcher=Pse.TransactionWatcher;var export_TransferTransactionsFactory=Tse.TransferTransactionsFactory;var export_U16Type=jn.U16Type;var export_U16Value=jn.U16Value;var export_U32Type=jn.U32Type;var export_U32Value=jn.U32Value;var export_U64Type=jn.U64Type;var export_U64Value=jn.U64Value;var export_U8Type=jn.U8Type;var export_U8Value=jn.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,IS as ElvenJS,export_GasEstimator as GasEstimator,Cy as LoginMethodsEnum,export_SignableMessage as SignableMessage,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=ose(e,r,i),a=zy.getSymbolSize(e),u=new Kie(a);return tse(u,e),rse(u),nse(u,e),cS(u,r,0),e>=7&&ise(u,e),sse(u,o),isNaN(n)&&(n=lS.getBestMask(u,cS.bind(null,u,r))),lS.applyMask(n,u),cS(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}HU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=aS.M,i,s;return typeof r<"u"&&(n=aS.from(r.errorCorrectionLevel,aS.M),i=Qy.from(r.version),s=lS.from(r.maskPattern),r.toSJISFunc&&zy.setToSJISFunction(r.toSJISFunc)),use(e,i,n,s)}});var dS=A(So=>{l();function GU(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("")}}So.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:GU(e.color.dark||"#000000ff"),light:GU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};So.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};So.getImageWidth=function(e,r){let n=So.getScale(e,r);return Math.floor((e+r.margin*2)*n)};So.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=So.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{l();var hS=dS();function cse(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 lse(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Wy.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=lse()),i=hS.getOptions(i);let o=hS.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return hS.qrToImageData(u.data,e,i),cse(a,s,o),a.putImageData(u,0,0),s};Wy.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Wy.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var WU=A(zU=>{l();var fse=dS();function QU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function pS(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function dse(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?pS("M",u+r,.5+c+r):pS("m",i,0),i=0,s=!1),u+1':"",c="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+c+` +`;return typeof n=="function"&&n(null,g),g}});var KU=A(mf=>{l();var hse=KM(),gS=kU(),$U=jU(),pse=WU();function yS(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!hse())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,c){try{let f=gS.create(r,n);u(t(f,e,n))}catch(f){c(f)}})}try{let u=gS.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}mf.create=gS.create;mf.toCanvas=yS.bind(null,$U.render);mf.toDataURL=yS.bind(null,$U.renderToDataURL);mf.toString=yS.bind(null,function(t,e,r){return pse.render(t,r)})});var o4=A(Is=>{"use strict";l();var Sse=Is&&Is.__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]}),s4=Is&&Is.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sse(e,t,r)};Object.defineProperty(Is,"__esModule",{value:!0});s4(Tu(),Is);s4(f_(),Is)});l();var xse=be(Vm(),1),Nse=be(vE(),1),Ose=be(bE(),1),Dse=be(pt(),1),Pse=be(ha(),1),Rse=be(Yr(),1),Bse=be(Yn(),1),Lse=be(Ih(),1),Fse=be(Dv(),1),Mse=be(qc(),1),Use=be(Wh(),1),x4=be(_i(),1),jn=be(Ec(),1),N4=be(tc(),1),O4=be(ko(),1),qse=be(Rv(),1),Vse=be(Mv(),1);l();l();var A2=be(Vv(),1);l();l();var $h="elvenjs_state",w2="https://devnet-api.multiversx.com";var ji="/dapp/init",Kh="devnet",E2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",v2=["wss://relay.walletconnect.com"],Zt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.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",xAliasAddress:"https://testnet.xalias.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",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var ve={get(t){let e=localStorage.getItem($h);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($h,JSON.stringify(r))},clear(){localStorage.removeItem($h)}};var Yh=async()=>{let t=A2.ExtensionProvider.getInstance();try{let e=await t.init(),r=ve.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var bS=be(Vv(),1),IS=be(Yl(),1),_S=be(Tu(),1),C4=be(F_(),1),i0=be(Wh(),1);l();var xM=be(Yl(),1);l();l();var ye=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};l();var SM=(E=>(E.onLoginStart="onLoginStart",E.onLoginEnd="onLoginEnd",E.onLoginSuccess="onLoginSuccess",E.onLoginFailure="onLoginFailure",E.onLogoutStart="onLogoutStart",E.onLogoutEnd="onLogoutEnd",E.onLogoutSuccess="onLogoutSuccess",E.onLogoutFailure="onLogoutFailure",E.onQrPending="onQrPending",E.onQrLoaded="onQrLoaded",E.onTxStart="onTxStart",E.onTxSent="onTxSent",E.onTxFinalized="onTxFinalized",E.onTxFailure="onTxFailure",E.onSignMsgStart="onSignMsgStart",E.onSignMsgFinalized="onSignMsgFinalized",E.onSignMsgFailure="onSignMsgFailure",E.onQueryStart="onQueryStart",E.onQueryFinalized="onQueryFinalized",E.onQueryFailure="onQueryFailure",E))(SM||{}),M_=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(M_||{}),mie=(r=>(r.mvx_cancelAction="mvx_cancelAction",r.mvx_signNativeAuthToken="mvx_signNativeAuthToken",r))(mie||{}),wie=(e=>(e.hasWebWalletGuardianSign="hasWebWalletGuardianSign",e))(wie||{});l();var Et=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Pu=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");ye.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(ve.clear(),ye.run("onLogoutSuccess")),e}catch(e){let r=Et(e);console.warn(`Something went wrong trying to logout the user: ${r}`),ye.run("onLogoutFailure",r)}finally{ye.run("onLogoutEnd")}};l();var TM=be(pt(),1),CM=be(ha(),1);l();var Ru=()=>new Date().setHours(new Date().getHours()+24),Cy=t=>Date.now()>t;var mi=async t=>{let e=ve.get("address"),r=ve.get("expires");if(!(r&&Cy(r))&&e&&t.networkProvider){let i=new TM.Address(e),s=new CM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);ve.set("address",e),ve.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),ve.set("nonce",o.nonce.valueOf()),ve.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Et(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};l();function xy(t){return t[Math.floor(Math.random()*t.length)]}var NM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{mi(t),ye.run("onLoginSuccess")},onClientLogout:()=>Pu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=xy(t.initOptions.walletConnectV2RelayAddresses),n=new xM.WalletConnectV2Provider(e,Zt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};l();var Ly=be(pt(),1),VM=be(OM(),1),HM=be(PM(),1),kM=be(Q_(),1),GM=be(UM(),1),jM=be(Mv(),1),QM=be(qM(),1),zM=be(Vc(),1);var Fy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Kh,this.apiUrl=e||Zt[this.chainType]?.apiAddress,this.apiTimeout=n||Zt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let c=u?.error||a.status;return clearTimeout(s),Promise.reject(c)}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)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new Ly.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new VM.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 Ly.Address(r.sender),receiver:new Ly.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:HM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:kM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:GM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new zM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new QM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return jM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};l();var WM=async(t,e,r,n="/")=>{let i=await Yh(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i)if(await i.login(o))ye.run("onLoginStart");else throw new Error("There were problems while logging in!")}catch(u){let c=Et(u);throw new Error(c)}if(!i)throw new Error("There were problems with auth provider initialization!");let{signature:a}=i.account;if(ve.set("loginToken",e),a&&ve.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");ve.set("address",u),ve.set("loginMethod","browser-extension"),ve.set("expires",Ru()),await mi(t),ye.run("onLoginSuccess");let c=r.getToken(u,e,a);return ve.set("accessToken",c),i}catch(u){throw new Error(`Something went wrong trying to synchronize the user account: ${u?.message}`)}};l();l();var YU=be(KU(),1),JU=be(Yl(),1);var gse=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},yse=t=>{let e=`${E2}?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},mse=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},wse=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},mS={},Ese=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",mS[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:mS[t.topic].signal}),r},$y={},vse=(t,e,r)=>{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=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=Ese(t,e);return n.appendChild(s),$y[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:$y[t.topic].signal}),n},Ase=()=>{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},bse=t=>{if(!t)return;document.getElementById(t)?.remove()},Ise=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),_se=async t=>t?await YU.default.toString(t,{type:"svg"}):void 0,XU=async(t,e,r,n)=>{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=await _se(e),o;if(s&&(o=gse(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),Ise()&&i.appendChild(yse(e))),i&&r instanceof JU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),bse(f))}catch(d){let g=Et(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{$y[f].abort()}},c=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(Ase()),await r.login({approval:d,token:n})}catch(d){let g=Et(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values($y))d?.abort();for(let d of Object.values(mS))d?.abort()}};if(a&&a.length>0){let f=mse();i.appendChild(f);let d=wse();f.appendChild(d);for(let g of a){let m=vse(g,u,c);f.appendChild(m)}}}return i};var Ky=be(Yl(),1);var ZU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=xy(t.initOptions.walletConnectV2RelayAddresses);if(!i||!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 s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Ky.WalletConnectV2Provider){ye.run("onLoginStart");let u=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();ve.set("address",u),ve.set("loginMethod","mobile"),ve.set("expires",Ru()),await mi(t),c&&ve.set("signature",c),ve.set("loginToken",e);let f=r.getToken(u,e,c);ve.set("accessToken",f),ye.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Ky.WalletConnectV2Provider&&await Pu(t)},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Ky.WalletConnectV2Provider(o,Zt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,ye.run("onQrPending"),await a.init();let{uri:u,approval:c}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await XU(n,f,a,e),ye.run("onQrLoaded")),await a.login({approval:c,token:e}),a}}catch(u){let c=Et(u);console.warn(`Something went wrong trying to login the user: ${c}`),ye.run("onLoginFailure",c)}};l();var e4=be(Tu(),1);var wS=async(t,e,r,n)=>{let i=new e4.WalletProvider(`${t}${ji}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return ye.run("onLoginStart"),ve.set("loginMethod",Zt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),ve.set("expires",Ru()),ve.set("loginToken",e),i}catch(a){let u=Et(a);console.warn(`Something went wrong trying to login the user: ${u}`),ve.set("loginMethod",""),ye.run("onLoginFailure",u)}};l();var Ar=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};l();var t4=be(Tu(),1);var r4=be(F_(),1),ES=async(t,e)=>{let r=Ar("signature"),n=Ar("address"),i=ve.get("address"),s=ve.get("loginToken");if(r&&ve.set("signature",r),n||i){n&&(ve.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new t4.WalletProvider(`${t}${ji}`);if(r&&e&&n){let u=new r4.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);ve.set("accessToken",u)}return o}};l();var n4=be(ha(),1),i4=be(Ih(),1);var Yy=async(t,e)=>{ye.run("onTxSent",t),await new i4.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new n4.Account(n),s=await e.getAccount(n);i.update(s),ve.set("address",i.address.bech32()),ve.set("balance",i.balance.toString()),ye.run("onTxFinalized",t)};l();var ku=be(o4(),1),u4=be(Yr(),1);l();var a4=be(ha(),1);var Jy=t=>{let e=t.getSender(),r=new a4.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),ve.set("nonce",n+1)};var c4=async(t,e,r,n)=>{if(Ar(ku.WALLET_PROVIDER_CALLBACK_PARAM)===ku.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=ve.get("activeGuardian"),o=ve.get("loginMethod"),a=Ar("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new ku.WalletProvider(`${r}${ji}`).getTransactionsFromWalletUrl()?.[0]);if(u){let c=u4.Transaction.fromPlainObject(u);c.setNonce(n),Jy(c);try{ye.run("onTxStart",c),await e.sendTransaction(c),await Yy(c,e)}catch(f){let g=`Getting transaction information failed! ${Et(f)}`;throw ye.run("onTxFailure",c,g),new Error(g)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};l();var Xy=be(xc(),1),l4=be(pt(),1),f4=be(Tu(),1);var d4=t=>{let e=ve.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Xy.TransactionVersion.withTxOptions()),t.setOptions(Xy.TransactionOptions.withOptions(r)),t.setGuardian(l4.Address.fromBech32(e))}return t},h4=async(t,e)=>{let r=new f4.WalletProvider(`${e}${ji}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},p4=t=>{let e=ve.get("activeGuardian");return!(!ve.get("address")||!e||t.isGuardedTransaction())};l();var g4=()=>{let t=!Ar("walletProviderStatus"),e=Ar("status")==="signed",r=Ar("message"),n=Ar("signature");t&&e&&r&&n&&(ye.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};l();var AS=be(Yr(),1);l();var y4=(e=>(e.reloginResponse="RELOGIN_RESPONSE",e))(y4||{}),m4=(a=>(a.handshakeResponse="HANDSHAKE_RESPONSE",a.loginResponse="LOGIN_RESPONSE",a.disconnectResponse="DISCONNECT_RESPONSE",a.cancelResponse="CANCEL_RESPONSE",a.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",a.signMessageResponse="SIGN_MESSAGE_RESPONSE",a.noneResponse="NONE_RESPONSE",a))(m4||{}),vS={...m4,...y4},w4=(r=>(r.signTransactionsWithGuardianResponse="SIGN_TRANSACTIONS_WITH_GUARDIAN_RESPONSE",r.reloginRequest="RELOGIN_REQUEST",r))(w4||{}),E4=(o=>(o.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",o.signMessageRequest="SIGN_MESSAGE_REQUEST",o.loginRequest="LOGIN_REQUEST",o.logoutRequest="LOGOUT_REQUEST",o.cancelAction="CANCEL_ACTION_REQUEST",o.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",o))(E4||{}),To={...E4,...w4};l();var v4=typeof window<"u"?window:{},A4=()=>v4.ReactNativeWebView?"reactNative":v4.webkit?"ios":"web",Co=()=>typeof window<"u"&&typeof window?.location<"u"?window?.parent?.origin??"*":"*",Zy=t=>Object.prototype.toString.call(t)==="[object String]";l();var e0={signTransactions:{ios:t=>window.webkit.messageHandlers.signTransactions.postMessage(t,Co()),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t}),Co())},signMessage:{ios:t=>window.webkit.messageHandlers.signMessage.postMessage(t),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signMessageRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signMessageRequest,message:t}),Co())},logout:{ios:()=>window.webkit.messageHandlers.logout.postMessage(),reactNative:()=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.logoutRequest})),web:()=>window?.postMessage(JSON.stringify({type:To.logoutRequest}),Co())}};var t0=A4(),r0="message",b4=t=>{let e=r=>{let n=r.data;if(!(r.target.origin!=Co()&&t0!="reactNative"))try{n=JSON.parse(n),t(n)}catch{console.error("error parsing response")}};document&&document.addEventListener(r0,e),window&&window.addEventListener(r0,e)},_s=class{constructor(){}async logout(){return e0.logout[t0](),new Promise(e=>{e(!0)})}async signMessage(e){try{return e0.signMessage[t0](e),await new Promise((n,i)=>{window.signMessageResponse=(o,a)=>{if(a){i(a),window.signMessageResponse=null;return}n(o),window.signMessageResponse=null};function s(o){let{message:a,type:u}=o;if(u===vS.signMessageResponse&&a!=null){let{signedMessage:c,error:f}=a;f?i(f):n(c)}document?.removeEventListener(r0,s)}b4(s)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransactions(e){try{let r=e.map(i=>i.toPlainObject());return e0.signTransactions[t0](r),await new Promise((i,s)=>{window.transactionsSigned=(a,u)=>{if(a=JSON.parse(a),u){s(u),window.transactionsSigned=null;return}i(a.map(c=>AS.Transaction.fromPlainObject(c))),window.transactionsSigned=null};function o(a){let{message:u,type:c}=a;if(c===vS.signTransactionsResponse){let{transactions:f,error:d}=u;try{d?s(d):i(f.map(g=>AS.Transaction.fromPlainObject(g)))}catch{s("Unable to sign")}}document&&document.removeEventListener(r0,o)}b4(o)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransaction(e){return(await this.signTransactions([e]))[0]}};l();l();l();function Cse(t){try{let e=atob(t),r=btoa(e),n=h.Buffer.from(t,"base64").toString(),i=h.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Gu(t){return Cse(t)?atob(t):t}l();var I4=t=>{if(!t||!Zy(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Gu(s)),a=Gu(r);return{ttl:Number(i),extraInfo:o,origin:a,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var _4=t=>{if(!t||!Zy(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Gu(r),o=Gu(n),a=I4(o);if(!a)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let u={...a,address:s,body:o,signature:i};return a.extraInfo?.timestamp||delete u.extraInfo,u}catch{return null}};function S4(t,e){let r=_4(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(ve.set("loginToken",s),ve.set("accessToken",t),ve.set("signature",n),ve.set("address",i),ve.set("loginMethod","x-portal-hub"),e.dappProvider=new _s)}l();var T4=t=>{t.onLoginStart&&ye.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&ye.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&ye.set("onLoginFailure",t.onLoginFailure),t.onLoginEnd&&ye.set("onLoginEnd",t.onLoginEnd),t.onLogoutStart&&ye.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&ye.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&ye.set("onLogoutFailure",t.onLogoutFailure),t.onLogoutEnd&&ye.set("onLogoutEnd",t.onLogoutEnd),t.onQrPending&&ye.set("onQrPending",t.onQrPending),t.onQrLoaded&&ye.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&ye.set("onTxStart",t.onTxStart),t.onTxSent&&ye.set("onTxSent",t.onTxSent),t.onTxFinalized&&ye.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&ye.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&ye.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&ye.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&ye.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&ye.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&ye.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&ye.set("onQueryFailure",t.onQueryFailure)};l();var n0=async t=>{ye.run("onLoginStart");try{await t(()=>{ye.run("onLoginSuccess")})}catch(e){let r=Et(e);console.warn(`Something went wrong trying to login the user: ${r}`),ye.run("onLoginFailure",r)}finally{ye.run("onLoginEnd")}};var SS=class{static async init(e){let r=ve.get();if(r.expires&&Cy(r.expires)){ve.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Kh,apiUrl:w2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:v2,...e},this.networkProvider=new Fy(this.initOptions),T4(this.initOptions);let n=Ar("accessToken");n&&await n0(async s=>{S4(n,this),await mi(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Ar("address"))&&r?.loginMethod&&(await n0(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await Yh()),r.loginMethod==="mobile"&&(this.dappProvider=await NM(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new _s),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await ES(Zt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await ES(Zt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await mi(this),s()}),this.initOptions?.chainType&&(await c4(this.dappProvider,this.networkProvider,Zt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),g4()))}static async login(e,r){if(!Object.values(M_).includes(e)){let i="Wrong login method!";throw ye.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw ye.run("onLoginFailure",i),new Error(i)}await n0(async i=>{let s=new C4.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),o=await s.initialize();if(e==="browser-extension"){let a=await WM(this,o,s,r?.callbackRoute);this.dappProvider=a,i()}if(e==="mobile"){let a=await ZU(this,o,s,r?.qrCodeContainer);this.dappProvider=a,i()}if(e==="web-wallet"&&this.initOptions?.chainType){let a=await wS(Zt[this.initOptions.chainType].walletAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}if(e==="x-alias"&&this.initOptions?.chainType){let a=await wS(Zt[this.initOptions.chainType].xAliasAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}})}static async logout(){try{let e=await Pu(this);return this.dappProvider=void 0,e}catch(e){let r=Et(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw ye.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw ye.run("onTxFailure",e,n),new Error(n)}let r=d4(e);try{ye.run("onTxStart",e);let n=ve.get();if(e.setNonce(n.nonce),this.dappProvider instanceof bS.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof IS.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _s&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _S.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=p4(r);if(i||Jy(r),i&&this.initOptions?.chainType){await h4(r,Zt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Yy(r,this.networkProvider)}}catch(n){let i=Et(n);throw ye.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(ye.run("onSignMsgStart",e),this.dappProvider instanceof bS.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new i0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof IS.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new i0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof _s&&(n=await this.dappProvider.signMessage(e)),this.dappProvider instanceof _S.WalletProvider){let i=o=>encodeURIComponent(o).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),s=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new i0.SignableMessage({message:h.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${s}${s.includes("?")?"&":"?"}message=${i(e)}`)})}return ye.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Et(i);throw ye.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{ye.run("onQueryStart",o);let a=await this.networkProvider.queryContract(o);return ye.run("onQueryFinalized",a),a}catch(a){let u=Et(a);throw ye.run("onQueryFinalized",o,u),new Error(`Smart contract query failed! ${u}`)}}static{this.storage=ve}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,ye.clear()}}};var export_Account=Pse.Account;var export_Address=Dse.Address;var export_AddressType=O4.AddressType;var export_AddressValue=O4.AddressValue;var export_BigUIntType=jn.BigUIntType;var export_BigUIntValue=jn.BigUIntValue;var export_BooleanType=N4.BooleanType;var export_BooleanValue=N4.BooleanValue;var export_BytesType=x4.BytesType;var export_BytesValue=x4.BytesValue;var export_ContractFunction=Mse.ContractFunction;var export_ContractQueryResponse=Vse.ContractQueryResponse;var export_GasEstimator=Ose.GasEstimator;var export_QueryArguments=qse.QueryArguments;var export_SignableMessage=Use.SignableMessage;var export_SmartContract=Fse.SmartContract;var export_TokenTransfer=xse.TokenTransfer;var export_Transaction=Rse.Transaction;var export_TransactionPayload=Bse.TransactionPayload;var export_TransactionWatcher=Lse.TransactionWatcher;var export_TransferTransactionsFactory=Nse.TransferTransactionsFactory;var export_U16Type=jn.U16Type;var export_U16Value=jn.U16Value;var export_U32Type=jn.U32Type;var export_U32Value=jn.U32Value;var export_U64Type=jn.U64Type;var export_U64Value=jn.U64Value;var export_U8Type=jn.U8Type;var export_U8Value=jn.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,export_ContractQueryResponse as ContractQueryResponse,mie as DappCoreWCV2CustomMethodsEnum,SS as ElvenJS,SM as EventStoreEvents,export_GasEstimator as GasEstimator,M_ as LoginMethodsEnum,export_QueryArguments as QueryArguments,export_SignableMessage as SignableMessage,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,wie as WebWalletUrlParamsEnum}; /*! Bundled license information: ieee754/index.js: diff --git a/build/types/elven.d.ts b/build/types/elven.d.ts index 55a3b74..573de0a 100644 --- a/build/types/elven.d.ts +++ b/build/types/elven.d.ts @@ -13,5 +13,7 @@ export { BytesType, BytesValue, } from '@multiversx/sdk-core/out/smartcontracts/ export { U16Type, U16Value, U32Type, U32Value, U64Type, U64Value, U8Type, U8Value, BigUIntType, BigUIntValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/numerical'; export { BooleanType, BooleanValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/boolean'; export { AddressType, AddressValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/address'; +export { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts/interface'; +export { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; export { ElvenJS } from './main'; -export { LoginMethodsEnum } from './types'; +export * from './types'; diff --git a/example/elven.js b/example/elven.js index 0632a27..61415e3 100644 --- a/example/elven.js +++ b/example/elven.js @@ -1,10 +1,10 @@ -var O4=Object.create;var Ef=Object.defineProperty;var D4=Object.getOwnPropertyDescriptor;var P4=Object.getOwnPropertyNames;var R4=Object.getPrototypeOf,B4=Object.prototype.hasOwnProperty;var _S=(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 Error('Dynamic require of "'+t+'" is not supported')});var he=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)Ef(t,r,{get:e[r],enumerable:!0})},wf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of P4(e))!B4.call(t,i)&&i!==r&&Ef(t,i,{get:()=>e[i],enumerable:!(n=D4(e,i))||n.enumerable});return t},Qt=(t,e,r)=>(wf(t,e,"default"),r&&wf(r,e,"default")),Se=(t,e,r)=>(r=t!=null?O4(R4(t)):{},wf(e||!t||!t.__esModule?Ef(r,"default",{value:t,enumerable:!0}):r,t)),ht=t=>wf(Ef({},"__esModule",{value:!0}),t);var K0=v(vf=>{"use strict";l();vf.byteLength=F4;vf.toByteArray=U4;vf.fromByteArray=H4;var sn=[],Tr=[],L4=typeof Uint8Array<"u"?Uint8Array:Array,$0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Cs=0,SS=$0.length;Cs0)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 F4(t){var e=TS(t),r=e[0],n=e[1];return(r+n)*3/4-n}function M4(t,e,r){return(e+r)*3/4-r}function U4(t){var e,r=TS(t),n=r[0],i=r[1],s=new L4(M4(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=Tr[t.charCodeAt(u)]<<2|Tr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Tr[t.charCodeAt(u)]<<10|Tr[t.charCodeAt(u+1)]<<4|Tr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function q4(t){return sn[t>>18&63]+sn[t>>12&63]+sn[t>>6&63]+sn[t&63]}function V4(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(sn[e>>2]+sn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(sn[e>>10]+sn[e>>4&63]+sn[e<<2&63]+"=")),i.join("")}});var J0=v(Y0=>{l();Y0.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,g=r?-1:1,m=t[e+d];for(d+=g,s=m&(1<<-f)-1,m>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=g,f-=8);if(s===0)s=1-c;else{if(s===u)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(m?-1:1)*o*Math.pow(2,s-n)};Y0.write=function(t,e,r,n,i,s){var o,a,u,c=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,y=n?1:-1,A=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+=g/u:e+=g*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+m]=a&255,m+=y,a/=256,i-=8);for(o=o<0;t[r+m]=o&255,m+=y,o/=256,c-=8);t[r+m-y]|=A*128}});var qS=v(No=>{"use strict";l();var X0=K0(),xo=J0(),CS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;No.Buffer=$;No.SlowBuffer=W4;No.INSPECT_MAX_BYTES=50;var Af=2147483647;No.kMaxLength=Af;$.TYPED_ARRAY_SUPPORT=k4();!$.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 k4(){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($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function zn(t){if(t>Af)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(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 rm(t)}return OS(t,e,r)}$.poolSize=8192;function OS(t,e,r){if(typeof t=="string")return j4(t,e);if(ArrayBuffer.isView(t))return Q4(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(on(t,ArrayBuffer)||t&&on(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(on(t,SharedArrayBuffer)||t&&on(t.buffer,SharedArrayBuffer)))return em(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 $.from(n,e,r);var i=z4(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.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)}$.from=function(t,e,r){return OS(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function DS(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 G4(t,e,r){return DS(t),t<=0?zn(t):e!==void 0?typeof r=="string"?zn(t).fill(e,r):zn(t).fill(e):zn(t)}$.alloc=function(t,e,r){return G4(t,e,r)};function rm(t){return DS(t),zn(t<0?0:nm(t)|0)}$.allocUnsafe=function(t){return rm(t)};$.allocUnsafeSlow=function(t){return rm(t)};function j4(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=PS(t,e)|0,n=zn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Z0(t){for(var e=t.length<0?0:nm(t.length)|0,r=zn(e),n=0;n=Af)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Af.toString(16)+" bytes");return t|0}function W4(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),on(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.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?$.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function PS(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||on(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 tm(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return US(t).length;default:if(i)return n?-1:tm(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=PS;function $4(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 i5(this,e,r);case"utf8":case"utf-8":return BS(this,e,r);case"ascii":return r5(this,e,r);case"latin1":case"binary":return n5(this,e,r);case"base64":return e5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function xs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}$.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+=" ... "),""};CS&&($.prototype[CS]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.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),c=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,im(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=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:xS(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):xS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function xS(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(m,y){return s===1?m[y]:m.readUInt16BE(y*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){for(var d=!0,g=0;gi&&(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 K4(this,e,r,n);case"utf8":case"utf-8":return Y4(this,e,r,n);case"ascii":case"latin1":case"binary":return J4(this,e,r,n);case"base64":return X4(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z4(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function e5(t,e,r){return e===0&&r===t.length?X0.fromByteArray(t):X0.fromByteArray(t.slice(e,r))}function BS(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 t5(n)}var NS=4096;function t5(t){var e=t.length;if(e<=NS)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")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(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};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!1,52,8)};function lr(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.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;lr(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;lr(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};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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 LS(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 FS(t,e,r,n,i){return e=+e,r=r>>>0,i||LS(t,e,r,4,34028234663852886e22,-34028234663852886e22),xo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return FS(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return FS(this,e,r,!1,n)};function MS(t,e,r,n,i){return e=+e,r=r>>>0,i||LS(t,e,r,8,17976931348623157e292,-17976931348623157e292),xo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return MS(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return MS(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.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 u5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function US(t){return X0.toByteArray(a5(t))}function bf(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function on(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function im(t){return t!==t}var l5=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 jS=v((Gse,GS)=>{l();var vt=GS.exports={},an,un;function sm(){throw new Error("setTimeout has not been defined")}function om(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?an=setTimeout:an=sm}catch{an=sm}try{typeof clearTimeout=="function"?un=clearTimeout:un=om}catch{un=om}})();function VS(t){if(an===setTimeout)return setTimeout(t,0);if((an===sm||!an)&&setTimeout)return an=setTimeout,setTimeout(t,0);try{return an(t,0)}catch{try{return an.call(null,t,0)}catch{return an.call(this,t,0)}}}function f5(t){if(un===clearTimeout)return clearTimeout(t);if((un===om||!un)&&clearTimeout)return un=clearTimeout,clearTimeout(t);try{return un(t)}catch{try{return un.call(null,t)}catch{return un.call(this,t)}}}var Wn=[],Oo=!1,Ns,If=-1;function d5(){!Oo||!Ns||(Oo=!1,Ns.length?Wn=Ns.concat(Wn):If=-1,Wn.length&&HS())}function HS(){if(!Oo){var t=VS(d5);Oo=!0;for(var e=Wn.length;e;){for(Ns=Wn,Wn=[];++If1)for(var r=1;r{h=Se(qS()),p=Se(jS()),h5=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=h5});var Yt=v((QS,_f)=>{l();(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,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function m(S){var N,_,T,B=U.prototype={constructor:U,toString:null,valueOf:null},X=new U(1),Q=20,H=4,j=-7,K=21,me=-1e7,ce=1e7,ie=!1,J=1,oe=0,re={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},se="0123456789abcdefghijklmnopqrstuvwxyz";function U(w,E){var I,P,C,D,L,x,F,k,q=this;if(!(q instanceof U))return new U(w,E);if(E==null){if(w&&w._isBigNumber===!0){q.s=w.s,!w.c||w.e>ce?q.c=q.e=null:w.e=10;L/=10,D++);D>ce?q.c=q.e=null:(q.e=D,q.c=[w]);return}k=String(w)}else{if(!r.test(k=String(w)))return T(q,k,x);q.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(D=k.indexOf("."))>-1&&(k=k.replace(".","")),(L=k.search(/e/i))>0?(D<0&&(D=L),D+=+k.slice(L+1),k=k.substring(0,L)):D<0&&(D=k.length)}else{if(R(E,2,se.length,"Base"),E==10)return q=new U(w),ae(q,Q+q.e+1,H);if(k=String(w),x=typeof w=="number"){if(w*0!=0)return T(q,k,x,E);if(q.s=1/w<0?(k=k.slice(1),-1):1,U.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(o+w)}else q.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(I=se.slice(0,E),D=L=0,F=k.length;LD){D=F;continue}}else if(!C&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){C=!0,L=-1,D=0;continue}return T(q,String(w),x,E)}x=!1,k=_(k,E,10,q.s),(D=k.indexOf("."))>-1?k=k.replace(".",""):D=k.length}for(L=0;k.charCodeAt(L)===48;L++);for(F=k.length;k.charCodeAt(--F)===48;);if(k=k.slice(L,++F)){if(F-=L,x&&U.DEBUG&&F>15&&(w>c||w!==i(w)))throw Error(o+q.s*w);if((D=D-L-1)>ce)q.c=q.e=null;else if(D=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(E=(C+1)%u,E<1&&(E+=u),String(P[0]).length==E){for(E=0;E=a||I!==i(I))break e;if(I!==0)return!0}}}else if(P===null&&C===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+w)},U.maximum=U.max=function(){return ue(arguments,B.lt)},U.minimum=U.min=function(){return ue(arguments,B.gt)},U.random=function(){var w=9007199254740992,E=Math.random()*w&2097151?function(){return i(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(I){var P,C,D,L,x,F=0,k=[],q=new U(X);if(I==null?I=Q:R(I,0,g),L=n(I/u),ie)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(k.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(k.push(x%1e14),F+=7);F=L/7}else throw ie=!1,Error(s+"crypto unavailable");if(!ie)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(I,P,C,D,L){var x,F,k,q,ee,Ae,_e,Be,it=I.indexOf("."),dt=Q,De=H;for(it>=0&&(q=oe,oe=0,I=I.replace(".",""),Be=new U(P),Ae=Be.pow(I.length-it),oe=q,Be.c=E(b(A(Ae.c),Ae.e,"0"),10,C,w),Be.e=Be.c.length),_e=E(I,P,C,L?(x=se,w):(x=w,se)),k=q=_e.length;_e[--q]==0;_e.pop());if(!_e[0])return x.charAt(0);if(it<0?--k:(Ae.c=_e,Ae.e=k,Ae.s=D,Ae=N(Ae,Be,dt,De,C),_e=Ae.c,ee=Ae.r,k=Ae.e),F=k+dt+1,it=_e[F],q=C/2,ee=ee||F<0||_e[F+1]!=null,ee=De<4?(it!=null||ee)&&(De==0||De==(Ae.s<0?3:2)):it>q||it==q&&(De==4||ee||De==6&&_e[F-1]&1||De==(Ae.s<0?8:7)),F<1||!_e[0])I=ee?b(x.charAt(1),-dt,x.charAt(0)):x.charAt(0);else{if(_e.length=F,ee)for(--C;++_e[--F]>C;)_e[F]=0,F||(++k,_e=[1].concat(_e));for(q=_e.length;!_e[--q];);for(it=0,I="";it<=q;I+=x.charAt(_e[it++]));I=b(I,k,x.charAt(0))}return I}}(),N=function(){function w(P,C,D){var L,x,F,k,q=0,ee=P.length,Ae=C%d,_e=C/d|0;for(P=P.slice();ee--;)F=P[ee]%d,k=P[ee]/d|0,L=_e*F+k*Ae,x=Ae*F+L%d*d+q,q=(x/D|0)+(L/d|0)+_e*k,P[ee]=x%D;return q&&(P=[q].concat(P)),P}function E(P,C,D,L){var x,F;if(D!=L)F=D>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function I(P,C,D,L){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,C,D,L,x){var F,k,q,ee,Ae,_e,Be,it,dt,De,Ve,Lt,Ei,Ss,Ts,cr,Qn,Kt=P.s==C.s?1:-1,Ft=P.c,Je=C.c;if(!Ft||!Ft[0]||!Je||!Je[0])return new U(!P.s||!C.s||(Ft?Je&&Ft[0]==Je[0]:!Je)?NaN:Ft&&Ft[0]==0||!Je?Kt*0:Kt/0);for(it=new U(Kt),dt=it.c=[],k=P.e-C.e,Kt=D+k+1,x||(x=a,k=y(P.e/u)-y(C.e/u),Kt=Kt/u|0),q=0;Je[q]==(Ft[q]||0);q++);if(Je[q]>(Ft[q]||0)&&k--,Kt<0)dt.push(1),ee=!0;else{for(Ss=Ft.length,cr=Je.length,q=0,Kt+=2,Ae=i(x/(Je[0]+1)),Ae>1&&(Je=w(Je,Ae,x),Ft=w(Ft,Ae,x),cr=Je.length,Ss=Ft.length),Ei=cr,De=Ft.slice(0,cr),Ve=De.length;Ve=x/2&&Ts++;do{if(Ae=0,F=E(Je,De,cr,Ve),F<0){if(Lt=De[0],cr!=Ve&&(Lt=Lt*x+(De[1]||0)),Ae=i(Lt/Ts),Ae>1)for(Ae>=x&&(Ae=x-1),_e=w(Je,Ae,x),Be=_e.length,Ve=De.length;E(_e,De,Be,Ve)==1;)Ae--,I(_e,cr=10;Kt/=10,q++);ae(it,D+(it.e=q+k*u-1)+1,L,ee)}else it.e=k,it.r=+ee;return it}}();function fe(w,E,I,P){var C,D,L,x,F;if(I==null?I=H:R(I,0,8),!w.c)return w.toString();if(C=w.c[0],L=w.e,E==null)F=A(w.c),F=P==1||P==2&&(L<=j||L>=K)?M(F,L):b(F,L,"0");else if(w=ae(new U(w),E,I),D=w.e,F=A(w.c),x=F.length,P==1||P==2&&(E<=D||D<=j)){for(;xx){if(--E>0)for(F+=".";E--;F+="0");}else if(E+=D-x,E>0)for(D+1==x&&(F+=".");E--;F+="0");return w.s<0&&C?"-"+F:F}function ue(w,E){for(var I,P=1,C=new U(w[0]);P=10;C/=10,P++);return(I=P+I*u-1)>ce?w.c=w.e=null:I=10;x/=10,C++);if(D=E-C,D<0)D+=u,L=E,F=ee[k=0],q=F/Ae[C-L-1]%10|0;else if(k=n((D+1)/u),k>=ee.length)if(P){for(;ee.length<=k;ee.push(0));F=q=0,C=1,D%=u,L=D-u+1}else break e;else{for(F=x=ee[k],C=1;x>=10;x/=10,C++);D%=u,L=D-u+C,q=L<0?0:F/Ae[C-L-1]%10|0}if(P=P||E<0||ee[k+1]!=null||(L<0?F:F%Ae[C-L-1]),P=I<4?(q||P)&&(I==0||I==(w.s<0?3:2)):q>5||q==5&&(I==4||P||I==6&&(D>0?L>0?F/Ae[C-L]:0:ee[k-1])%10&1||I==(w.s<0?8:7)),E<1||!ee[0])return ee.length=0,P?(E-=w.e+1,ee[0]=Ae[(u-E%u)%u],w.e=-E||0):ee[0]=w.e=0,w;if(D==0?(ee.length=k,x=1,k--):(ee.length=k+1,x=Ae[u-D],ee[k]=L>0?i(F/Ae[C-L]%Ae[L])*x:0),P)for(;;)if(k==0){for(D=1,L=ee[0];L>=10;L/=10,D++);for(L=ee[0]+=x,x=1;L>=10;L/=10,x++);D!=x&&(w.e++,ee[0]==a&&(ee[0]=1));break}else{if(ee[k]+=x,ee[k]!=a)break;ee[k--]=0,x=1}for(D=ee.length;ee[--D]===0;ee.pop());}w.e>ce?w.c=w.e=null:w.e=K?M(E,I):b(E,I,"0"),w.s<0?"-"+E:E)}return B.absoluteValue=B.abs=function(){var w=new U(this);return w.s<0&&(w.s=1),w},B.comparedTo=function(w,E){return O(this,new U(w,E))},B.decimalPlaces=B.dp=function(w,E){var I,P,C,D=this;if(w!=null)return R(w,0,g),E==null?E=H:R(E,0,8),ae(new U(D),w+D.e+1,E);if(!(I=D.c))return null;if(P=((C=I.length-1)-y(this.e/u))*u,C=I[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},B.dividedBy=B.div=function(w,E){return N(this,new U(w,E),Q,H)},B.dividedToIntegerBy=B.idiv=function(w,E){return N(this,new U(w,E),0,1)},B.exponentiatedBy=B.pow=function(w,E){var I,P,C,D,L,x,F,k,q,ee=this;if(w=new U(w),w.c&&!w.isInteger())throw Error(s+"Exponent not an integer: "+le(w));if(E!=null&&(E=new U(E)),x=w.e>14,!ee.c||!ee.c[0]||ee.c[0]==1&&!ee.e&&ee.c.length==1||!w.c||!w.c[0])return q=new U(Math.pow(+le(ee),x?2-z(w):+le(w))),E?q.mod(E):q;if(F=w.s<0,E){if(E.c?!E.c[0]:!E.s)return new U(NaN);P=!F&&ee.isInteger()&&E.isInteger(),P&&(ee=ee.mod(E))}else{if(w.e>9&&(ee.e>0||ee.e<-1||(ee.e==0?ee.c[0]>1||x&&ee.c[1]>=24e7:ee.c[0]<8e13||x&&ee.c[0]<=9999975e7)))return D=ee.s<0&&z(w)?-0:0,ee.e>-1&&(D=1/D),new U(F?1/D:D);oe&&(D=n(oe/u+2))}for(x?(I=new U(.5),F&&(w.s=1),k=z(w)):(C=Math.abs(+le(w)),k=C%2),q=new U(X);;){if(k){if(q=q.times(ee),!q.c)break;D?q.c.length>D&&(q.c.length=D):P&&(q=q.mod(E))}if(C){if(C=i(C/2),C===0)break;k=C%2}else if(w=w.times(I),ae(w,w.e+1,1),w.e>14)k=z(w);else{if(C=+le(w),C===0)break;k=C%2}ee=ee.times(ee),D?ee.c&&ee.c.length>D&&(ee.c.length=D):P&&(ee=ee.mod(E))}return P?q:(F&&(q=X.div(q)),E?q.mod(E):D?ae(q,oe,H,L):q)},B.integerValue=function(w){var E=new U(this);return w==null?w=H:R(w,0,8),ae(E,E.e+1,w)},B.isEqualTo=B.eq=function(w,E){return O(this,new U(w,E))===0},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(w,E){return O(this,new U(w,E))>0},B.isGreaterThanOrEqualTo=B.gte=function(w,E){return(E=O(this,new U(w,E)))===1||E===0},B.isInteger=function(){return!!this.c&&y(this.e/u)>this.c.length-2},B.isLessThan=B.lt=function(w,E){return O(this,new U(w,E))<0},B.isLessThanOrEqualTo=B.lte=function(w,E){return(E=O(this,new U(w,E)))===-1||E===0},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&this.c[0]==0},B.minus=function(w,E){var I,P,C,D,L=this,x=L.s;if(w=new U(w,E),E=w.s,!x||!E)return new U(NaN);if(x!=E)return w.s=-E,L.plus(w);var F=L.e/u,k=w.e/u,q=L.c,ee=w.c;if(!F||!k){if(!q||!ee)return q?(w.s=-E,w):new U(ee?L:NaN);if(!q[0]||!ee[0])return ee[0]?(w.s=-E,w):new U(q[0]?L:H==3?-0:0)}if(F=y(F),k=y(k),q=q.slice(),x=F-k){for((D=x<0)?(x=-x,C=q):(k=F,C=ee),C.reverse(),E=x;E--;C.push(0));C.reverse()}else for(P=(D=(x=q.length)<(E=ee.length))?x:E,x=E=0;E0)for(;E--;q[I++]=0);for(E=a-1;P>x;){if(q[--P]=0;){for(I=0,Ae=Lt[C]%dt,_e=Lt[C]/dt|0,L=F,D=C+L;D>C;)k=Ve[--L]%dt,q=Ve[L]/dt|0,x=_e*k+q*Ae,k=Ae*k+x%dt*dt+Be[D]+I,I=(k/it|0)+(x/dt|0)+_e*q,Be[D--]=k%it;Be[D]=I}return I?++P:Be.splice(0,1),de(w,Be,P)},B.negated=function(){var w=new U(this);return w.s=-w.s||null,w},B.plus=function(w,E){var I,P=this,C=P.s;if(w=new U(w,E),E=w.s,!C||!E)return new U(NaN);if(C!=E)return w.s=-E,P.minus(w);var D=P.e/u,L=w.e/u,x=P.c,F=w.c;if(!D||!L){if(!x||!F)return new U(C/0);if(!x[0]||!F[0])return F[0]?w:new U(x[0]?P:C*0)}if(D=y(D),L=y(L),x=x.slice(),C=D-L){for(C>0?(L=D,I=F):(C=-C,I=x),I.reverse();C--;I.push(0));I.reverse()}for(C=x.length,E=F.length,C-E<0&&(I=F,F=x,x=I,E=C),C=0;E;)C=(x[--E]=x[E]+F[E]+C)/a|0,x[E]=a===x[E]?0:x[E]%a;return C&&(x=[C].concat(x),++L),de(w,x,L)},B.precision=B.sd=function(w,E){var I,P,C,D=this;if(w!=null&&w!==!!w)return R(w,1,g),E==null?E=H:R(E,0,8),ae(new U(D),w,E);if(!(I=D.c))return null;if(C=I.length-1,P=C*u+1,C=I[C]){for(;C%10==0;C/=10,P--);for(C=I[0];C>=10;C/=10,P++);}return w&&D.e+1>P&&(P=D.e+1),P},B.shiftedBy=function(w){return R(w,-c,c),this.times("1e"+w)},B.squareRoot=B.sqrt=function(){var w,E,I,P,C,D=this,L=D.c,x=D.s,F=D.e,k=Q+4,q=new U("0.5");if(x!==1||!L||!L[0])return new U(!x||x<0&&(!L||L[0])?NaN:L?D:1/0);if(x=Math.sqrt(+le(D)),x==0||x==1/0?(E=A(L),(E.length+F)%2==0&&(E+="0"),x=Math.sqrt(+E),F=y((F+1)/2)-(F<0||F%2),x==1/0?E="5e"+F:(E=x.toExponential(),E=E.slice(0,E.indexOf("e")+1)+F),I=new U(E)):I=new U(x+""),I.c[0]){for(F=I.e,x=F+k,x<3&&(x=0);;)if(C=I,I=q.times(C.plus(N(D,C,k,1))),A(C.c).slice(0,x)===(E=A(I.c)).slice(0,x))if(I.e0&&Be>0){for(D=Be%x||x,q=_e.substr(0,D);D0&&(q+=k+_e.slice(D)),Ae&&(q="-"+q)}P=ee?q+(I.decimalSeparator||"")+((F=+I.fractionGroupSize)?ee.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(I.fractionGroupSeparator||"")):ee):q}return(I.prefix||"")+P+(I.suffix||"")},B.toFraction=function(w){var E,I,P,C,D,L,x,F,k,q,ee,Ae,_e=this,Be=_e.c;if(w!=null&&(x=new U(w),!x.isInteger()&&(x.c||x.s!==1)||x.lt(X)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+le(x));if(!Be)return new U(_e);for(E=new U(X),k=I=new U(X),P=F=new U(X),Ae=A(Be),D=E.e=Ae.length-_e.e-1,E.c[0]=f[(L=D%u)<0?u+L:L],w=!w||x.comparedTo(E)>0?D>0?E:k:x,L=ce,ce=1/0,x=new U(Ae),F.c[0]=0;q=N(x,E,0,1),C=I.plus(q.times(P)),C.comparedTo(w)!=1;)I=P,P=C,k=F.plus(q.times(C=k)),F=C,E=x.minus(q.times(C=E)),x=C;return C=N(w.minus(I),P,0,1),F=F.plus(C.times(k)),I=I.plus(C.times(P)),F.s=k.s=_e.s,D=D*2,ee=N(k,P,D,H).minus(_e).abs().comparedTo(N(F,I,D,H).minus(_e).abs())<1?[k,P]:[F,I],ce=L,ee},B.toNumber=function(){return+le(this)},B.toPrecision=function(w,E){return w!=null&&R(w,1,g),fe(this,w,E,2)},B.toString=function(w){var E,I=this,P=I.s,C=I.e;return C===null?P?(E="Infinity",P<0&&(E="-"+E)):E="NaN":(w==null?E=C<=j||C>=K?M(A(I.c),C):b(A(I.c),C,"0"):w===10?(I=ae(new U(I),Q+C+1,H),E=b(A(I.c),I.e,"0")):(R(w,2,se.length,"Base"),E=_(b(A(I.c),C,"0"),10,w,P,!0)),P<0&&I.c[0]&&(E="-"+E)),E},B.valueOf=B.toJSON=function(){return le(this)},B._isBigNumber=!0,S!=null&&U.set(S),U}function y(S){var N=S|0;return S>0||S===N?N:N-1}function A(S){for(var N,_,T=1,B=S.length,X=S[0]+"";TK^_?1:-1;for(H=(j=B.length)<(K=X.length)?j:K,Q=0;QX[Q]^_?1:-1;return j==K?0:j>K^_?1:-1}function R(S,N,_,T){if(S_||S!==i(S))throw Error(s+(T||"Argument")+(typeof S=="number"?S_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(S))}function z(S){var N=S.c.length-1;return y(S.e/u)==N&&S.c[N]%2!=0}function M(S,N){return(S.length>1?S.charAt(0)+"."+S.slice(1):S)+(N<0?"e":"e+")+N}function b(S,N,_){var T,B;if(N<0){for(B=_+".";++N;B+=_);S=B+S}else if(T=S.length,++N>T){for(B=_,N-=T;--N;B+=_);S+=B}else N{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrIsCompletedFieldIsMissingOnTransaction=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 Pe=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=Pe;var am=class extends Pe{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=am;var um=class extends Pe{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=um;var cm=class extends Pe{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=cm;var lm=class extends Pe{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=lm;var fm=class extends Pe{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=fm;var dm=class extends Pe{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=dm;var hm=class extends Pe{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=hm;var pm=class extends Pe{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=pm;var gm=class extends Pe{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=gm;var ym=class extends Pe{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=ym;var mm=class extends Pe{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=mm;var wm=class extends Pe{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=wm;var Em=class extends Pe{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=Em;var vm=class extends Pe{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=vm;var Am=class extends Pe{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=Am;var bm=class extends Pe{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=bm;var Im=class extends Pe{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=Im;var _m=class extends Pe{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=_m;var Sm=class extends Pe{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=Sm;var Sf=class extends Pe{constructor(e){super(e)}};pe.ErrContract=Sf;var Tm=class extends Sf{constructor(){super(` +var D4=Object.create;var Ef=Object.defineProperty;var P4=Object.getOwnPropertyDescriptor;var R4=Object.getOwnPropertyNames;var B4=Object.getPrototypeOf,L4=Object.prototype.hasOwnProperty;var TS=(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 Error('Dynamic require of "'+t+'" is not supported')});var he=(t,e)=>()=>(t&&(e=t(t=0)),e);var A=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)Ef(t,r,{get:e[r],enumerable:!0})},wf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of R4(e))!L4.call(t,i)&&i!==r&&Ef(t,i,{get:()=>e[i],enumerable:!(n=P4(e,i))||n.enumerable});return t},Qt=(t,e,r)=>(wf(t,e,"default"),r&&wf(r,e,"default")),be=(t,e,r)=>(r=t!=null?D4(B4(t)):{},wf(e||!t||!t.__esModule?Ef(r,"default",{value:t,enumerable:!0}):r,t)),ht=t=>wf(Ef({},"__esModule",{value:!0}),t);var $0=A(vf=>{"use strict";l();vf.byteLength=M4;vf.toByteArray=q4;vf.fromByteArray=k4;var sn=[],Tr=[],F4=typeof Uint8Array<"u"?Uint8Array:Array,W0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Cs=0,CS=W0.length;Cs0)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 M4(t){var e=xS(t),r=e[0],n=e[1];return(r+n)*3/4-n}function U4(t,e,r){return(e+r)*3/4-r}function q4(t){var e,r=xS(t),n=r[0],i=r[1],s=new F4(U4(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=Tr[t.charCodeAt(u)]<<2|Tr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Tr[t.charCodeAt(u)]<<10|Tr[t.charCodeAt(u+1)]<<4|Tr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function V4(t){return sn[t>>18&63]+sn[t>>12&63]+sn[t>>6&63]+sn[t&63]}function H4(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(sn[e>>2]+sn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(sn[e>>10]+sn[e>>4&63]+sn[e<<2&63]+"=")),i.join("")}});var Y0=A(K0=>{l();K0.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,g=r?-1:1,m=t[e+d];for(d+=g,s=m&(1<<-f)-1,m>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=g,f-=8);if(s===0)s=1-c;else{if(s===u)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(m?-1:1)*o*Math.pow(2,s-n)};K0.write=function(t,e,r,n,i,s){var o,a,u,c=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,y=n?1:-1,b=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+=g/u:e+=g*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+m]=a&255,m+=y,a/=256,i-=8);for(o=o<0;t[r+m]=o&255,m+=y,o/=256,c-=8);t[r+m-y]|=b*128}});var HS=A(No=>{"use strict";l();var J0=$0(),xo=Y0(),NS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;No.Buffer=$;No.SlowBuffer=$4;No.INSPECT_MAX_BYTES=50;var Af=2147483647;No.kMaxLength=Af;$.TYPED_ARRAY_SUPPORT=G4();!$.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 G4(){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($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function zn(t){if(t>Af)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(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 tm(t)}return PS(t,e,r)}$.poolSize=8192;function PS(t,e,r){if(typeof t=="string")return Q4(t,e);if(ArrayBuffer.isView(t))return z4(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(on(t,ArrayBuffer)||t&&on(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(on(t,SharedArrayBuffer)||t&&on(t.buffer,SharedArrayBuffer)))return Z0(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 $.from(n,e,r);var i=W4(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.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)}$.from=function(t,e,r){return PS(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function RS(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 j4(t,e,r){return RS(t),t<=0?zn(t):e!==void 0?typeof r=="string"?zn(t).fill(e,r):zn(t).fill(e):zn(t)}$.alloc=function(t,e,r){return j4(t,e,r)};function tm(t){return RS(t),zn(t<0?0:rm(t)|0)}$.allocUnsafe=function(t){return tm(t)};$.allocUnsafeSlow=function(t){return tm(t)};function Q4(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=BS(t,e)|0,n=zn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function X0(t){for(var e=t.length<0?0:rm(t.length)|0,r=zn(e),n=0;n=Af)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Af.toString(16)+" bytes");return t|0}function $4(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),on(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.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?$.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function BS(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||on(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 em(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return VS(t).length;default:if(i)return n?-1:em(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=BS;function K4(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 s5(this,e,r);case"utf8":case"utf-8":return FS(this,e,r);case"ascii":return n5(this,e,r);case"latin1":case"binary":return i5(this,e,r);case"base64":return t5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function xs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}$.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+=" ... "),""};NS&&($.prototype[NS]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(on(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.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),c=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,nm(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=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:OS(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):OS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function OS(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(m,y){return s===1?m[y]:m.readUInt16BE(y*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){for(var d=!0,g=0;gi&&(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 Y4(this,e,r,n);case"utf8":case"utf-8":return J4(this,e,r,n);case"ascii":case"latin1":case"binary":return X4(this,e,r,n);case"base64":return Z4(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function t5(t,e,r){return e===0&&r===t.length?J0.fromByteArray(t):J0.fromByteArray(t.slice(e,r))}function FS(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 r5(n)}var DS=4096;function r5(t){var e=t.length;if(e<=DS)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")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ut(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ut(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};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Ut(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ut(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ut(e,4,this.length),xo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ut(e,8,this.length),xo.read(this,e,!1,52,8)};function lr(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.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;lr(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;lr(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};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);lr(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};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||lr(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 MS(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 US(t,e,r,n,i){return e=+e,r=r>>>0,i||MS(t,e,r,4,34028234663852886e22,-34028234663852886e22),xo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return US(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return US(this,e,r,!1,n)};function qS(t,e,r,n,i){return e=+e,r=r>>>0,i||MS(t,e,r,8,17976931348623157e292,-17976931348623157e292),xo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return qS(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return qS(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.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 c5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function VS(t){return J0.toByteArray(u5(t))}function bf(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function on(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function nm(t){return t!==t}var f5=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 zS=A(($se,QS)=>{l();var vt=QS.exports={},an,un;function im(){throw new Error("setTimeout has not been defined")}function sm(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?an=setTimeout:an=im}catch{an=im}try{typeof clearTimeout=="function"?un=clearTimeout:un=sm}catch{un=sm}})();function kS(t){if(an===setTimeout)return setTimeout(t,0);if((an===im||!an)&&setTimeout)return an=setTimeout,setTimeout(t,0);try{return an(t,0)}catch{try{return an.call(null,t,0)}catch{return an.call(this,t,0)}}}function d5(t){if(un===clearTimeout)return clearTimeout(t);if((un===sm||!un)&&clearTimeout)return un=clearTimeout,clearTimeout(t);try{return un(t)}catch{try{return un.call(null,t)}catch{return un.call(this,t)}}}var Wn=[],Oo=!1,Ns,If=-1;function h5(){!Oo||!Ns||(Oo=!1,Ns.length?Wn=Ns.concat(Wn):If=-1,Wn.length&&GS())}function GS(){if(!Oo){var t=kS(h5);Oo=!0;for(var e=Wn.length;e;){for(Ns=Wn,Wn=[];++If1)for(var r=1;r{h=be(HS()),p=be(zS()),p5=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=p5});var Yt=A((WS,_f)=>{l();(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,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function m(S){var N,_,T,B=U.prototype={constructor:U,toString:null,valueOf:null},X=new U(1),Q=20,H=4,j=-7,K=21,me=-1e7,ce=1e7,ie=!1,J=1,oe=0,re={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},se="0123456789abcdefghijklmnopqrstuvwxyz";function U(w,v){var I,P,C,D,L,x,F,k,q=this;if(!(q instanceof U))return new U(w,v);if(v==null){if(w&&w._isBigNumber===!0){q.s=w.s,!w.c||w.e>ce?q.c=q.e=null:w.e=10;L/=10,D++);D>ce?q.c=q.e=null:(q.e=D,q.c=[w]);return}k=String(w)}else{if(!r.test(k=String(w)))return T(q,k,x);q.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(D=k.indexOf("."))>-1&&(k=k.replace(".","")),(L=k.search(/e/i))>0?(D<0&&(D=L),D+=+k.slice(L+1),k=k.substring(0,L)):D<0&&(D=k.length)}else{if(R(v,2,se.length,"Base"),v==10)return q=new U(w),ae(q,Q+q.e+1,H);if(k=String(w),x=typeof w=="number"){if(w*0!=0)return T(q,k,x,v);if(q.s=1/w<0?(k=k.slice(1),-1):1,U.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(o+w)}else q.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(I=se.slice(0,v),D=L=0,F=k.length;LD){D=F;continue}}else if(!C&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){C=!0,L=-1,D=0;continue}return T(q,String(w),x,v)}x=!1,k=_(k,v,10,q.s),(D=k.indexOf("."))>-1?k=k.replace(".",""):D=k.length}for(L=0;k.charCodeAt(L)===48;L++);for(F=k.length;k.charCodeAt(--F)===48;);if(k=k.slice(L,++F)){if(F-=L,x&&U.DEBUG&&F>15&&(w>c||w!==i(w)))throw Error(o+q.s*w);if((D=D-L-1)>ce)q.c=q.e=null;else if(D=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||I!==i(I))break e;if(I!==0)return!0}}}else if(P===null&&C===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+w)},U.maximum=U.max=function(){return ue(arguments,B.lt)},U.minimum=U.min=function(){return ue(arguments,B.gt)},U.random=function(){var w=9007199254740992,v=Math.random()*w&2097151?function(){return i(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(I){var P,C,D,L,x,F=0,k=[],q=new U(X);if(I==null?I=Q:R(I,0,g),L=n(I/u),ie)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(k.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(k.push(x%1e14),F+=7);F=L/7}else throw ie=!1,Error(s+"crypto unavailable");if(!ie)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(I,P,C,D,L){var x,F,k,q,ee,Ae,Se,Be,it=I.indexOf("."),dt=Q,De=H;for(it>=0&&(q=oe,oe=0,I=I.replace(".",""),Be=new U(P),Ae=Be.pow(I.length-it),oe=q,Be.c=v(E(b(Ae.c),Ae.e,"0"),10,C,w),Be.e=Be.c.length),Se=v(I,P,C,L?(x=se,w):(x=w,se)),k=q=Se.length;Se[--q]==0;Se.pop());if(!Se[0])return x.charAt(0);if(it<0?--k:(Ae.c=Se,Ae.e=k,Ae.s=D,Ae=N(Ae,Be,dt,De,C),Se=Ae.c,ee=Ae.r,k=Ae.e),F=k+dt+1,it=Se[F],q=C/2,ee=ee||F<0||Se[F+1]!=null,ee=De<4?(it!=null||ee)&&(De==0||De==(Ae.s<0?3:2)):it>q||it==q&&(De==4||ee||De==6&&Se[F-1]&1||De==(Ae.s<0?8:7)),F<1||!Se[0])I=ee?E(x.charAt(1),-dt,x.charAt(0)):x.charAt(0);else{if(Se.length=F,ee)for(--C;++Se[--F]>C;)Se[F]=0,F||(++k,Se=[1].concat(Se));for(q=Se.length;!Se[--q];);for(it=0,I="";it<=q;I+=x.charAt(Se[it++]));I=E(I,k,x.charAt(0))}return I}}(),N=function(){function w(P,C,D){var L,x,F,k,q=0,ee=P.length,Ae=C%d,Se=C/d|0;for(P=P.slice();ee--;)F=P[ee]%d,k=P[ee]/d|0,L=Se*F+k*Ae,x=Ae*F+L%d*d+q,q=(x/D|0)+(L/d|0)+Se*k,P[ee]=x%D;return q&&(P=[q].concat(P)),P}function v(P,C,D,L){var x,F;if(D!=L)F=D>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function I(P,C,D,L){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,C,D,L,x){var F,k,q,ee,Ae,Se,Be,it,dt,De,Ve,Lt,Ei,Ss,Ts,cr,Qn,Kt=P.s==C.s?1:-1,Ft=P.c,Je=C.c;if(!Ft||!Ft[0]||!Je||!Je[0])return new U(!P.s||!C.s||(Ft?Je&&Ft[0]==Je[0]:!Je)?NaN:Ft&&Ft[0]==0||!Je?Kt*0:Kt/0);for(it=new U(Kt),dt=it.c=[],k=P.e-C.e,Kt=D+k+1,x||(x=a,k=y(P.e/u)-y(C.e/u),Kt=Kt/u|0),q=0;Je[q]==(Ft[q]||0);q++);if(Je[q]>(Ft[q]||0)&&k--,Kt<0)dt.push(1),ee=!0;else{for(Ss=Ft.length,cr=Je.length,q=0,Kt+=2,Ae=i(x/(Je[0]+1)),Ae>1&&(Je=w(Je,Ae,x),Ft=w(Ft,Ae,x),cr=Je.length,Ss=Ft.length),Ei=cr,De=Ft.slice(0,cr),Ve=De.length;Ve=x/2&&Ts++;do{if(Ae=0,F=v(Je,De,cr,Ve),F<0){if(Lt=De[0],cr!=Ve&&(Lt=Lt*x+(De[1]||0)),Ae=i(Lt/Ts),Ae>1)for(Ae>=x&&(Ae=x-1),Se=w(Je,Ae,x),Be=Se.length,Ve=De.length;v(Se,De,Be,Ve)==1;)Ae--,I(Se,cr=10;Kt/=10,q++);ae(it,D+(it.e=q+k*u-1)+1,L,ee)}else it.e=k,it.r=+ee;return it}}();function fe(w,v,I,P){var C,D,L,x,F;if(I==null?I=H:R(I,0,8),!w.c)return w.toString();if(C=w.c[0],L=w.e,v==null)F=b(w.c),F=P==1||P==2&&(L<=j||L>=K)?M(F,L):E(F,L,"0");else if(w=ae(new U(w),v,I),D=w.e,F=b(w.c),x=F.length,P==1||P==2&&(v<=D||D<=j)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=D-x,v>0)for(D+1==x&&(F+=".");v--;F+="0");return w.s<0&&C?"-"+F:F}function ue(w,v){for(var I,P=1,C=new U(w[0]);P=10;C/=10,P++);return(I=P+I*u-1)>ce?w.c=w.e=null:I=10;x/=10,C++);if(D=v-C,D<0)D+=u,L=v,F=ee[k=0],q=F/Ae[C-L-1]%10|0;else if(k=n((D+1)/u),k>=ee.length)if(P){for(;ee.length<=k;ee.push(0));F=q=0,C=1,D%=u,L=D-u+1}else break e;else{for(F=x=ee[k],C=1;x>=10;x/=10,C++);D%=u,L=D-u+C,q=L<0?0:F/Ae[C-L-1]%10|0}if(P=P||v<0||ee[k+1]!=null||(L<0?F:F%Ae[C-L-1]),P=I<4?(q||P)&&(I==0||I==(w.s<0?3:2)):q>5||q==5&&(I==4||P||I==6&&(D>0?L>0?F/Ae[C-L]:0:ee[k-1])%10&1||I==(w.s<0?8:7)),v<1||!ee[0])return ee.length=0,P?(v-=w.e+1,ee[0]=Ae[(u-v%u)%u],w.e=-v||0):ee[0]=w.e=0,w;if(D==0?(ee.length=k,x=1,k--):(ee.length=k+1,x=Ae[u-D],ee[k]=L>0?i(F/Ae[C-L]%Ae[L])*x:0),P)for(;;)if(k==0){for(D=1,L=ee[0];L>=10;L/=10,D++);for(L=ee[0]+=x,x=1;L>=10;L/=10,x++);D!=x&&(w.e++,ee[0]==a&&(ee[0]=1));break}else{if(ee[k]+=x,ee[k]!=a)break;ee[k--]=0,x=1}for(D=ee.length;ee[--D]===0;ee.pop());}w.e>ce?w.c=w.e=null:w.e=K?M(v,I):E(v,I,"0"),w.s<0?"-"+v:v)}return B.absoluteValue=B.abs=function(){var w=new U(this);return w.s<0&&(w.s=1),w},B.comparedTo=function(w,v){return O(this,new U(w,v))},B.decimalPlaces=B.dp=function(w,v){var I,P,C,D=this;if(w!=null)return R(w,0,g),v==null?v=H:R(v,0,8),ae(new U(D),w+D.e+1,v);if(!(I=D.c))return null;if(P=((C=I.length-1)-y(this.e/u))*u,C=I[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},B.dividedBy=B.div=function(w,v){return N(this,new U(w,v),Q,H)},B.dividedToIntegerBy=B.idiv=function(w,v){return N(this,new U(w,v),0,1)},B.exponentiatedBy=B.pow=function(w,v){var I,P,C,D,L,x,F,k,q,ee=this;if(w=new U(w),w.c&&!w.isInteger())throw Error(s+"Exponent not an integer: "+le(w));if(v!=null&&(v=new U(v)),x=w.e>14,!ee.c||!ee.c[0]||ee.c[0]==1&&!ee.e&&ee.c.length==1||!w.c||!w.c[0])return q=new U(Math.pow(+le(ee),x?2-z(w):+le(w))),v?q.mod(v):q;if(F=w.s<0,v){if(v.c?!v.c[0]:!v.s)return new U(NaN);P=!F&&ee.isInteger()&&v.isInteger(),P&&(ee=ee.mod(v))}else{if(w.e>9&&(ee.e>0||ee.e<-1||(ee.e==0?ee.c[0]>1||x&&ee.c[1]>=24e7:ee.c[0]<8e13||x&&ee.c[0]<=9999975e7)))return D=ee.s<0&&z(w)?-0:0,ee.e>-1&&(D=1/D),new U(F?1/D:D);oe&&(D=n(oe/u+2))}for(x?(I=new U(.5),F&&(w.s=1),k=z(w)):(C=Math.abs(+le(w)),k=C%2),q=new U(X);;){if(k){if(q=q.times(ee),!q.c)break;D?q.c.length>D&&(q.c.length=D):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;k=C%2}else if(w=w.times(I),ae(w,w.e+1,1),w.e>14)k=z(w);else{if(C=+le(w),C===0)break;k=C%2}ee=ee.times(ee),D?ee.c&&ee.c.length>D&&(ee.c.length=D):P&&(ee=ee.mod(v))}return P?q:(F&&(q=X.div(q)),v?q.mod(v):D?ae(q,oe,H,L):q)},B.integerValue=function(w){var v=new U(this);return w==null?w=H:R(w,0,8),ae(v,v.e+1,w)},B.isEqualTo=B.eq=function(w,v){return O(this,new U(w,v))===0},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(w,v){return O(this,new U(w,v))>0},B.isGreaterThanOrEqualTo=B.gte=function(w,v){return(v=O(this,new U(w,v)))===1||v===0},B.isInteger=function(){return!!this.c&&y(this.e/u)>this.c.length-2},B.isLessThan=B.lt=function(w,v){return O(this,new U(w,v))<0},B.isLessThanOrEqualTo=B.lte=function(w,v){return(v=O(this,new U(w,v)))===-1||v===0},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&this.c[0]==0},B.minus=function(w,v){var I,P,C,D,L=this,x=L.s;if(w=new U(w,v),v=w.s,!x||!v)return new U(NaN);if(x!=v)return w.s=-v,L.plus(w);var F=L.e/u,k=w.e/u,q=L.c,ee=w.c;if(!F||!k){if(!q||!ee)return q?(w.s=-v,w):new U(ee?L:NaN);if(!q[0]||!ee[0])return ee[0]?(w.s=-v,w):new U(q[0]?L:H==3?-0:0)}if(F=y(F),k=y(k),q=q.slice(),x=F-k){for((D=x<0)?(x=-x,C=q):(k=F,C=ee),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(D=(x=q.length)<(v=ee.length))?x:v,x=v=0;v0)for(;v--;q[I++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(I=0,Ae=Lt[C]%dt,Se=Lt[C]/dt|0,L=F,D=C+L;D>C;)k=Ve[--L]%dt,q=Ve[L]/dt|0,x=Se*k+q*Ae,k=Ae*k+x%dt*dt+Be[D]+I,I=(k/it|0)+(x/dt|0)+Se*q,Be[D--]=k%it;Be[D]=I}return I?++P:Be.splice(0,1),de(w,Be,P)},B.negated=function(){var w=new U(this);return w.s=-w.s||null,w},B.plus=function(w,v){var I,P=this,C=P.s;if(w=new U(w,v),v=w.s,!C||!v)return new U(NaN);if(C!=v)return w.s=-v,P.minus(w);var D=P.e/u,L=w.e/u,x=P.c,F=w.c;if(!D||!L){if(!x||!F)return new U(C/0);if(!x[0]||!F[0])return F[0]?w:new U(x[0]?P:C*0)}if(D=y(D),L=y(L),x=x.slice(),C=D-L){for(C>0?(L=D,I=F):(C=-C,I=x),I.reverse();C--;I.push(0));I.reverse()}for(C=x.length,v=F.length,C-v<0&&(I=F,F=x,x=I,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),de(w,x,L)},B.precision=B.sd=function(w,v){var I,P,C,D=this;if(w!=null&&w!==!!w)return R(w,1,g),v==null?v=H:R(v,0,8),ae(new U(D),w,v);if(!(I=D.c))return null;if(C=I.length-1,P=C*u+1,C=I[C]){for(;C%10==0;C/=10,P--);for(C=I[0];C>=10;C/=10,P++);}return w&&D.e+1>P&&(P=D.e+1),P},B.shiftedBy=function(w){return R(w,-c,c),this.times("1e"+w)},B.squareRoot=B.sqrt=function(){var w,v,I,P,C,D=this,L=D.c,x=D.s,F=D.e,k=Q+4,q=new U("0.5");if(x!==1||!L||!L[0])return new U(!x||x<0&&(!L||L[0])?NaN:L?D:1/0);if(x=Math.sqrt(+le(D)),x==0||x==1/0?(v=b(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=y((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),I=new U(v)):I=new U(x+""),I.c[0]){for(F=I.e,x=F+k,x<3&&(x=0);;)if(C=I,I=q.times(C.plus(N(D,C,k,1))),b(C.c).slice(0,x)===(v=b(I.c)).slice(0,x))if(I.e0&&Be>0){for(D=Be%x||x,q=Se.substr(0,D);D0&&(q+=k+Se.slice(D)),Ae&&(q="-"+q)}P=ee?q+(I.decimalSeparator||"")+((F=+I.fractionGroupSize)?ee.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(I.fractionGroupSeparator||"")):ee):q}return(I.prefix||"")+P+(I.suffix||"")},B.toFraction=function(w){var v,I,P,C,D,L,x,F,k,q,ee,Ae,Se=this,Be=Se.c;if(w!=null&&(x=new U(w),!x.isInteger()&&(x.c||x.s!==1)||x.lt(X)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+le(x));if(!Be)return new U(Se);for(v=new U(X),k=I=new U(X),P=F=new U(X),Ae=b(Be),D=v.e=Ae.length-Se.e-1,v.c[0]=f[(L=D%u)<0?u+L:L],w=!w||x.comparedTo(v)>0?D>0?v:k:x,L=ce,ce=1/0,x=new U(Ae),F.c[0]=0;q=N(x,v,0,1),C=I.plus(q.times(P)),C.comparedTo(w)!=1;)I=P,P=C,k=F.plus(q.times(C=k)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(w.minus(I),P,0,1),F=F.plus(C.times(k)),I=I.plus(C.times(P)),F.s=k.s=Se.s,D=D*2,ee=N(k,P,D,H).minus(Se).abs().comparedTo(N(F,I,D,H).minus(Se).abs())<1?[k,P]:[F,I],ce=L,ee},B.toNumber=function(){return+le(this)},B.toPrecision=function(w,v){return w!=null&&R(w,1,g),fe(this,w,v,2)},B.toString=function(w){var v,I=this,P=I.s,C=I.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(w==null?v=C<=j||C>=K?M(b(I.c),C):E(b(I.c),C,"0"):w===10?(I=ae(new U(I),Q+C+1,H),v=E(b(I.c),I.e,"0")):(R(w,2,se.length,"Base"),v=_(E(b(I.c),C,"0"),10,w,P,!0)),P<0&&I.c[0]&&(v="-"+v)),v},B.valueOf=B.toJSON=function(){return le(this)},B._isBigNumber=!0,S!=null&&U.set(S),U}function y(S){var N=S|0;return S>0||S===N?N:N-1}function b(S){for(var N,_,T=1,B=S.length,X=S[0]+"";TK^_?1:-1;for(H=(j=B.length)<(K=X.length)?j:K,Q=0;QX[Q]^_?1:-1;return j==K?0:j>K^_?1:-1}function R(S,N,_,T){if(S_||S!==i(S))throw Error(s+(T||"Argument")+(typeof S=="number"?S_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(S))}function z(S){var N=S.c.length-1;return y(S.e/u)==N&&S.c[N]%2!=0}function M(S,N){return(S.length>1?S.charAt(0)+"."+S.slice(1):S)+(N<0?"e":"e+")+N}function E(S,N,_){var T,B;if(N<0){for(B=_+".";++N;B+=_);S=B+S}else if(T=S.length,++N>T){for(B=_,N-=T;--N;B+=_);S+=B}else N{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrIsCompletedFieldIsMissingOnTransaction=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 Pe=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=Pe;var om=class extends Pe{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=om;var am=class extends Pe{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=am;var um=class extends Pe{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=um;var cm=class extends Pe{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=cm;var lm=class extends Pe{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=lm;var fm=class extends Pe{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=fm;var dm=class extends Pe{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=dm;var hm=class extends Pe{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=hm;var pm=class extends Pe{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=pm;var gm=class extends Pe{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=gm;var ym=class extends Pe{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=ym;var mm=class extends Pe{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=mm;var wm=class extends Pe{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=wm;var Em=class extends Pe{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=Em;var vm=class extends Pe{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=vm;var Am=class extends Pe{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=Am;var bm=class extends Pe{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=bm;var Im=class extends Pe{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=Im;var _m=class extends Pe{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=_m;var Sf=class extends Pe{constructor(e){super(e)}};pe.ErrContract=Sf;var Sm=class extends Sf{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). -`)}};pe.ErrContractHasNoAddress=Tm;var Cm=class extends Pe{constructor(e){super(e)}};pe.ErrMock=Cm;var xm=class extends Pe{constructor(e){super(e)}};pe.ErrTypingSystem=xm;var Nm=class extends Pe{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=Nm;var Om=class extends Pe{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=Om;var Dm=class extends Pe{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Dm;var Pm=class extends Pe{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=Pm;var Rm=class extends Pe{constructor(e){super(e)}};pe.ErrCodec=Rm;var Bm=class extends Pe{constructor(e){super(e)}};pe.ErrContractInteraction=Bm;var Lm=class extends Pe{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Lm;var Fm=class extends Pe{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Fm;var Mm=class extends Pe{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=Mm;var Um=class extends Pe{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=Um;var qm=class extends Pe{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};pe.ErrIsCompletedFieldIsMissingOnTransaction=qm});var Hm=v(vi=>{"use strict";l();var p5=vi&&vi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vi,"__esModule",{value:!0});vi.TokenPayment=vi.TokenTransfer=void 0;var ju=p5(Yt()),g5=Le(),zS="EGLD",WS=18;ju.default.set({ROUNDING_MODE:1});var Tf=class t{constructor(e){let r=new ju.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new g5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new ju.default(e).shiftedBy(WS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:zS,nonce:0,amountAsBigInteger:e,numDecimals:WS})}static fungibleFromAmount(e,r,n){let i=new ju.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new ju.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({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==zS}isFungible(){return this.nonce==0}};vi.TokenTransfer=Tf;var Vm=class extends Tf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};vi.TokenPayment=Vm});var Os=v(Xe=>{"use strict";l();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ARGUMENTS_SEPARATOR=Xe.ESDT_TRANSFER_VALUE=Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_GAS_LIMIT=Xe.TRANSACTION_VERSION_WITH_OPTIONS=Xe.TRANSACTION_VERSION_DEFAULT=Xe.TRANSACTION_OPTIONS_TX_GUARDED=Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=Xe.TRANSACTION_OPTIONS_DEFAULT=Xe.TRANSACTION_MIN_GAS_PRICE=void 0;Xe.TRANSACTION_MIN_GAS_PRICE=1e9;Xe.TRANSACTION_OPTIONS_DEFAULT=0;Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;Xe.TRANSACTION_OPTIONS_TX_GUARDED=2;Xe.TRANSACTION_VERSION_DEFAULT=1;Xe.TRANSACTION_VERSION_WITH_OPTIONS=2;Xe.ESDT_TRANSFER_GAS_LIMIT=5e5;Xe.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";Xe.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";Xe.ESDT_TRANSFER_VALUE="0";Xe.ARGUMENTS_SEPARATOR="@"});var br=v(ot=>{"use strict";l();var y5=ot&&ot.__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]}),m5=ot&&ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w5=ot&&ot.__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)&&y5(e,t,r);return m5(e,t),e};Object.defineProperty(ot,"__esModule",{value:!0});ot.isEmpty=ot.guardEmpty=ot.guardNotEmpty=ot.guardLength=ot.guardSameLength=ot.guardValueIsSetWithMessage=ot.guardValueIsSet=ot.guardTrue=void 0;var Do=w5(Le());function E5(t,e){if(!t)throw new Do.ErrInvariantFailed(`[<${e}>] isn't true`)}ot.guardTrue=E5;function v5(t,e){$S(`${t} isn't set (null or undefined)`,e)}ot.guardValueIsSet=v5;function $S(t,e){if(e==null||e===void 0)throw new Do.ErrInvariantFailed(t)}ot.guardValueIsSetWithMessage=$S;function A5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Do.ErrInvariantFailed("arrays do not have the same length")}ot.guardSameLength=A5;function b5(t,e){let r=t.length||0;if(r!=e)throw new Do.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}ot.guardLength=b5;function I5(t,e){if(km(t))throw new Do.ErrInvariantFailed(`${e} is empty`)}ot.guardNotEmpty=I5;function _5(t,e){if(!km(t))throw new Do.ErrInvariantFailed(`${e} is not empty`)}ot.guardEmpty=_5;function km(t){return t.isEmpty?t.isEmpty():t.length===0}ot.isEmpty=km});var KS=v(Cf=>{"use strict";l();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.getJavascriptPrototypesInHierarchy=void 0;function S5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Cf.getJavascriptPrototypesInHierarchy=S5});var Ct=v(Tt=>{"use strict";l();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.NullType=Tt.TypePlaceholder=Tt.isTyped=Tt.PrimitiveValue=Tt.TypedValue=Tt.CustomType=Tt.PrimitiveType=Tt.TypeCardinality=Tt.Type=void 0;var Gm=KS(),YS=br(),Ai=class t{constructor(e,r=[],n=Qu.fixed(1)){YS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return Gm.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 YS.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 t.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(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Gm.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(){}};Tt.Type=Ai;Ai.ClassName="Type";var Qu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(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||t.MaxCardinality}};Tt.TypeCardinality=Qu;Qu.MaxCardinality=4096;var xf=class t extends Ai{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveType=xf;xf.ClassName="PrimitiveType";var Nf=class t extends Ai{getClassName(){return t.ClassName}};Tt.CustomType=Nf;Nf.ClassName="CustomType";var zu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return Gm.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(){}};Tt.TypedValue=zu;zu.ClassName="TypedValue";var Of=class t extends zu{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveValue=Of;Of.ClassName="PrimitiveValue";function T5(t){return t.belongsToTypesystem!==void 0}Tt.isTyped=T5;var Df=class t extends Ai{constructor(){super("...")}getClassName(){return t.ClassName}};Tt.TypePlaceholder=Df;Df.ClassName="TypePlaceholder";var Pf=class t extends Ai{constructor(){super("?")}getClassName(){return t.ClassName}};Tt.NullType=Pf;Pf.ClassName="NullType"});var JS=v((Po,Ro)=>{l();(function(t){var e=typeof Po=="object"&&Po&&!Po.nodeType&&Po,r=typeof Ro=="object"&&Ro&&!Ro.nodeType&&Ro,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,c=38,f=700,d=72,g=128,m="-",y=/^xn--/,A=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=o-a,M=Math.floor,b=String.fromCharCode,S;function N(J){throw new RangeError(R[J])}function _(J,oe){for(var re=J.length,se=[];re--;)se[re]=oe(J[re]);return se}function T(J,oe){var re=J.split("@"),se="";re.length>1&&(se=re[0]+"@",J=re[1]),J=J.replace(O,".");var U=J.split("."),fe=_(U,oe).join(".");return se+fe}function B(J){for(var oe=[],re=0,se=J.length,U,fe;re=55296&&U<=56319&&re65535&&(oe-=65536,re+=b(oe>>>10&1023|55296),oe=56320|oe&1023),re+=b(oe),re}).join("")}function Q(J){return J-48<10?J-22:J-65<26?J-65:J-97<26?J-97:o}function H(J,oe){return J+22+75*(J<26)-((oe!=0)<<5)}function j(J,oe,re){var se=0;for(J=re?M(J/f):J>>1,J+=M(J/oe);J>z*u>>1;se+=o)J=M(J/z);return M(se+(z+1)*J/(J+c))}function K(J){var oe=[],re=J.length,se,U=0,fe=g,ue=d,de,ae,le,w,E,I,P,C,D;for(de=J.lastIndexOf(m),de<0&&(de=0),ae=0;ae=128&&N("not-basic"),oe.push(J.charCodeAt(ae));for(le=de>0?de+1:0;le=re&&N("invalid-input"),P=Q(J.charCodeAt(le++)),(P>=o||P>M((s-U)/E))&&N("overflow"),U+=P*E,C=I<=ue?a:I>=ue+u?u:I-ue,!(PM(s/D)&&N("overflow"),E*=D;se=oe.length+1,ue=j(U-w,se,w==0),M(U/se)>s-fe&&N("overflow"),fe+=M(U/se),U%=se,oe.splice(U++,0,fe)}return X(oe)}function me(J){var oe,re,se,U,fe,ue,de,ae,le,w,E,I=[],P,C,D,L;for(J=B(J),P=J.length,oe=g,re=0,fe=d,ue=0;ue=oe&&EM((s-re)/C)&&N("overflow"),re+=(de-oe)*C,oe=de,ue=0;ues&&N("overflow"),E==oe){for(ae=re,le=o;w=le<=fe?a:le>=fe+u?u:le-fe,!(ae{"use strict";l();var ZS=JS();function C5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function jm(t){return t>="0"&&t<="7"}function x5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function XS(t){return t=parseInt(t,16),ZS.ucs2.encode([t])}function eT(t,e,r){var n=!1,i=[];function s(u){var c=t[u];if(!x5(c))throw new C5(u,"Unexpected token ILLEGAL");return c}for(;e{l();var iT=tT();aT.exports={validate:N5,parse:O5};function N5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Rf(t,0,e,!1)}catch(n){r=n.message}return r}function O5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Rf(t,0,e,!0);return r.value}function sT(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function B5(t,e,r,n){for(var i=e,s=",",o=[],a=e;Ds(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Rf(t,i,r,n),c=sT(t,u.end);n&&o.push(u.value),i=c.end,s=c.value}return{start:e,end:i,value:o}}function L5(t,e){return t.substr(e,4)==="true"}function F5(t,e){return t.substr(e,5)==="false"}function M5(t,e){return t.substr(e,4)==="null"}var U5=new RegExp(/^\s$/);function Ds(t){return U5.test(t)}var q5=new RegExp(/^\d$/);function rT(t){return q5.test(t)}function Kn(t,e,r){var n=10,i;t.length{"use strict";l();var V5=cn&&cn.__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]}),H5=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k5=cn&&cn.__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)&&V5(e,t,r);return H5(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.TypeExpressionParser=void 0;var cT=k5(Le()),G5=Ct(),j5=uT(),zm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new cT.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return j5.parse(r)}catch{throw new cT.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 G5.Type(e,n)}};cn.TypeExpressionParser=zm});var $m=v(bi=>{"use strict";l();Object.defineProperty(bi,"__esModule",{value:!0});bi.EndpointParameterDefinition=bi.EndpointModifiers=bi.EndpointDefinition=void 0;var Q5=Wu(),lT="?",z5="N / A",Wm=class t{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?lT:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>$u.fromJSON(s)),n=e.outputs.map(s=>$u.fromJSON(s)),i=new Bf(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};bi.EndpointDefinition=Wm;var Bf=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}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"}isOnlyOwner(){return this.onlyOwner}};bi.EndpointModifiers=Bf;var $u=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Q5.TypeExpressionParser().parse(e.type);return new t(e.name||lT,e.description||z5,r)}};bi.EndpointParameterDefinition=$u});var Bo=v(fr=>{"use strict";l();var W5=fr&&fr.__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]}),$5=fr&&fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K5=fr&&fr.__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)&&W5(e,t,r);return $5(e,t),e};Object.defineProperty(fr,"__esModule",{value:!0});fr.Fields=fr.Field=fr.FieldDefinition=void 0;var Km=K5(Le()),Y5=Wu(),Ym=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Y5.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};fr.FieldDefinition=Ym;var Jm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Km.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Km.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};fr.Field=Jm;var Xm=class{static checkTyping(e,r){if(e.length!=r.length)throw new Km.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";l();Object.defineProperty(Ii,"__esModule",{value:!0});Ii.EnumValue=Ii.EnumVariantDefinition=Ii.EnumType=void 0;var J5=Le(),Zm=br(),Lf=Bo(),dT=Ct(),fT=256,Ff=class t extends dT.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>Mf.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>Object.assign(Object.assign({},n),{discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Zm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Zm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};Ii.EnumType=Ff;Ff.ClassName="EnumType";var Mf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Zm.guardTrue(rLf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Lf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ii.EnumVariantDefinition=Mf;var Uf=class t extends dT.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();Lf.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(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=Lf.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 J5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};Ii.EnumValue=Uf;Uf.ClassName="EnumValue"});var pT=v(Lo=>{"use strict";l();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.EventTopicDefinition=Lo.EventDefinition=void 0;var X5=Wu(),hT="?",ew=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?hT:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>qf.fromJSON(n));return new t(e.identifier,r)}};Lo.EventDefinition=ew;var qf=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new X5.TypeExpressionParser().parse(e.type);return new t({name:e.name||hT,type:r,indexed:e.indexed})}};Lo.EventTopicDefinition=qf});var Mo=v(Fo=>{"use strict";l();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Struct=Fo.StructType=void 0;var Z5=Le(),Vf=Bo(),gT=Ct(),Hf=class t extends gT.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Vf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Vf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Fo.StructType=Hf;Hf.ClassName="StructType";var kf=class t extends gT.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Vf.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 Z5.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 Vf.Fields.equals(r,n)}};Fo.Struct=kf;kf.ClassName="Struct"});var rw=v((boe,wT)=>{"use strict";l();var jf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tw={};for(Yu=0;Yu>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 yT(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Uo(e)^n>>5}for(e=Uo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=yT(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=Uo(n)^o,i+=jf.charAt(o)}for(s=0;s<6;++s)n=Uo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=jf.charAt(a)}return i}function mT(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=yT(s);if(typeof a=="string")return a;for(var u=[],c=0;c=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function tq(){var t=mT.apply(null,arguments);if(typeof t=="object")return t}function rq(t){var e=mT.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Qf(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";l();var aq=ln&&ln.__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]}),uq=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ET=ln&&ln.__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)&&aq(e,t,r);return uq(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.Address=void 0;var qo=ET(rw()),Vo=ET(Le()),zf="erd",Wf=32,cq="0".repeat(16),nw=class t{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 Vo.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!=Wf)throw new Vo.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==Wf}static fromHex(e){if(!t.isValidHex(e))throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=qo.decode(e)}catch(s){throw new Vo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=zf)throw new Vo.ErrAddressBadHrp(zf,n);let i=h.Buffer.from(qo.fromWords(r.words));if(i.length!=Wf)throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}static isValid(e){let r=qo.decodeUnsafe(e),n=r?.prefix,i=r?h.Buffer.from(qo.fromWords(r.words)):void 0;return!(n!==zf||i?.length!==Wf)}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=qo.toWords(this.pubkey());return qo.encode(zf,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(cq)}};ln.Address=nw});var ko=v(Ho=>{"use strict";l();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.AddressValue=Ho.AddressType=void 0;var lq=pt(),vT=Ct(),Ju=class t extends vT.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Ho.AddressType=Ju;Ju.ClassName="AddressType";var $f=class t extends vT.PrimitiveValue{constructor(e){super(new Ju),this.value=new lq.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ho.AddressValue=$f;$f.ClassName="AddressValue"});var Yf=v(Go=>{"use strict";l();Object.defineProperty(Go,"__esModule",{value:!0});Go.OptionalValue=Go.OptionalType=void 0;var fq=br(),Xu=Ct(),Zu=class t extends Xu.Type{constructor(e){super("Optional",[e],Xu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Xu.NullType.ClassName);return r||n}};Go.OptionalType=Zu;Zu.ClassName="OptionalType";var Kf=class t extends Xu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Zu(new Xu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return fq.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}};Go.OptionalValue=Kf;Kf.ClassName="OptionalValue"});var tc=v(jo=>{"use strict";l();Object.defineProperty(jo,"__esModule",{value:!0});jo.BooleanValue=jo.BooleanType=void 0;var AT=Ct(),ec=class t extends AT.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};jo.BooleanType=ec;ec.ClassName="BooleanType";var Jf=class t extends AT.PrimitiveValue{constructor(e){super(new ec),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};jo.BooleanValue=Jf;Jf.ClassName="BooleanValue"});var _i=v(Qo=>{"use strict";l();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.BytesValue=Qo.BytesType=void 0;var bT=Ct(),rc=class t extends bT.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Qo.BytesType=rc;rc.ClassName="BytesType";var Xf=class t extends bT.PrimitiveValue{constructor(e){super(new rc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new t(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()}};Qo.BytesValue=Xf;Xf.ClassName="BytesValue"});var _T=v(zo=>{"use strict";l();Object.defineProperty(zo,"__esModule",{value:!0});zo.CodeMetadataValue=zo.CodeMetadataType=void 0;var IT=Ct(),Zf=class extends IT.PrimitiveType{constructor(){super("CodeMetadata")}};zo.CodeMetadataType=Zf;var iw=class extends IT.PrimitiveValue{constructor(e){super(new Zf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};zo.CodeMetadataValue=iw});var td=v(Wo=>{"use strict";l();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.CompositeValue=Wo.CompositeType=void 0;var dq=br(),sw=Ct(),nc=class t extends sw.Type{constructor(...e){super("Composite",e,sw.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Wo.CompositeType=nc;nc.ClassName="CompositeType";var ed=class t extends sw.TypedValue{constructor(e,r){super(e),dq.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new nc(...r);return new t(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";l();Object.defineProperty(rd,"__esModule",{value:!0});rd.CollectionOfTypedValues=void 0;var ow=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";l();Object.defineProperty(fn,"__esModule",{value:!0});fn.List=fn.OptionValue=fn.ListType=fn.OptionType=void 0;var hq=br(),pq=aw(),Rs=Ct(),Ps=class t extends Rs.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Rs.NullType.ClassName);return r||n}};fn.OptionType=Ps;Ps.ClassName="OptionType";var ic=class t extends Rs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};fn.ListType=ic;ic.ClassName="ListType";var nd=class t extends Rs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Ps(new Rs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Ps(e))}static newProvided(e){let r=new Ps(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return hq.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}};fn.OptionValue=nd;nd.ClassName="OptionValue";var id=class t extends Rs.TypedValue{constructor(e,r){super(e),this.backingCollection=new pq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Rs.TypePlaceholder,[]);let r=e[0].getType(),n=new ic(r);return new t(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)}};fn.List=id;id.ClassName="List"});var ad=v($o=>{"use strict";l();Object.defineProperty($o,"__esModule",{value:!0});$o.ArrayVec=$o.ArrayVecType=void 0;var ST=br(),gq=aw(),TT=Ct(),sd=class t extends TT.Type{constructor(e,r){super("Array",[r]),ST.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};$o.ArrayVecType=sd;sd.ClassName="ArrayVecType";var od=class t extends TT.TypedValue{constructor(e,r){super(e),ST.guardLength(r,e.length),this.backingCollection=new gq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};$o.ArrayVec=od;od.ClassName="ArrayVec"});var ac=v(Ko=>{"use strict";l();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.H256Value=Ko.H256Type=void 0;var CT=Ct(),oc=class t extends CT.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Ko.H256Type=oc;oc.ClassName="H256Type";var ud=class t extends CT.PrimitiveValue{constructor(e){super(new oc),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ko.H256Value=ud;ud.ClassName="H256Value"});var ld=v(Yo=>{"use strict";l();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.NothingValue=Yo.NothingType=void 0;var xT=Ct(),uc=class t extends xT.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Yo.NothingType=uc;uc.ClassName="NothingType";var cd=class t extends xT.PrimitiveValue{constructor(){super(new uc)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Yo.NothingValue=cd;cd.ClassName="NothingValue"});var Ec=v(Ce=>{"use strict";l();var yq=Ce&&Ce.__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]}),mq=Ce&&Ce.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wq=Ce&&Ce.__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)&&yq(e,t,r);return mq(e,t),e},Eq=Ce&&Ce.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.BigIntValue=Ce.BigUIntValue=Ce.I64Value=Ce.U64Value=Ce.I32Value=Ce.U32Value=Ce.I16Value=Ce.U16Value=Ce.I8Value=Ce.U8Value=Ce.NumericalValue=Ce.BigIntType=Ce.BigUIntType=Ce.I64Type=Ce.U64Type=Ce.I32Type=Ce.U32Type=Ce.I16Type=Ce.U16Type=Ce.I8Type=Ce.U8Type=Ce.NumericalType=void 0;var NT=wq(Le()),OT=Ct(),Bs=Eq(Yt()),dr=class t extends OT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ce.NumericalType=dr;dr.ClassName="NumericalType";var cc=class t extends dr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ce.U8Type=cc;cc.ClassName="U8Type";var lc=class t extends dr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ce.I8Type=lc;lc.ClassName="I8Type";var fc=class t extends dr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ce.U16Type=fc;fc.ClassName="U16Type";var dc=class t extends dr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ce.I16Type=dc;dc.ClassName="I16Type";var hc=class t extends dr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ce.U32Type=hc;hc.ClassName="U32Type";var pc=class t extends dr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ce.I32Type=pc;pc.ClassName="I32Type";var gc=class t extends dr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ce.U64Type=gc;gc.ClassName="U64Type";var yc=class t extends dr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ce.I64Type=yc;yc.ClassName="I64Type";var mc=class t extends dr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ce.BigUIntType=mc;mc.ClassName="BigUIntType";var wc=class t extends dr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ce.BigIntType=wc;wc.ClassName="BigIntType";var hr=class t extends OT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Bs.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new NT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new NT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ce.NumericalValue=hr;hr.ClassName="NumericalValue";var fd=class t extends hr{constructor(e){super(new cc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U8Value=fd;fd.ClassName="U8Value";var dd=class t extends hr{constructor(e){super(new lc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I8Value=dd;dd.ClassName="I8Value";var hd=class t extends hr{constructor(e){super(new fc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U16Value=hd;hd.ClassName="U16Value";var pd=class t extends hr{constructor(e){super(new dc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I16Value=pd;pd.ClassName="I16Value";var gd=class t extends hr{constructor(e){super(new hc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U32Value=gd;gd.ClassName="U32Value";var yd=class t extends hr{constructor(e){super(new pc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I32Value=yd;yd.ClassName="I32Value";var md=class t extends hr{constructor(e){super(new gc,e)}getClassName(){return t.ClassName}};Ce.U64Value=md;md.ClassName="U64Value";var wd=class t extends hr{constructor(e){super(new yc,e)}getClassName(){return t.ClassName}};Ce.I64Value=wd;wd.ClassName="I64Value";var Ed=class t extends hr{constructor(e){super(new mc,e)}getClassName(){return t.ClassName}};Ce.BigUIntValue=Ed;Ed.ClassName="BigUIntValue";var vd=class t extends hr{constructor(e){super(new wc,e)}getClassName(){return t.ClassName}};Ce.BigIntValue=vd;vd.ClassName="BigIntValue"});var bd=v(Jo=>{"use strict";l();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.StringValue=Jo.StringType=void 0;var DT=Ct(),vc=class t extends DT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Jo.StringType=vc;vc.ClassName="StringType";var Ad=class t extends DT.PrimitiveValue{constructor(e){super(new vc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Jo.StringValue=Ad;Ad.ClassName="StringValue"});var Zo=v(Xo=>{"use strict";l();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.TokenIdentifierValue=Xo.TokenIdentifierType=void 0;var PT=Ct(),vq="EGLD",Ac=class t extends PT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Xo.TokenIdentifierType=Ac;Ac.ClassName="TokenIdentifierType";var Id=class t extends PT.PrimitiveValue{constructor(e){super(new Ac),this.value=e}static egld(){return new t(vq)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.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()}};Xo.TokenIdentifierValue=Id;Id.ClassName="TokenIdentifierValue"});var Sd=v(Cr=>{"use strict";l();var Aq=Cr&&Cr.__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]}),bq=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iq=Cr&&Cr.__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)&&Aq(e,t,r);return bq(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Tuple=Cr.TupleType=void 0;var _q=Iq(Le()),RT=Bo(),BT=Mo(),bc=class t extends BT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new RT.FieldDefinition(LT(i),"anonymous tuple field",n))}};Cr.TupleType=bc;bc.ClassName="TupleType";function LT(t){return`field${t}`}var _d=class t extends BT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new _q.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new bc(...r),i=e.map((s,o)=>new RT.Field(s,LT(o)));return new t(n,i)}};Cr.Tuple=_d;_d.ClassName="Tuple"});var xd=v(Si=>{"use strict";l();Object.defineProperty(Si,"__esModule",{value:!0});Si.VariadicValue=Si.CountedVariadicType=Si.VariadicType=void 0;var ea=Ct(),Ls=class t extends ea.Type{constructor(e,r=!1){super("Variadic",[e],ea.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};Si.VariadicType=Ls;Ls.ClassName="VariadicType";var Td=class extends ea.Type{constructor(e){super("Variadic",[e],ea.TypeCardinality.variable())}getClassName(){return Ls.ClassName}};Si.CountedVariadicType=Td;Td.ClassName="VariadicType";var Cd=class t extends ea.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Ls(new ea.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Ls(n,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";l();var Sq=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]}),Tq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cq=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)&&Sq(e,t,r);return Tq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.TypeMapper=void 0;var FT=Cq(Le()),xq=ko(),uw=Yf(),Nq=tc(),Oq=_i(),Dq=_T(),Nd=td(),cw=Ku(),Pq=Bo(),MT=sc(),dn=ad(),Rq=ac(),UT=ld(),xr=Ec(),Bq=bd(),qT=Mo(),VT=Zo(),Ti=Sd(),Od=xd(),lw=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new MT.OptionType(r[0])],["List",(...r)=>new MT.ListType(r[0])],["VarArgs",(...r)=>new Od.VariadicType(r[0])],["MultiResultVec",(...r)=>new Od.VariadicType(r[0])],["variadic",(...r)=>new Od.VariadicType(r[0])],["counted-variadic",(...r)=>new Od.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new uw.OptionalType(r[0])],["optional",(...r)=>new uw.OptionalType(r[0])],["OptionalResult",(...r)=>new uw.OptionalType(r[0])],["multi",(...r)=>new Nd.CompositeType(...r)],["MultiArg",(...r)=>new Nd.CompositeType(...r)],["MultiResult",(...r)=>new Nd.CompositeType(...r)],["multi",(...r)=>new Nd.CompositeType(...r)],["tuple",(...r)=>new Ti.TupleType(...r)],["tuple2",(...r)=>new Ti.TupleType(...r)],["tuple3",(...r)=>new Ti.TupleType(...r)],["tuple4",(...r)=>new Ti.TupleType(...r)],["tuple5",(...r)=>new Ti.TupleType(...r)],["tuple6",(...r)=>new Ti.TupleType(...r)],["tuple7",(...r)=>new Ti.TupleType(...r)],["tuple8",(...r)=>new Ti.TupleType(...r)],["array2",(...r)=>new dn.ArrayVecType(2,r[0])],["array8",(...r)=>new dn.ArrayVecType(8,r[0])],["array16",(...r)=>new dn.ArrayVecType(16,r[0])],["array20",(...r)=>new dn.ArrayVecType(20,r[0])],["array32",(...r)=>new dn.ArrayVecType(32,r[0])],["array46",(...r)=>new dn.ArrayVecType(46,r[0])],["array48",(...r)=>new dn.ArrayVecType(48,r[0])],["array64",(...r)=>new dn.ArrayVecType(64,r[0])],["array128",(...r)=>new dn.ArrayVecType(128,r[0])],["array256",(...r)=>new dn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new xr.U8Type],["u16",new xr.U16Type],["u32",new xr.U32Type],["u64",new xr.U64Type],["U64",new xr.U64Type],["BigUint",new xr.BigUIntType],["i8",new xr.I8Type],["i16",new xr.I16Type],["i32",new xr.I32Type],["i64",new xr.I64Type],["Bigint",new xr.BigIntType],["BigInt",new xr.BigIntType],["bool",new Nq.BooleanType],["bytes",new Oq.BytesType],["Address",new xq.AddressType],["H256",new Rq.H256Type],["utf-8 string",new Bq.StringType],["TokenIdentifier",new VT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new VT.TokenIdentifierType],["CodeMetadata",new Dq.CodeMetadataType],["nothing",new UT.NothingType],["AsyncCall",new UT.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 FT.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(cw.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(qT.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 qT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new cw.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new cw.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new Pq.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 FT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};hn.TypeMapper=lw});var QT=v(pn=>{"use strict";l();var Lq=pn&&pn.__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]}),Fq=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mq=pn&&pn.__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)&&Lq(e,t,r);return Fq(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.AbiRegistry=void 0;var HT=Mq(Le()),Ic=br(),_c=$m(),kT=Ku(),dw=pT(),GT=Mo(),Uq=fw(),qq="?",hw=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||qq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=e.events||[],a=_c.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),u=i.map(m=>_c.EndpointDefinition.fromJSON(m)),c=[];for(let m in s){let y=s[m];if(y.type=="struct")c.push(GT.StructType.fromJSON({name:m,fields:y.fields}));else if(y.type=="enum"||y.type=="explicit-enum")c.push(kT.EnumType.fromJSON({name:m,variants:y.variants}));else throw new HT.ErrTypingSystem(`Cannot handle custom type: ${m}`)}let f=o.map(m=>dw.EventDefinition.fromJSON(m));return new t({name:r,constructorDefinition:a,endpoints:u,customTypes:c,events:f}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Ic.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(GT.StructType.ClassName));return Ic.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(kT.EnumType.ClassName));return Ic.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 Ic.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Ic.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new Uq.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new HT.ErrTypingSystem("Did not re-map all custom types");let n=jT(this.constructorDefinition,e),i=[];for(let a of this.endpoints)i.push(jT(a,e));let s=this.events.map(a=>Vq(a,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r,events:s})}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(c=>c.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};pn.AbiRegistry=hw;function jT(t,e){let r=t.input.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new _c.EndpointDefinition(t.name,r,n,t.modifiers)}function Vq(t,e){let r=t.inputs.map(n=>new dw.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new dw.EventDefinition(t.identifier,r)}});var WT=v(ta=>{"use strict";l();Object.defineProperty(ta,"__esModule",{value:!0});ta.createListOfTokenIdentifiers=ta.createListOfAddresses=void 0;var Hq=ko(),zT=sc(),kq=Zo();function Gq(t){let e=t.map(n=>new Hq.AddressValue(n));return zT.List.fromItems(e)}ta.createListOfAddresses=Gq;function jq(t){let e=t.map(n=>new kq.TokenIdentifierValue(n));return zT.List.fromItems(e)}ta.createListOfTokenIdentifiers=jq});var aC=v(Jt=>{"use strict";l();var Qq=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]}),zq=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wq=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)&&Qq(e,t,r);return zq(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.onPrimitiveTypeSelect=Jt.onPrimitiveValueSelect=Jt.onTypedValueSelect=Jt.onTypeSelect=void 0;var Pd=Wq(Le()),$T=ko(),KT=tc(),YT=_i(),JT=Ku(),Dd=sc(),XT=ac(),ZT=Ec(),eC=ld(),tC=Mo(),rC=Zo(),nC=Sd(),iC=Ct(),sC=ad(),oC=bd();function $q(t,e){if(t.hasExactClass(Dd.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Dd.ListType.ClassName))return e.onList();if(t.hasExactClass(sC.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(iC.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(tC.StructType.ClassName))return e.onStruct();if(t.hasExactClass(nC.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(JT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't known: ${t}`)}Jt.onTypeSelect=$q;function Kq(t,e){if(t.hasClassOrSuperclass(iC.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Dd.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Dd.List.ClassName))return e.onList();if(t.hasExactClass(sC.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(tC.Struct.ClassName))return e.onStruct();if(t.hasExactClass(nC.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(JT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't typed: ${t}`)}Jt.onTypedValueSelect=Kq;function Yq(t,e){if(t.hasExactClass(KT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(ZT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass($T.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(YT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(oC.StringValue.ClassName))return e.onString();if(t.hasExactClass(XT.H256Value.ClassName))return e.onH256();if(t.hasExactClass(rC.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(eC.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Jt.onPrimitiveValueSelect=Yq;function Jq(t,e){if(t.hasExactClass(KT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(ZT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass($T.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(YT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(oC.StringType.ClassName))return e.onString();if(t.hasExactClass(XT.H256Type.ClassName))return e.onH256();if(t.hasExactClass(rC.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(eC.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Jt.onPrimitiveTypeSelect=Jq});var xt=v(He=>{"use strict";l();var Xq=He&&He.__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]}),at=He&&He.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xq(e,t,r)};Object.defineProperty(He,"__esModule",{value:!0});at(QT(),He);at(ko(),He);at(Yf(),He);at(tc(),He);at(_i(),He);at(td(),He);at($m(),He);at(Ku(),He);at(WT(),He);at(Bo(),He);at(sc(),He);at(ad(),He);at(ac(),He);at(aC(),He);at(ld(),He);at(Ec(),He);at(bd(),He);at(Mo(),He);at(Zo(),He);at(Sd(),He);at(Wu(),He);at(fw(),He);at(Ct(),He);at(xd(),He)});var cC=v(gn=>{"use strict";l();var Zq=gn&&gn.__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]}),eV=gn&&gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tV=gn&&gn.__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)&&Zq(e,t,r);return eV(e,t),e};Object.defineProperty(gn,"__esModule",{value:!0});gn.OptionValueBinaryCodec=void 0;var uC=tV(Le()),Rd=xt(),pw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Rd.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new uC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Rd.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Rd.OptionValue(r);if(e[0]!=1)throw new uC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Rd.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([])}};gn.OptionValueBinaryCodec=pw});var lC=v(Bd=>{"use strict";l();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.AddressBinaryCodec=void 0;var rV=pt(),nV=xt(),gw=class{decodeNested(e){let r=e.slice(0,32),n=new rV.Address(r);return[new nV.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()}};Bd.AddressBinaryCodec=gw});var dC=v(yn=>{"use strict";l();var iV=yn&&yn.__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]}),sV=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oV=yn&&yn.__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)&&iV(e,t,r);return sV(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.BooleanBinaryCodec=void 0;var aV=oV(Le()),fC=xt(),Sc=class t{decodeNested(e){let r=e.readUInt8(0);return[new fC.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new aV.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new fC.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([])}};yn.BooleanBinaryCodec=Sc;Sc.TRUE=1;Sc.FALSE=0});var Fd=v(Ld=>{"use strict";l();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.SizeOfU32=void 0;Ld.SizeOfU32=4});var Md=v(mn=>{"use strict";l();var uV=mn&&mn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mn,"__esModule",{value:!0});mn.zeroPadStringIfOddLength=mn.isPaddedHex=mn.numberToPaddedHex=void 0;var cV=uV(Yt());function lV(t){let e=new cV.default(t).toString(16);return hC(e)}mn.numberToPaddedHex=lV;function fV(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}mn.isPaddedHex=fV;function hC(t){return t=t||"",t.length%2==1?"0"+t:t}mn.zeroPadStringIfOddLength=hC});var Tc=v(Nt=>{"use strict";l();var dV=Nt&&Nt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.prependByteToBuffer=Nt.flipBufferBitsInPlace=Nt.getHexMagnitudeOfBigInt=Nt.bigIntToBuffer=Nt.bufferToBigInt=Nt.cloneBuffer=Nt.isMsbZero=Nt.isMsbOne=void 0;var yw=dV(Yt()),hV=Md();function pC(t,e=0){return t[e]>>7==1}Nt.isMsbOne=pC;function pV(t,e=0){return!pC(t,e)}Nt.isMsbZero=pV;function gV(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Nt.cloneBuffer=gV;function yV(t){let e=t.toString("hex");return new yw.default(`0x${e}`,16)}Nt.bufferToBigInt=yV;function mV(t){let e=gC(t);return h.Buffer.from(e,"hex")}Nt.bigIntToBuffer=mV;function gC(t){return t=new yw.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new yw.default(-1))),hV.numberToPaddedHex(t)):""}Nt.getHexMagnitudeOfBigInt=gC;function wV(t){for(let e=0;e{"use strict";l();var vV=ra&&ra.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ra,"__esModule",{value:!0});ra.NumericalBinaryCodec=void 0;var Cc=vV(Yt()),mw=xt(),yC=Fd(),At=Tc(),ww=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=yC.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=At.cloneBuffer(e);if(e.length==0)return new mw.NumericalValue(r,new Cc.default(0));if(!r.withSign||At.isMsbZero(n)){let c=At.bufferToBigInt(n);return new mw.NumericalValue(r,c)}At.flipBufferBitsInPlace(n);let u=At.bufferToBigInt(n).multipliedBy(new Cc.default(-1)).minus(new Cc.default(1));return new mw.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(yC.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=At.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=At.bigIntToBuffer(e.value);At.isMsbOne(o)&&(o=At.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new Cc.default(1)),i=At.bigIntToBuffer(n);At.flipBufferBitsInPlace(i),At.isMsbZero(i)&&(i=At.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):At.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=At.bigIntToBuffer(e.value);return At.isMsbOne(i)&&(i=At.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Cc.default(1)),n=At.bigIntToBuffer(r);return At.flipBufferBitsInPlace(n),At.isMsbZero(n)&&(n=At.prependByteToBuffer(n,255)),n}};ra.NumericalBinaryCodec=ww});var wC=v(Ud=>{"use strict";l();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.H256BinaryCodec=void 0;var AV=ac(),Ew=class{decodeNested(e){let r=e.slice(0,32);return[new AV.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Ud.H256BinaryCodec=Ew});var Hd=v(Vd=>{"use strict";l();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.BytesBinaryCodec=void 0;var EC=_i(),qd=Fd(),vw=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(qd.SizeOfU32,qd.SizeOfU32+r);return[new EC.BytesValue(n),qd.SizeOfU32+r]}decodeTopLevel(e){return new EC.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(qd.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Vd.BytesBinaryCodec=vw});var AC=v(kd=>{"use strict";l();Object.defineProperty(kd,"__esModule",{value:!0});kd.TokenIdentifierCodec=void 0;var bV=_i(),vC=Zo(),IV=Hd(),Aw=class{constructor(){this.bytesCodec=new IV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new vC.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new vC.TokenIdentifierValue(r.toString())}encodeNested(e){let r=bV.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};kd.TokenIdentifierCodec=Aw});var IC=v(Gd=>{"use strict";l();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.NothingCodec=void 0;var bC=xt(),bw=class{decodeNested(){return[new bC.NothingValue,0]}decodeTopLevel(){return new bC.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Gd.NothingCodec=bw});var SC=v(jd=>{"use strict";l();Object.defineProperty(jd,"__esModule",{value:!0});jd.StringBinaryCodec=void 0;var _C=xt(),_V=_i(),SV=Hd(),Iw=class{constructor(){this.bytesBinaryCodec=new SV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new _C.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new _C.StringValue(e.toString())}encodeNested(e){let r=_V.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};jd.StringBinaryCodec=Iw});var TC=v(zd=>{"use strict";l();Object.defineProperty(zd,"__esModule",{value:!0});zd.PrimitiveBinaryCodec=void 0;var Qd=xt(),TV=lC(),CV=dC(),xV=mC(),NV=wC(),OV=Hd(),DV=AC(),PV=IC(),RV=SC(),_w=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new CV.BooleanBinaryCodec,this.numericalCodec=new xV.NumericalBinaryCodec,this.addressCodec=new TV.AddressBinaryCodec,this.h256Codec=new NV.H256BinaryCodec,this.bytesCodec=new OV.BytesBinaryCodec,this.stringCodec=new RV.StringBinaryCodec,this.tokenIdentifierCodec=new DV.TokenIdentifierCodec,this.nothingCodec=new PV.NothingCodec}decodeNested(e,r){return Qd.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 Qd.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 Qd.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 Qd.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()})}};zd.PrimitiveBinaryCodec=_w});var NC=v(Wd=>{"use strict";l();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.ListBinaryCodec=void 0;var CC=xt(),xC=Fd(),Sw=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=xC.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 CC.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(xC.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)}};Wd.ListBinaryCodec=Sw});var Cw=v($d=>{"use strict";l();Object.defineProperty($d,"__esModule",{value:!0});$d.FieldsBinaryCodec=void 0;var BV=xt(),Tw=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 BV.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)}};$d.FieldsBinaryCodec=Tw});var Nw=v(Kd=>{"use strict";l();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.StructBinaryCodec=void 0;var LV=xt(),FV=Cw(),xw=class{constructor(e){this.fieldsCodec=new FV.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 LV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Kd.StructBinaryCodec=xw});var OC=v(Jd=>{"use strict";l();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.EnumBinaryCodec=void 0;var Yd=xt(),MV=Cw(),Ow=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new MV.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 Yd.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Yd.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Yd.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 Yd.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};Jd.EnumBinaryCodec=Ow});var DC=v(Xd=>{"use strict";l();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TupleBinaryCodec=void 0;var UV=Nw(),Dw=class{constructor(e){this.structCodec=new UV.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)}};Xd.TupleBinaryCodec=Dw});var PC=v(Zd=>{"use strict";l();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ArrayVecBinaryCodec=void 0;var qV=xt(),Pw=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";l();var VV=Nr&&Nr.__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]}),HV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kV=Nr&&Nr.__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)&&VV(e,t,r);return HV(e,t),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.BinaryCodecConstraints=Nr.BinaryCodec=void 0;var RC=kV(Le()),eh=xt(),BC=br(),GV=cC(),jV=TC(),QV=NC(),zV=Nw(),WV=OC(),$V=DC(),KV=PC(),Rw=class{constructor(e=null){this.constraints=e||new th,this.optionCodec=new GV.OptionValueBinaryCodec(this),this.listCodec=new QV.ListBinaryCodec(this),this.arrayCodec=new KV.ArrayVecBinaryCodec(this),this.primitiveCodec=new jV.PrimitiveBinaryCodec(this),this.structCodec=new zV.StructBinaryCodec(this),this.tupleCodec=new $V.TupleBinaryCodec(this),this.enumCodec=new WV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),eh.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]=eh.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 BC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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 BC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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)})}};Nr.BinaryCodec=Rw;var th=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new RC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new RC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Nr.BinaryCodecConstraints=th});var LC=v(Or=>{"use strict";l();var YV=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var JV=YV(Yt()),rh=xt(),XV=Bw(),nh=new XV.BinaryCodec;function ZV(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=ZV;function eH(t){return!!nh.decodeTopLevel(t,new rh.BooleanType).valueOf()}Or.decodeBool=eH;function tH(t){let e=nh.decodeTopLevel(t,new rh.BytesType);return String(e.valueOf())}Or.decodeString=tH;function rH(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return new JV.default(e.valueOf())}Or.decodeBigNumber=rH});var Lw=v(Ci=>{"use strict";l();var nH=Ci&&Ci.__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]}),FC=Ci&&Ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nH(e,t,r)};Object.defineProperty(Ci,"__esModule",{value:!0});FC(Bw(),Ci);FC(LC(),Ci)});var na=v(ih=>{"use strict";l();Object.defineProperty(ih,"__esModule",{value:!0});ih.ArgSerializer=void 0;var MC=Os(),iH=Lw(),UC=xt(),Fw=Yf(),Mw=td(),Uw=xd(),sH={codec:new iH.BinaryCodec},qw=class{constructor(e){e=Object.assign(Object.assign({},sH),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(MC.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 d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(MC.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 o of e)i(o);function i(o){if(o.hasExactClass(Fw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(Uw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(Mw.CompositeValue.ClassName)){let u=o;for(let c of u.getItems())i(c);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new UC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};ih.ArgSerializer=qw});var ah=v(oh=>{"use strict";l();Object.defineProperty(oh,"__esModule",{value:!0});oh.Compatibility=void 0;var oH=pt(),sh=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()==oH.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.`))}};oh.Compatibility=sh;sh.areWarningsEnabled=!0});var qC=v(wn=>{"use strict";l();var aH=wn&&wn.__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]}),uH=wn&&wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cH=wn&&wn.__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)&&aH(e,t,r);return uH(e,t),e};Object.defineProperty(wn,"__esModule",{value:!0});wn.Hash=void 0;var lH=cH(Le()),Vw=class t{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 lH.ErrBadType("hash","buffer | string",e)}static empty(){return new t(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};wn.Hash=Vw});var xc=v(Dr=>{"use strict";l();var fH=Dr&&Dr.__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]}),dH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hH=Dr&&Dr.__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)&&fH(e,t,r);return dH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionOptions=Dr.TransactionVersion=void 0;var Wr=Os(),VC=hH(Le()),Hw=class t{constructor(e){if(e=Number(e),e<1)throw new VC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Wr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Wr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Dr.TransactionVersion=Hw;var kw=class t{constructor(e){if(e=Number(e),e<0)throw new VC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Wr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Wr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_GUARDED)==Wr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Wr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dr.TransactionOptions=kw});var kC=v((due,HC)=>{"use strict";l();HC.exports=pH;function pH(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";l();var uh=QC;uh.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 ia=new Array(64),jC=new Array(123);for($r=0;$r<64;)jC[ia[$r]=$r<26?$r+65:$r<52?$r+71:$r<62?$r-4:$r-59|43]=$r++;var $r;uh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=ia[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=ia[u|c>>6],s[o++]=ia[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ia[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 GC="invalid encoding";uh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=jC[u])===void 0)throw Error(GC);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(GC);return n-i};uh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var $C=v((yue,WC)=>{"use strict";l();WC.exports=ch;function ch(){this._listeners={}}ch.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};ch.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";l();ex.exports=KC(KC);function KC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(u,c,f){e[0]=u,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],e[0]}function a(u,c){return r[3]=u[c],r[2]=u[c+1],r[1]=u[c+2],r[0]=u[c+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),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,YC),t.writeFloatBE=e.bind(null,JC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}t.readFloatLE=r.bind(null,XC),t.readFloatBE=r.bind(null,ZC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(u,c,f){e[0]=u,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],r[4]=u[c+4],r[5]=u[c+5],r[6]=u[c+6],r[7]=u[c+7],e[0]}function a(u,c){return r[7]=u[c],r[6]=u[c+1],r[5]=u[c+2],r[4]=u[c+3],r[3]=u[c+4],r[2]=u[c+5],r[1]=u[c+6],r[0]=u[c+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(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((c<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((c<<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((c<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,YC,0,4),t.writeDoubleBE=e.bind(null,JC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),f=(c>>31)*2+1,d=c>>>20&2047,g=4294967296*(c&1048575)+u;return d===2047?g?NaN:f*(1/0):d===0?f*5e-324*g:f*Math.pow(2,d-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,XC,0,4),t.readDoubleBE=r.bind(null,ZC,4,0)}(),t}function YC(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 JC(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 XC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function ZC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var rx=v((exports,module)=>{"use strict";l();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 ix=v(nx=>{"use strict";l();var Gw=nx;Gw.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))};Gw.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 ox=v((Iue,sx)=>{"use strict";l();sx.exports=gH;function gH(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 c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var ux=v((Sue,ax)=>{"use strict";l();ax.exports=qt;var Nc=Ni();function qt(t,e){this.lo=t>>>0,this.hi=e>>>0}var Fs=qt.zero=new qt(0,0);Fs.toNumber=function(){return 0};Fs.zzEncode=Fs.zzDecode=function(){return this};Fs.length=function(){return 1};var yH=qt.zeroHash="\0\0\0\0\0\0\0\0";qt.fromNumber=function(e){if(e===0)return Fs;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 qt(n,i)};qt.from=function(e){if(typeof e=="number")return qt.fromNumber(e);if(Nc.isString(e))if(Nc.Long)e=Nc.Long.fromString(e);else return qt.fromNumber(parseInt(e,10));return e.low||e.high?new qt(e.low>>>0,e.high>>>0):Fs};qt.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};qt.prototype.toLong=function(e){return Nc.Long?new Nc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var xi=String.prototype.charCodeAt;qt.fromHash=function(e){return e===yH?Fs:new qt((xi.call(e,0)|xi.call(e,1)<<8|xi.call(e,2)<<16|xi.call(e,3)<<24)>>>0,(xi.call(e,4)|xi.call(e,5)<<8|xi.call(e,6)<<16|xi.call(e,7)<<24)>>>0)};qt.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)};qt.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};qt.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};qt.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 Ni=v(jw=>{"use strict";l();var be=jw;be.asPromise=kC();be.base64=zC();be.EventEmitter=$C();be.float=tx();be.inquire=rx();be.utf8=ix();be.pool=ox();be.LongBits=ux();be.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);be.global=be.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||jw;be.emptyArray=Object.freeze?Object.freeze([]):[];be.emptyObject=Object.freeze?Object.freeze({}):{};be.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};be.isString=function(e){return typeof e=="string"||e instanceof String};be.isObject=function(e){return e&&typeof e=="object"};be.isset=be.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};be.Buffer=function(){try{var t=be.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();be._Buffer_from=null;be._Buffer_allocUnsafe=null;be.newBuffer=function(e){return typeof e=="number"?be.Buffer?be._Buffer_allocUnsafe(e):new be.Array(e):be.Buffer?be._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};be.Array=typeof Uint8Array<"u"?Uint8Array:Array;be.Long=be.global.dcodeIO&&be.global.dcodeIO.Long||be.global.Long||be.inquire("long");be.key2Re=/^true|false|0|1$/;be.key32Re=/^-?(?:0|[1-9][0-9]*)$/;be.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;be.longToHash=function(e){return e?be.LongBits.from(e).toHash():be.LongBits.zeroHash};be.longFromHash=function(e,r){var n=be.LongBits.fromHash(e);return be.Long?be.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function cx(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]}};be.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";l();px.exports=Ue;var Pr=Ni(),Qw,lh=Pr.LongBits,fx=Pr.base64,dx=Pr.utf8;function Oc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Ww(){}function mH(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ue(){this.len=0,this.head=new Oc(Ww,0,0),this.tail=this.head,this.states=null}var hx=function(){return Pr.Buffer?function(){return(Ue.create=function(){return new Qw})()}:function(){return new Ue}};Ue.create=hx();Ue.alloc=function(e){return new Pr.Array(e)};Pr.Array!==Array&&(Ue.alloc=Pr.pool(Ue.alloc,Pr.Array.prototype.subarray));Ue.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Oc(e,r,n),this.len+=r,this};function $w(t,e,r){e[r]=t&255}function wH(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Kw(t,e){this.len=t,this.next=void 0,this.val=e}Kw.prototype=Object.create(Oc.prototype);Kw.prototype.fn=wH;Ue.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Kw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ue.prototype.int32=function(e){return e<0?this._push(Yw,10,lh.fromNumber(e)):this.uint32(e)};Ue.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Yw(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}Ue.prototype.uint64=function(e){var r=lh.from(e);return this._push(Yw,r.length(),r)};Ue.prototype.int64=Ue.prototype.uint64;Ue.prototype.sint64=function(e){var r=lh.from(e).zzEncode();return this._push(Yw,r.length(),r)};Ue.prototype.bool=function(e){return this._push($w,1,e?1:0)};function zw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ue.prototype.fixed32=function(e){return this._push(zw,4,e>>>0)};Ue.prototype.sfixed32=Ue.prototype.fixed32;Ue.prototype.fixed64=function(e){var r=lh.from(e);return this._push(zw,4,r.lo)._push(zw,4,r.hi)};Ue.prototype.sfixed64=Ue.prototype.fixed64;Ue.prototype.float=function(e){return this._push(Pr.float.writeFloatLE,4,e)};Ue.prototype.double=function(e){return this._push(Pr.float.writeDoubleLE,8,e)};var EH=Pr.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($w,1,0);if(Pr.isString(e)){var n=Ue.alloc(r=fx.length(e));fx.decode(e,n,0),e=n}return this.uint32(r)._push(EH,r,e)};Ue.prototype.string=function(e){var r=dx.length(e);return r?this.uint32(r)._push(dx.write,r,e):this._push($w,1,0)};Ue.prototype.fork=function(){return this.states=new mH(this),this.head=this.tail=new Oc(Ww,0,0),this.len=0,this};Ue.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 Oc(Ww,0,0),this.len=0),this};Ue.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};Ue.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};Ue._configure=function(t){Qw=t,Ue.create=hx(),Qw._configure()}});var mx=v((Due,yx)=>{"use strict";l();yx.exports=En;var gx=Jw();(En.prototype=Object.create(gx.prototype)).constructor=En;var Oi=Ni();function En(){gx.call(this)}En._configure=function(){En.alloc=Oi._Buffer_allocUnsafe,En.writeBytesBuffer=Oi.Buffer&&Oi.Buffer.prototype instanceof Uint8Array&&Oi.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(En.writeBytesBuffer,r,e),this};function vH(t,e,r){t.length<40?Oi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}En.prototype.string=function(e){var r=Oi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(vH,r,e),this};En._configure()});var eE=v((Rue,bx)=>{"use strict";l();bx.exports=bt;var vn=Ni(),Zw,vx=vn.LongBits,AH=vn.utf8;function Kr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function bt(t){this.buf=t,this.pos=0,this.len=t.length}var wx=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new bt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new bt(e);throw Error("illegal buffer")},Ax=function(){return vn.Buffer?function(r){return(bt.create=function(i){return vn.Buffer.isBuffer(i)?new Zw(i):wx(i)})(r)}:wx};bt.create=Ax();bt.prototype._slice=vn.Array.prototype.subarray||vn.Array.prototype.slice;bt.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,Kr(this,10);return e}}();bt.prototype.int32=function(){return this.uint32()|0};bt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Xw(){var t=new vx(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 Kr(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 Kr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}bt.prototype.bool=function(){return this.uint32()!==0};function fh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}bt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)};bt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)|0};function Ex(){if(this.pos+8>this.len)throw Kr(this,8);return new vx(fh(this.buf,this.pos+=4),fh(this.buf,this.pos+=4))}bt.prototype.float=function(){if(this.pos+4>this.len)throw Kr(this,4);var e=vn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};bt.prototype.double=function(){if(this.pos+8>this.len)throw Kr(this,4);var e=vn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};bt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Kr(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)};bt.prototype.string=function(){var e=this.bytes();return AH.read(e,0,e.length)};bt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Kr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Kr(this);while(this.buf[this.pos++]&128);return this};bt.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};bt._configure=function(t){Zw=t,bt.create=Ax(),Zw._configure();var e=vn.Long?"toLong":"toNumber";vn.merge(bt.prototype,{int64:function(){return Xw.call(this)[e](!1)},uint64:function(){return Xw.call(this)[e](!0)},sint64:function(){return Xw.call(this).zzDecode()[e](!1)},fixed64:function(){return Ex.call(this)[e](!0)},sfixed64:function(){return Ex.call(this)[e](!1)}})}});var Tx=v((Lue,Sx)=>{"use strict";l();Sx.exports=Ms;var _x=eE();(Ms.prototype=Object.create(_x.prototype)).constructor=Ms;var Ix=Ni();function Ms(t){_x.call(this,t)}Ms._configure=function(){Ix.Buffer&&(Ms.prototype._slice=Ix.Buffer.prototype.slice)};Ms.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))};Ms._configure()});var xx=v((Mue,Cx)=>{"use strict";l();Cx.exports=Dc;var tE=Ni();(Dc.prototype=Object.create(tE.EventEmitter.prototype)).constructor=Dc;function Dc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");tE.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Dc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return tE.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,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Dc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Ox=v(Nx=>{"use strict";l();var bH=Nx;bH.Service=xx()});var Px=v((Hue,Dx)=>{"use strict";l();Dx.exports={}});var Lx=v(Bx=>{"use strict";l();var pr=Bx;pr.build="minimal";pr.Writer=Jw();pr.BufferWriter=mx();pr.Reader=eE();pr.BufferReader=Tx();pr.util=Ni();pr.rpc=Ox();pr.roots=Px();pr.configure=Rx;function Rx(){pr.util._configure(),pr.Writer._configure(pr.BufferWriter),pr.Reader._configure(pr.BufferReader)}Rx()});var Mx=v((Que,Fx)=>{"use strict";l();Fx.exports=Lx()});var qx=v((Wue,Ux)=>{"use strict";l();var sa=Mx(),dh=sa.Reader,IH=sa.Writer,Z=sa.util,Pc=sa.roots.default||(sa.roots.default={});Pc.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 dh||(n=new dh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!Z.isInteger(n.Nonce)&&!(n.Nonce&&Z.isInteger(n.Nonce.low)&&Z.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||Z.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||Z.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||Z.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||Z.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||Z.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!Z.isInteger(n.GasPrice)&&!(n.GasPrice&&Z.isInteger(n.GasPrice.low)&&Z.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!Z.isInteger(n.GasLimit)&&!(n.GasLimit&&Z.isInteger(n.GasLimit.low)&&Z.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||Z.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||Z.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!Z.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||Z.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!Z.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||Z.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||Z.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Pc.proto.Transaction)return n;var i=new Pc.proto.Transaction;return n.Nonce!=null&&(Z.Long?(i.Nonce=Z.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 Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?Z.base64.decode(n.Value,i.Value=Z.newBuffer(Z.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?Z.base64.decode(n.RcvAddr,i.RcvAddr=Z.newBuffer(Z.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?Z.base64.decode(n.RcvUserName,i.RcvUserName=Z.newBuffer(Z.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?Z.base64.decode(n.SndAddr,i.SndAddr=Z.newBuffer(Z.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?Z.base64.decode(n.SndUserName,i.SndUserName=Z.newBuffer(Z.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(Z.Long?(i.GasPrice=Z.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 Z.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(Z.Long?(i.GasLimit=Z.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 Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?Z.base64.decode(n.Data,i.Data=Z.newBuffer(Z.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?Z.base64.decode(n.ChainID,i.ChainID=Z.newBuffer(Z.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"?Z.base64.decode(n.Signature,i.Signature=Z.newBuffer(Z.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"?Z.base64.decode(n.GuardAddr,i.GuardAddr=Z.newBuffer(Z.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?Z.base64.decode(n.GuardSignature,i.GuardSignature=Z.newBuffer(Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=Z.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=Z.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=Z.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=Z.newBuffer(s.SndUserName))),Z.Long){var o=new Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=Z.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=Z.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=Z.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=Z.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?Z.Long.prototype.toString.call(n.Nonce):i.longs===Number?new Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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?Z.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new Z.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?Z.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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,sa.util.toJSONOptions)},e}(),t}();Ux.exports=Pc});var Vx=v(Rr=>{"use strict";l();var _H=Rr&&Rr.__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]}),SH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TH=Rr&&Rr.__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)&&_H(e,t,r);return SH(e,t),e},CH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var xH=CH(Yt()),rE=pt(),NH=Os(),OH=TH(Le()),DH=Tc(),nE=class{serializeTransaction(e){let r=qx().proto,n=new rE.Address(e.getReceiver().bech32()).pubkey(),i=new rE.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:e.getReceiverUsername()?h.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?h.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,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()!==NH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new rE.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 xH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=DH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new OH.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=nE});var Hx=v(Us=>{"use strict";l();var PH=Us&&Us.__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]}),RH=Us&&Us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&PH(e,t,r)};Object.defineProperty(Us,"__esModule",{value:!0});RH(Vx(),Us)});var Rc=v(Br=>{"use strict";l();var BH=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]}),LH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FH=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)&&BH(e,t,r);return LH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.interpretSignatureAsBuffer=Br.Signature=void 0;var kx=FH(Le()),Gx=64,iE=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof h.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new kx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Gx}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Gx)throw new kx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Br.Signature=iE;function MH(t){if(ArrayBuffer.isView(t))return h.Buffer.from(t);if(t.hex!=null)return h.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Br.interpretSignatureAsBuffer=MH});var Yn=v(hh=>{"use strict";l();Object.defineProperty(hh,"__esModule",{value:!0});hh.TransactionPayload=void 0;var sE=class t{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=h.Buffer.from(e,"base64").toString();return new t(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}};hh.TransactionPayload=sE});var oE=v((nce,jx)=>{l();Jn.notEqual=qH;Jn.notOk=VH;Jn.equal=UH;Jn.ok=Jn;jx.exports=Jn;function UH(t,e,r){Jn(t==e,r)}function qH(t,e,r){Jn(t!=e,r)}function VH(t,e){Jn(!t,e)}function Jn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Vs=v(ca=>{"use strict";l();var aE=K0(),aa=J0(),Qx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ca.Buffer=W;ca.SlowBuffer=zH;ca.INSPECT_MAX_BYTES=50;var ph=2147483647;ca.kMaxLength=ph;W.TYPED_ARRAY_SUPPORT=HH();!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 HH(){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(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 Xn(t){if(t>ph)throw new RangeError('The value "'+t+'" is invalid for option "size"');let 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 fE(t)}return Kx(t,e,r)}W.poolSize=8192;function Kx(t,e,r){if(typeof t=="string")return GH(t,e);if(ArrayBuffer.isView(t))return jH(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(An(t,ArrayBuffer)||t&&An(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(An(t,SharedArrayBuffer)||t&&An(t.buffer,SharedArrayBuffer)))return cE(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 W.from(n,e,r);let i=QH(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 Kx(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function Yx(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 kH(t,e,r){return Yx(t),t<=0?Xn(t):e!==void 0?typeof r=="string"?Xn(t).fill(e,r):Xn(t).fill(e):Xn(t)}W.alloc=function(t,e,r){return kH(t,e,r)};function fE(t){return Yx(t),Xn(t<0?0:dE(t)|0)}W.allocUnsafe=function(t){return fE(t)};W.allocUnsafeSlow=function(t){return fE(t)};function GH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Jx(t,e)|0,n=Xn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function uE(t){let e=t.length<0?0:dE(t.length)|0,r=Xn(e);for(let n=0;n=ph)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ph.toString(16)+" bytes");return t|0}function zH(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(An(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),An(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;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(W.isBuffer(o)||(o=W.from(o)),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 Jx(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||An(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 lE(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oN(t).length;default:if(i)return n?-1:lE(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=Jx;function WH(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 nk(this,e,r);case"utf8":case"utf-8":return Zx(this,e,r);case"ascii":return tk(this,e,r);case"latin1":case"binary":return rk(this,e,r);case"base64":return ZH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ik(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function qs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}W.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+=" ... "),""};Qx&&(W.prototype[Qx]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(An(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;let o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,pE(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:zx(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):zx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function zx(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 c;if(i){let f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){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 $H(this,e,r,n);case"utf8":case"utf-8":return KH(this,e,r,n);case"ascii":case"latin1":case"binary":return YH(this,e,r,n);case"base64":return JH(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XH(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 ZH(t,e,r){return e===0&&r===t.length?aE.fromByteArray(t):aE.fromByteArray(t.slice(e,r))}function Zx(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 ek(n)}var Wx=4096;function ek(t){let e=t.length;if(e<=Wx)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")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e+--r],s=1;for(;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||Vt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readBigUInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(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};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Vt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readBigInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Vt(e,4,this.length),aa.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),aa.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!1,52,8)};function gr(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){let a=Math.pow(2,8*n)-1;gr(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;gr(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};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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 eN(t,e,r,n,i){sN(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 tN(t,e,r,n,i){sN(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}W.prototype.writeBigUInt64LE=Di(function(e,r=0){return eN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeBigUInt64BE=Di(function(e,r=0){return tN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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};W.prototype.writeBigInt64LE=Di(function(e,r=0){return eN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W.prototype.writeBigInt64BE=Di(function(e,r=0){return tN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rN(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 nN(t,e,r,n,i){return e=+e,r=r>>>0,i||rN(t,e,r,4,34028234663852886e22,-34028234663852886e22),aa.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return nN(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return nN(this,e,r,!1,n)};function iN(t,e,r,n,i){return e=+e,r=r>>>0,i||rN(t,e,r,8,17976931348623157e292,-17976931348623157e292),aa.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return iN(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return iN(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);let s;if(typeof e=="number")for(s=r;s2**32?i=$x(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=$x(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function $x(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 sk(t,e,r){ua(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Bc(e,t.length-(r+1))}function sN(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 oa.ERR_OUT_OF_RANGE("value",a,t)}sk(n,i,s)}function ua(t,e){if(typeof t!="number")throw new oa.ERR_INVALID_ARG_TYPE(e,"number",t)}function Bc(t,e,r){throw Math.floor(t)!==t?(ua(t,r),new oa.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new oa.ERR_BUFFER_OUT_OF_BOUNDS:new oa.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ok=/[^+/0-9A-Za-z-_]/g;function ak(t){if(t=t.split("=")[0],t=t.trim().replace(ok,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function lE(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 uk(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function oN(t){return aE.toByteArray(ak(t))}function gh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function An(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function pE(t){return t!==t}var lk=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 Di(t){return typeof BigInt>"u"?fk:t}function fk(){throw new Error("BigInt not supported")}});var uN=v((uce,aN)=>{l();aN.exports=gE;gE.supported=typeof WebAssembly<"u";function gE(t){if(!gE.supported)return null;var e=t&&t.imports,r=dk("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 dk(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(hk)):new(Vs()).Buffer(t,"base64")}function hk(t){return t.charCodeAt(0)}});var gN=v((dce,In)=>{l();var bn=oE(),Ze=uN()(),Zn=64,yh=[];In.exports=Lr;var cN=In.exports.BYTES_MIN=16,lN=In.exports.BYTES_MAX=64,lce=In.exports.BYTES=32,fN=In.exports.KEYBYTES_MIN=16,dN=In.exports.KEYBYTES_MAX=64,fce=In.exports.KEYBYTES=32,hN=In.exports.SALTBYTES=16,pN=In.exports.PERSONALBYTES=16;function Lr(t,e,r,n,i){if(!(this instanceof Lr))return new Lr(t,e,r,n,i);if(!(Ze&&Ze.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(bn(t>=cN,"digestLength must be at least "+cN+", was given "+t),bn(t<=lN,"digestLength must be at most "+lN+", was given "+t),e!=null&&bn(e.length>=fN,"key must be at least "+fN+", was given "+e.length),e!=null&&bn(e.length<=dN,"key must be at least "+dN+", was given "+e.length),r!=null&&bn(r.length===hN,"salt must be exactly "+hN+", was given "+r.length),n!=null&&bn(n.length===pN,"personal must be exactly "+pN+", was given "+n.length)),yh.length||(yh.push(Zn),Zn+=216),this.digestLength=t,this.finalized=!1,this.pointer=yh.pop(),Ze.memory.fill(0,0,64),Ze.memory[0]=this.digestLength,Ze.memory[1]=e?e.length:0,Ze.memory[2]=1,Ze.memory[3]=1,r&&Ze.memory.set(r,32),n&&Ze.memory.set(n,48),this.pointer+216>Ze.memory.length&&Ze.realloc(this.pointer+216),Ze.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ze.memory.fill(0,Zn,Zn+e.length),Ze.memory[this.pointer+200]=128)}Lr.prototype.update=function(t){return bn(this.finalized===!1,"Hash instance finalized"),bn(t,"input must be TypedArray or Buffer"),Zn+t.length>Ze.memory.length&&Ze.realloc(Zn+t.length),Ze.memory.set(t,Zn),Ze.exports.blake2b_update(this.pointer,Zn,Zn+t.length),this};Lr.prototype.digest=function(t){if(bn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,yh.push(this.pointer),Ze.exports.blake2b_final(this.pointer),!t||t==="binary")return Ze.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return gk(Ze.memory,this.pointer+128,this.digestLength);bn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Bi=oE(),Fc=gN();function mh(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 yN(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 IN(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Pi(t,e,r,n,i,s){var o=Lc[i],a=Lc[i+1],u=Lc[s],c=Lc[s+1];mh(xe,t,e),yN(xe,t,o,a);var f=xe[n]^xe[t],d=xe[n+1]^xe[t+1];xe[n]=d,xe[n+1]=f,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=f>>>24^d<<8,xe[e+1]=d>>>24^f<<8,mh(xe,t,e),yN(xe,t,u,c),f=xe[n]^xe[t],d=xe[n+1]^xe[t+1],xe[n]=f>>>16^d<<16,xe[n+1]=d>>>16^f<<16,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=d>>>31^f<<1,xe[e+1]=f>>>31^d<<1}var _N=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),mk=[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],Xt=new Uint8Array(mk.map(function(t){return t*2})),xe=new Uint32Array(32),Lc=new Uint32Array(32);function SN(t,e){var r=0;for(r=0;r<16;r++)xe[r]=t.h[r],xe[r+16]=_N[r];for(xe[24]=xe[24]^t.t,xe[25]=xe[25]^t.t/4294967296,e&&(xe[28]=~xe[28],xe[29]=~xe[29]),r=0;r<32;r++)Lc[r]=IN(t.b,4*r);for(r=0;r<12;r++)Pi(0,8,16,24,Xt[r*16+0],Xt[r*16+1]),Pi(2,10,18,26,Xt[r*16+2],Xt[r*16+3]),Pi(4,12,20,28,Xt[r*16+4],Xt[r*16+5]),Pi(6,14,22,30,Xt[r*16+6],Xt[r*16+7]),Pi(0,10,20,30,Xt[r*16+8],Xt[r*16+9]),Pi(2,12,22,24,Xt[r*16+10],Xt[r*16+11]),Pi(4,14,16,26,Xt[r*16+12],Xt[r*16+13]),Pi(6,8,18,28,Xt[r*16+14],Xt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^xe[r]^xe[r+16]}var Ri=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 la(t,e,r,n){Ri.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ri[0]=t,e&&(Ri[1]=e.length),Ri[2]=1,Ri[3]=1,r&&Ri.set(r,32),n&&Ri.set(n,48);for(var i=0;i<16;i++)this.h[i]=_N[i]^IN(Ri,i*4);e&&(TN(this,e),this.c=128)}la.prototype.update=function(t){return Bi(t!=null,"input must be Uint8Array or Buffer"),TN(this,t),this};la.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Bi(e.length>=this.outlen,"out must have at least outlen bytes of space"),wk(this,e),t==="hex"?Ek(e):e};la.prototype.final=la.prototype.digest;la.ready=function(t){Fc.ready(function(){t()})};function TN(t,e){for(var r=0;r>2]>>8*(r&3);return e}function Ek(t){for(var e="",r=0;r=mN,"outlen must be at least "+mN+", was given "+e),Bi(e<=wN,"outlen must be at most "+wN+", was given "+e),r!=null&&Bi(r.length>=EN,"key must be at least "+EN+", was given "+r.length),r!=null&&Bi(r.length<=vN,"key must be at most "+vN+", was given "+r.length),n!=null&&Bi(n.length===AN,"salt must be exactly "+AN+", was given "+n.length),i!=null&&Bi(i.length===bN,"personal must be exactly "+bN+", was given "+i.length)),new CN(e,r,n,i)};yr.exports.ready=function(t){Fc.ready(function(){t()})};yr.exports.WASM_SUPPORTED=Fc.SUPPORTED;yr.exports.WASM_LOADED=!1;var mN=yr.exports.BYTES_MIN=16,wN=yr.exports.BYTES_MAX=64,pce=yr.exports.BYTES=32,EN=yr.exports.KEYBYTES_MIN=16,vN=yr.exports.KEYBYTES_MAX=64,gce=yr.exports.KEYBYTES=32,AN=yr.exports.SALTBYTES=16,bN=yr.exports.PERSONALBYTES=16;Fc.ready(function(t){t||(yr.exports.WASM_LOADED=!0,CN=Fc)})});var Yr=v(Fr=>{"use strict";l();var Ak=Fr&&Fr.__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]}),bk=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ik=Fr&&Fr.__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)&&Ak(e,t,r);return bk(e,t),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var fa=Yt(),Mc=pt(),_k=ah(),Sk=Os(),Tk=Ik(Le()),Ck=qC(),ei=xc(),xk=Hx(),wh=Rc(),xN=Yn(),Nk=br(),Ok=yE(),Dk=32,mE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:c,chainID:f,version:d,options:g,guardian:m}){this.nonce=e||0,this.value=r?new fa.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||Sk.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=c||new xN.TransactionPayload,this.chainID=f,this.version=d?new ei.TransactionVersion(d.valueOf()):ei.TransactionVersion.withDefaultVersion(),this.options=g?new ei.TransactionOptions(g.valueOf()):ei.TransactionOptions.withDefaultOptions(),this.guardian=m||Mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=da.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}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}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 ei.TransactionVersion(e.valueOf())}getOptions(){return new ei.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new ei.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return Nk.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(),senderUsername:this.senderUsername?h.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?h.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().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 _k.Compatibility.guardAddressIsSetAndNonZero(new Mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new fa.BigNumber(e.value).toFixed(0),receiver:Mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:Mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?Mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new xN.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new ei.TransactionVersion(e.version),options:e.options!=null?new ei.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new wh.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new wh.Signature(e.guardianSignature)),r}applySignature(e){this.signature=wh.interpretSignatureAsBuffer(e),this.hash=da.compute(this)}applyGuardianSignature(e){this.guardianSignature=wh.interpretSignatureAsBuffer(e),this.hash=da.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 Tk.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new fa.BigNumber(this.gasPrice.valueOf()),i=new fa.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new fa.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new fa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Fr.Transaction=mE;var da=class t extends Ck.Hash{constructor(e){super(e)}static compute(e){let n=new xk.ProtoSerializer().serializeTransaction(e),i=Ok(Dk).update(n).digest("hex");return new t(i)}};Fr.TransactionHash=da});var AE=v(vh=>{"use strict";l();Object.defineProperty(vh,"__esModule",{value:!0});vh.TransferTransactionsFactory=void 0;var wE=na(),Jr=xt(),Eh=Yr(),EE=Yn(),vE=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 Eh.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 wE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new EE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Eh.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 wE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.U64Value(e.tokenTransfer.nonce),new Jr.BigUIntValue(e.tokenTransfer.valueOf()),new Jr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new EE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Eh.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 Jr.AddressValue(e.destination),new Jr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Jr.BytesValue.fromUTF8(u.tokenIdentifier),new Jr.U64Value(u.nonce),new Jr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new wE.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new EE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Eh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};vh.TransferTransactionsFactory=vE});var IE=v(Hs=>{"use strict";l();Object.defineProperty(Hs,"__esModule",{value:!0});Hs.GasEstimator=Hs.DefaultGasConfiguration=void 0;Hs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Pk=1e5,NN=8e5,bE=class{constructor(e){this.gasConfiguration=e||Hs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Pk}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+NN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+NN)*r+this.gasConfiguration.gasPerDataByte*e}};Hs.GasEstimator=bE});var ha=v(Ah=>{"use strict";l();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.Account=void 0;var Rk=pt(),_E=class{constructor(e){this.address=new Rk.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()}}};Ah.Account=_E});var pa=v(Gs=>{"use strict";l();Object.defineProperty(Gs,"__esModule",{value:!0});Gs.Logger=Gs.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=Gs.LogLevel||(Gs.LogLevel={}));var bh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=ks.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=ks.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=ks.Error||console.error(e,r)}};Gs.Logger=bh;bh.logLevel=ks.Debug});var CE=v(_n=>{"use strict";l();var Bk=_n&&_n.__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]}),Lk=_n&&_n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fk=_n&&_n.__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)&&Bk(e,t,r);return Lk(e,t),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.AsyncTimer=void 0;var Mk=Fk(Le()),Uk=Le(),SE=pa(),TE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new Mk.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,SE.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(){SE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new Uk.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(SE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_n.AsyncTimer=TE});var Ih=v(ga=>{"use strict";l();var Mr=ga&&ga.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(ga,"__esModule",{value:!0});ga.TransactionWatcher=void 0;var xE=CE(),Li=Le(),ON=pa(),Fi=class t{constructor(e,r={}){this.fetcher=new NE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Mr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Mr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new Li.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>a.includes(c))},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>a.includes(c))!=null},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Mr(this,void 0,void 0,function*(){let n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Mr(this,void 0,void 0,function*(){let i=new xE.AsyncTimer("watcher:periodic"),s=new xE.AsyncTimer("watcher:patience"),o=new xE.AsyncTimer("watcher:timeout"),a=!1,u,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),c=e(u),c||a)break}catch(f){if(ON.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Li.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Li.Err))throw f}}if(c&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!c)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}};ga.TransactionWatcher=Fi;Fi.DefaultPollingInterval=6e3;Fi.DefaultTimeout=Fi.DefaultPollingInterval*15;Fi.DefaultPatience=0;Fi.NoopOnStatusReceived=t=>{};var NE=class{constructor(e){this.fetcher=e}getTransaction(e){return Mr(this,void 0,void 0,function*(){return ON.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var OE=v(_h=>{"use strict";l();Object.defineProperty(_h,"__esModule",{value:!0});_h.CodeMetadata=void 0;var Uc=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBuffer(e){if(e.length<2)throw new Error("Buffer is too short.");let r=e[0],n=e[1],i=(r&t.ByteZero.Upgradeable)!==0,s=(r&t.ByteZero.Readable)!==0,o=(n&t.ByteOne.Payable)!==0,a=(n&t.ByteOne.PayableBySc)!==0;return new t(i,s,o,a)}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|=t.ByteZero.Upgradeable),this.readable&&(e|=t.ByteZero.Readable),this.payable&&(r|=t.ByteOne.Payable),this.payableBySc&&(r|=t.ByteOne.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}};_h.CodeMetadata=Uc;Uc.ByteZero={Upgradeable:1,Reserved2:2,Readable:4};Uc.ByteOne={Reserved1:1,Payable:2,PayableBySc:4}});var qc=v(Sn=>{"use strict";l();var qk=Sn&&Sn.__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]}),Vk=Sn&&Sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hk=Sn&&Sn.__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)&&qk(e,t,r);return Vk(e,t),e};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ContractFunction=void 0;var kk=Hk(Le()),DE=class t{constructor(e){if(this.name=e,e==null)throw new kk.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Sn.ContractFunction=DE});var BE=v(Ur=>{"use strict";l();var Gk=Ur&&Ur.__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]}),jk=Ur&&Ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qk=Ur&&Ur.__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)&&Gk(e,t,r);return jk(e,t),e},zk=Ur&&Ur.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.InteractionChecker=void 0;var PE=Qk(Le()),Wk=zk(Yt()),RE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new Wk.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new PE.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 PE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";l();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Query=void 0;var $k=pt(),Kk=na(),LE=class{constructor(e){this.caller=e.caller||new $k.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new Kk.ArgSerializer().valuesToStrings(this.args)}};Sh.Query=LE});var qE=v(Th=>{"use strict";l();Object.defineProperty(Th,"__esModule",{value:!0});Th.Interaction=void 0;var DN=pt(),Yk=ah(),FE=Os(),ME=qc(),Jk=BE(),Xk=Vc(),ya=xt(),UE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new DN.Address,this.sender=new DN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ma([],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(){Yk.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 ME.ContractFunction(FE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new ME.ContractFunction(FE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new ME.ContractFunction(FE.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 Xk.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 ma([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ma([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ma(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 Jk.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Th.Interaction=UE;var ma=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 ya.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ya.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ya.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ya.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ya.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ya.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var PN=v(Ch=>{"use strict";l();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArgumentErrorContext=void 0;var Zk=Le(),VE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new Zk.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)})`)}};Ch.ArgumentErrorContext=VE});var kE=v(js=>{"use strict";l();var eG=js&&js.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(js,"__esModule",{value:!0});js.NativeSerializer=void 0;var tG=eG(Yt()),rG=pt(),HE=Le(),nG=Md(),iG=PN(),Ie=xt(),sG;(function(t){function e(b,S){b=b||[],r(b,S),n(S)&&(b=i(b,S));let N=S.input,_=[];for(let T=0;T0&&S[0].type.getCardinality().isComposite()&&(_=1/0,T=!0);for(let B of S){if(B.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:T}}function o(b,S,N){if(b&&b.belongsToTypesystem)return b;if(S instanceof Ie.OptionType)return a(b,S,N);if(S instanceof Ie.OptionalType)return u(b,S,N);if(S instanceof Ie.VariadicType)return c(b,S,N);if(S instanceof Ie.CompositeType)return d(b,S,N);if(S instanceof Ie.TupleType)return g(b,S,N);if(S instanceof Ie.StructType)return m(b,S,N);if(S instanceof Ie.ListType)return f(b,S,N);if(S instanceof Ie.PrimitiveType)return y(b,S,N);if(S instanceof Ie.EnumType)return A(b,S,N);N.throwError(`convertToTypedValue: unhandled type ${S}`)}function a(b,S,N){if(b==null)return Ie.OptionValue.newMissing();let _=o(b,S.getFirstTypeParameter(),N);return Ie.OptionValue.newProvided(_)}function u(b,S,N){if(b==null)return new Ie.OptionalValue(S);let _=o(b,S.getFirstTypeParameter(),N);return new Ie.OptionalValue(S,_)}function c(b,S,N){if(S.isCounted)throw new HE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');b==null&&(b=[]),b.map===void 0&&N.convertError(b,"Variadic");let _=b.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new Ie.VariadicValue(S,_)}function f(b,S,N){b.map===void 0&&N.convertError(b,"List");let _=b.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new Ie.List(S,_)}function d(b,S,N){let _=[],T=S.getTypeParameters();N.guardSameLength(b,T);for(let B=0;B{"use strict";l();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.ContractCallPayloadBuilder=Xr.ContractUpgradePayloadBuilder=Xr.ContractDeployPayloadBuilder=Xr.ArwenVirtualMachine=void 0;var zE=Yn(),WE=br(),oG=na();Xr.ArwenVirtualMachine="0500";var GE=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(){WE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Xr.ArwenVirtualMachine}@${r}`;return n=$E(n,this.arguments),new zE.TransactionPayload(n)}};Xr.ContractDeployPayloadBuilder=GE;var jE=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(){WE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=$E(n,this.arguments),new zE.TransactionPayload(n)}};Xr.ContractUpgradePayloadBuilder=jE;var QE=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(){WE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=$E(e,this.arguments),new zE.TransactionPayload(e)}};Xr.ContractCallPayloadBuilder=QE;function $E(t,e){let{argumentsString:r,count:n}=new oG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var ti=v(($ce,YE)=>{"use strict";l();var wa=typeof Reflect=="object"?Reflect:null,RN=wa&&typeof wa.apply=="function"?wa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},xh;wa&&typeof wa.ownKeys=="function"?xh=wa.ownKeys:Object.getOwnPropertySymbols?xh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xh=function(e){return Object.getOwnPropertyNames(e)};function aG(t){console&&console.warn&&console.warn(t)}var LN=Number.isNaN||function(e){return e!==e};function We(){We.init.call(this)}YE.exports=We;YE.exports.once=fG;We.EventEmitter=We;We.prototype._events=void 0;We.prototype._eventsCount=0;We.prototype._maxListeners=void 0;var BN=10;function Nh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(We,"defaultMaxListeners",{enumerable:!0,get:function(){return BN},set:function(t){if(typeof t!="number"||t<0||LN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");BN=t}});We.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};We.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||LN(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 FN(t){return t._maxListeners===void 0?We.defaultMaxListeners:t._maxListeners}We.prototype.getMaxListeners=function(){return FN(this)};We.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")RN(u,this,r);else for(var c=u.length,f=HN(u,c),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,aG(a)}return t}We.prototype.addListener=function(e,r){return MN(this,e,r,!1)};We.prototype.on=We.prototype.addListener;We.prototype.prependListener=function(e,r){return MN(this,e,r,!0)};function uG(){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 UN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=uG.bind(n);return i.listener=r,n.wrapFn=i,i}We.prototype.once=function(e,r){return Nh(r),this.on(e,UN(this,e,r)),this};We.prototype.prependOnceListener=function(e,r){return Nh(r),this.prependListener(e,UN(this,e,r)),this};We.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Nh(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():cG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};We.prototype.off=We.prototype.removeListener;We.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 qN(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?lG(i):HN(i,i.length)}We.prototype.listeners=function(e){return qN(this,e,!0)};We.prototype.rawListeners=function(e){return qN(this,e,!1)};We.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):VN.call(t,e)};We.prototype.listenerCount=VN;function VN(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}We.prototype.eventNames=function(){return this._eventsCount>0?xh(this._events):[]};function HN(t,e){for(var r=new Array(e),n=0;n{l();GN.exports=ti().EventEmitter});var XE=v(()=>{l()});var KN=v((tle,$N)=>{"use strict";l();function jN(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 QN(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 Oh.alloc(0);for(var n=Oh.allocUnsafe(r>>>0),i=this.head,s=0;i;)vG(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=Oh.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:EG,value:function(r,n){return ZE(this,QN(QN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var tv=v((nle,JN)=>{"use strict";l();function AG(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(ev,this,t)):p.default.nextTick(ev,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(Dh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(YN,r,s)):p.default.nextTick(YN,r,s):e?(p.default.nextTick(Dh,r),e(s)):p.default.nextTick(Dh,r)}),this)}function YN(t,e){ev(t,e),Dh(t)}function Dh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function bG(){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 ev(t,e){t.emit("error",e)}function IG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}JN.exports={destroy:AG,undestroy:bG,errorOrDestroy:IG}});var Qs=v((sle,eO)=>{"use strict";l();function _G(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var ZN={};function qr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){_G(o,s);function o(a,u,c){return s.call(this,n(a,u,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,ZN[t]=i}function XN(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 SG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function TG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function CG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}qr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);qr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&SG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(TG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(XN(e,"type"));else{var s=CG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(XN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);qr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");qr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});qr("ERR_STREAM_PREMATURE_CLOSE","Premature close");qr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});qr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");qr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");qr("ERR_STREAM_WRITE_AFTER_END","write after end");qr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);qr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");eO.exports.codes=ZN});var rv=v((ale,tO)=>{"use strict";l();var xG=Qs().codes.ERR_INVALID_OPT_VALUE;function NG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function OG(t,e,r,n){var i=NG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new xG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}tO.exports={getHighWaterMark:OG}});var Ea=v((cle,nv)=>{l();typeof Object.create=="function"?nv.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:nv.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 nO=v((fle,rO)=>{l();rO.exports=DG;function DG(t,e){if(iv("noDeprecation"))return t;var r=!1;function n(){if(!r){if(iv("throwDeprecation"))throw new Error(e);iv("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function iv(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var av=v((hle,cO)=>{"use strict";l();cO.exports=gt;function sO(t){var e=this;this.next=null,this.entry=null,this.finish=function(){ij(e,t)}}var va;gt.WritableState=kc;var PG={deprecate:nO()},oO=JE(),Rh=Vs().Buffer,RG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function BG(t){return Rh.from(t)}function LG(t){return Rh.isBuffer(t)||t instanceof RG}var ov=tv(),FG=rv(),MG=FG.getHighWaterMark,Mi=Qs().codes,UG=Mi.ERR_INVALID_ARG_TYPE,qG=Mi.ERR_METHOD_NOT_IMPLEMENTED,VG=Mi.ERR_MULTIPLE_CALLBACK,HG=Mi.ERR_STREAM_CANNOT_PIPE,kG=Mi.ERR_STREAM_DESTROYED,GG=Mi.ERR_STREAM_NULL_VALUES,jG=Mi.ERR_STREAM_WRITE_AFTER_END,QG=Mi.ERR_UNKNOWN_ENCODING,Aa=ov.errorOrDestroy;Ea()(gt,oO);function zG(){}function kc(t,e,r){va=va||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof va),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=MG(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){ZG(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 sO(this)}kc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(kc.prototype,"buffer",{get:PG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Ph;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ph=Function.prototype[Symbol.hasInstance],Object.defineProperty(gt,Symbol.hasInstance,{value:function(e){return Ph.call(this,e)?!0:this!==gt?!1:e&&e._writableState instanceof kc}})):Ph=function(e){return e instanceof this};function gt(t){va=va||zs();var e=this instanceof va;if(!e&&!Ph.call(gt,this))return new gt(t);this._writableState=new kc(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)),oO.call(this)}gt.prototype.pipe=function(){Aa(this,new HG)};function WG(t,e){var r=new jG;Aa(t,r),p.default.nextTick(e,r)}function $G(t,e,r,n){var i;return r===null?i=new GG:typeof r!="string"&&!e.objectMode&&(i=new UG("chunk",["string","Buffer"],r)),i?(Aa(t,i),p.default.nextTick(n,i),!1):!0}gt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&LG(t);return s&&!Rh.isBuffer(t)&&(t=BG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=zG),n.ending?WG(this,r):(s||$G(this,n,t,r))&&(n.pendingcb++,i=YG(this,n,s,t,e,r)),i};gt.prototype.cork=function(){this._writableState.corked++};gt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&aO(this,t))};gt.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 QG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function KG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Rh.from(e,r)),e}Object.defineProperty(gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function YG(t,e,r,n,i,s){if(!r){var o=KG(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";l();var sj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};fO.exports=Tn;var lO=lv(),cv=av();Ea()(Tn,lO);for(uv=sj(cv.prototype),Bh=0;Bh{l();var Fh=Vs(),Cn=Fh.Buffer;function dO(t,e){for(var r in t)e[r]=t[r]}Cn.from&&Cn.alloc&&Cn.allocUnsafe&&Cn.allocUnsafeSlow?hO.exports=Fh:(dO(Fh,fv),fv.Buffer=Ws);function Ws(t,e,r){return Cn(t,e,r)}Ws.prototype=Object.create(Cn.prototype);dO(Cn,Ws);Ws.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Cn(t,e,r)};Ws.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Cn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ws.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Cn(t)};Ws.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Fh.SlowBuffer(t)}});var pv=v(yO=>{"use strict";l();var hv=pO().Buffer,gO=hv.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 uj(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 cj(t){var e=uj(t);if(typeof e!="string"&&(hv.isEncoding===gO||!gO(t)))throw new Error("Unknown encoding: "+t);return e||t}yO.StringDecoder=Gc;function Gc(t){this.encoding=cj(t);var e;switch(this.encoding){case"utf16le":this.text=gj,this.end=yj,e=4;break;case"utf8":this.fillLast=dj,e=4;break;case"base64":this.text=mj,this.end=wj,e=3;break;default:this.write=Ej,this.end=vj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=hv.allocUnsafe(e)}Gc.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 lj(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 fj(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 dj(t){var e=this.lastTotal-this.lastNeed,r=fj(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 hj(t,e){var r=lj(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 pj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function gj(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 yj(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 mj(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 wj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Ej(t){return t.toString(this.encoding)}function vj(t){return t&&t.length?this.write(t):""}});var Mh=v((vle,EO)=>{"use strict";l();var mO=Qs().codes.ERR_STREAM_PREMATURE_CLOSE;function Aj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";l();var Uh;function Ui(t,e,r){return e=_j(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _j(t){var e=Sj(t,"string");return typeof e=="symbol"?e:String(e)}function Sj(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 Tj=Mh(),qi=Symbol("lastResolve"),$s=Symbol("lastReject"),jc=Symbol("error"),qh=Symbol("ended"),Ks=Symbol("lastPromise"),gv=Symbol("handlePromise"),Ys=Symbol("stream");function Vi(t,e){return{value:t,done:e}}function Cj(t){var e=t[qi];if(e!==null){var r=t[Ys].read();r!==null&&(t[Ks]=null,t[qi]=null,t[$s]=null,e(Vi(r,!1)))}}function xj(t){p.default.nextTick(Cj,t)}function Nj(t,e){return function(r,n){t.then(function(){if(e[qh]){r(Vi(void 0,!0));return}e[gv](r,n)},n)}}var Oj=Object.getPrototypeOf(function(){}),Dj=Object.setPrototypeOf((Uh={get stream(){return this[Ys]},next:function(){var e=this,r=this[jc];if(r!==null)return Promise.reject(r);if(this[qh])return Promise.resolve(Vi(void 0,!0));if(this[Ys].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[jc]?a(e[jc]):o(Vi(void 0,!0))})});var n=this[Ks],i;if(n)i=new Promise(Nj(n,this));else{var s=this[Ys].read();if(s!==null)return Promise.resolve(Vi(s,!1));i=new Promise(this[gv])}return this[Ks]=i,i}},Ui(Uh,Symbol.asyncIterator,function(){return this}),Ui(Uh,"return",function(){var e=this;return new Promise(function(r,n){e[Ys].destroy(null,function(i){if(i){n(i);return}r(Vi(void 0,!0))})})}),Uh),Oj),Pj=function(e){var r,n=Object.create(Dj,(r={},Ui(r,Ys,{value:e,writable:!0}),Ui(r,qi,{value:null,writable:!0}),Ui(r,$s,{value:null,writable:!0}),Ui(r,jc,{value:null,writable:!0}),Ui(r,qh,{value:e._readableState.endEmitted,writable:!0}),Ui(r,gv,{value:function(s,o){var a=n[Ys].read();a?(n[Ks]=null,n[qi]=null,n[$s]=null,s(Vi(a,!1))):(n[qi]=s,n[$s]=o)},writable:!0}),r));return n[Ks]=null,Tj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[$s];s!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,s(i)),n[jc]=i;return}var o=n[qi];o!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,o(Vi(void 0,!0))),n[qh]=!0}),e.on("readable",xj.bind(null,n)),n};vO.exports=Pj});var IO=v((_le,bO)=>{l();bO.exports=function(){throw new Error("Readable.from is not available in the browser")}});var lv=v((Cle,RO)=>{"use strict";l();RO.exports=qe;var ba;qe.ReadableState=CO;var Tle=ti().EventEmitter,TO=function(e,r){return e.listeners(r).length},zc=JE(),Vh=Vs().Buffer,Rj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Bj(t){return Vh.from(t)}function Lj(t){return Vh.isBuffer(t)||t instanceof Rj}var yv=XE(),Ne;yv&&yv.debuglog?Ne=yv.debuglog("stream"):Ne=function(){};var Fj=KN(),Iv=tv(),Mj=rv(),Uj=Mj.getHighWaterMark,Hh=Qs().codes,qj=Hh.ERR_INVALID_ARG_TYPE,Vj=Hh.ERR_STREAM_PUSH_AFTER_EOF,Hj=Hh.ERR_METHOD_NOT_IMPLEMENTED,kj=Hh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ia,mv,wv;Ea()(qe,zc);var Qc=Iv.errorOrDestroy,Ev=["error","close","destroy","pause","resume"];function Gj(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 CO(t,e,r){ba=ba||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof ba),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Uj(this,t,"readableHighWaterMark",r),this.buffer=new Fj,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&&(Ia||(Ia=pv().StringDecoder),this.decoder=new Ia(t.encoding),this.encoding=t.encoding)}function qe(t){if(ba=ba||zs(),!(this instanceof qe))return new qe(t);var e=this instanceof ba;this._readableState=new CO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),zc.call(this)}Object.defineProperty(qe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});qe.prototype.destroy=Iv.destroy;qe.prototype._undestroy=Iv.undestroy;qe.prototype._destroy=function(t,e){e(t)};qe.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=Vh.from(t,e),e=""),n=!0),xO(this,t,e,!1,n)};qe.prototype.unshift=function(t){return xO(this,t,null,!0,!1)};function xO(t,e,r,n,i){Ne("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,zj(t,s);else{var o;if(i||(o=jj(s,e)),o)Qc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Vh.prototype&&(e=Bj(e)),n)s.endEmitted?Qc(t,new kj):vv(t,s,e,!0);else if(s.ended)Qc(t,new Vj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?vv(t,s,e,!1):bv(t,s)):vv(t,s,e,!1)}else n||(s.reading=!1,bv(t,s))}return!s.ended&&(s.length=_O?t=_O:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function SO(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=Qj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}qe.prototype.read=function(t){Ne("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 Ne("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Av(this):kh(this),null;if(t=SO(t,e),t===0&&e.ended)return e.length===0&&Av(this),null;var n=e.needReadable;Ne("need readable",n),(e.length===0||e.length-t0?i=DO(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&&Av(this)),i!==null&&this.emit("data",i),i};function zj(t,e){if(Ne("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?kh(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,NO(t)))}}function kh(t){var e=t._readableState;Ne("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ne("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(NO,t))}function NO(t){var e=t._readableState;Ne("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,_v(t)}function bv(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Wj,t,e))}function Wj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&PO(n.pipes,t)!==-1)&&!c&&(Ne("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){Ne("onerror",O),A(),t.removeListener("error",g),TO(t,"error")===0&&Qc(t,O)}Gj(t,"error",g);function m(){t.removeListener("finish",y),A()}t.once("close",m);function y(){Ne("onfinish"),t.removeListener("close",m),A()}t.once("finish",y);function A(){Ne("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ne("pipe resume"),r.resume()),t};function $j(t){return function(){var r=t._readableState;Ne("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&TO(t,"data")&&(r.flowing=!0,_v(t))}}qe.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,Ne("on readable",n.length,n.reading),n.length?kh(this):n.reading||p.default.nextTick(Kj,this)),r};qe.prototype.addListener=qe.prototype.on;qe.prototype.removeListener=function(t,e){var r=zc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(OO,this),r};qe.prototype.removeAllListeners=function(t){var e=zc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(OO,this),e};function OO(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 Kj(t){Ne("readable nexttick read 0"),t.read(0)}qe.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ne("resume"),t.flowing=!t.readableListening,Yj(this,t)),t.paused=!1,this};function Yj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(Jj,t,e))}function Jj(t,e){Ne("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),_v(t),e.flowing&&!e.reading&&t.read(0)}qe.prototype.pause=function(){return Ne("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ne("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function _v(t){var e=t._readableState;for(Ne("flow",e.flowing);e.flowing&&t.read()!==null;);}qe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ne("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(Ne("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 Av(t){var e=t._readableState;Ne("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Xj,e,t))}function Xj(t,e){if(Ne("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"&&(qe.from=function(t,e){return wv===void 0&&(wv=IO()),wv(qe,t,e)});function PO(t,e){for(var r=0,n=t.length;r{"use strict";l();LO.exports=ri;var Gh=Qs().codes,Zj=Gh.ERR_METHOD_NOT_IMPLEMENTED,eQ=Gh.ERR_MULTIPLE_CALLBACK,tQ=Gh.ERR_TRANSFORM_ALREADY_TRANSFORMING,rQ=Gh.ERR_TRANSFORM_WITH_LENGTH_0,jh=zs();Ea()(ri,jh);function nQ(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new eQ);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";l();MO.exports=Wc;var FO=Sv();Ea()(Wc,FO);function Wc(t){if(!(this instanceof Wc))return new Wc(t);FO.call(this,t)}Wc.prototype._transform=function(t,e,r){r(null,t)}});var GO=v((Rle,kO)=>{"use strict";l();var Tv;function sQ(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var HO=Qs().codes,oQ=HO.ERR_MISSING_ARGS,aQ=HO.ERR_STREAM_DESTROYED;function qO(t){if(t)throw t}function uQ(t){return t.setHeader&&typeof t.abort=="function"}function cQ(t,e,r,n){n=sQ(n);var i=!1;t.on("close",function(){i=!0}),Tv===void 0&&(Tv=Mh()),Tv(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,uQ(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new aQ("pipe"))}}}function VO(t){t()}function lQ(t,e){return t.pipe(e)}function fQ(t){return!t.length||typeof t[t.length-1]!="function"?qO:t.pop()}function dQ(){for(var t=arguments.length,e=new Array(t),r=0;r0;return cQ(o,u,c,function(f){i||(i=f),f&&s.forEach(VO),!u&&(s.forEach(VO),n(i))})});return e.reduce(lQ)}kO.exports=dQ});var Cv=v((Vr,jO)=>{l();Vr=jO.exports=lv();Vr.Stream=Vr;Vr.Readable=Vr;Vr.Writable=av();Vr.Duplex=zs();Vr.Transform=Sv();Vr.PassThrough=UO();Vr.finished=Mh();Vr.pipeline=GO()});var WO=v((Fle,zO)=>{l();var{Transform:hQ}=Cv();zO.exports=t=>class QO extends hQ{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 QO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var YO=v((Ule,KO)=>{l();var{Transform:pQ}=Cv();KO.exports=t=>class $O extends pQ{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 $O(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var XO=v((Vle,JO)=>{l();var gQ=WO(),yQ=YO();JO.exports=function(t){let e=gQ(t),r=yQ(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 t2=v(e2=>{l();var ZO=[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];e2.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],c=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],g=f^(i<<1|s>>>31),m=d^(s<<1|i>>>31),y=t[0]^g,A=t[1]^m,O=t[10]^g,R=t[11]^m,z=t[20]^g,M=t[21]^m,b=t[30]^g,S=t[31]^m,N=t[40]^g,_=t[41]^m;g=r^(o<<1|a>>>31),m=n^(a<<1|o>>>31);let T=t[2]^g,B=t[3]^m,X=t[12]^g,Q=t[13]^m,H=t[22]^g,j=t[23]^m,K=t[32]^g,me=t[33]^m,ce=t[42]^g,ie=t[43]^m;g=i^(u<<1|c>>>31),m=s^(c<<1|u>>>31);let J=t[4]^g,oe=t[5]^m,re=t[14]^g,se=t[15]^m,U=t[24]^g,fe=t[25]^m,ue=t[34]^g,de=t[35]^m,ae=t[44]^g,le=t[45]^m;g=o^(f<<1|d>>>31),m=a^(d<<1|f>>>31);let w=t[6]^g,E=t[7]^m,I=t[16]^g,P=t[17]^m,C=t[26]^g,D=t[27]^m,L=t[36]^g,x=t[37]^m,F=t[46]^g,k=t[47]^m;g=u^(r<<1|n>>>31),m=c^(n<<1|r>>>31);let q=t[8]^g,ee=t[9]^m,Ae=t[18]^g,_e=t[19]^m,Be=t[28]^g,it=t[29]^m,dt=t[38]^g,De=t[39]^m,Ve=t[48]^g,Lt=t[49]^m,Ei=y,Ss=A,Ts=R<<4|O>>>28,cr=O<<4|R>>>28,Qn=z<<3|M>>>29,Kt=M<<3|z>>>29,Ft=S<<9|b>>>23,Je=b<<9|S>>>23,o0=N<<18|_>>>14,a0=_<<18|N>>>14,u0=T<<1|B>>>31,c0=B<<1|T>>>31,l0=Q<<12|X>>>20,f0=X<<12|Q>>>20,d0=H<<10|j>>>22,h0=j<<10|H>>>22,p0=me<<13|K>>>19,g0=K<<13|me>>>19,y0=ce<<2|ie>>>30,m0=ie<<2|ce>>>30,w0=oe<<30|J>>>2,E0=J<<30|oe>>>2,v0=re<<6|se>>>26,A0=se<<6|re>>>26,b0=fe<<11|U>>>21,I0=U<<11|fe>>>21,_0=ue<<15|de>>>17,S0=de<<15|ue>>>17,T0=le<<29|ae>>>3,C0=ae<<29|le>>>3,x0=w<<28|E>>>4,N0=E<<28|w>>>4,O0=P<<23|I>>>9,D0=I<<23|P>>>9,P0=C<<25|D>>>7,R0=D<<25|C>>>7,B0=L<<21|x>>>11,L0=x<<21|L>>>11,F0=k<<24|F>>>8,M0=F<<24|k>>>8,U0=q<<27|ee>>>5,q0=ee<<27|q>>>5,V0=Ae<<20|_e>>>12,H0=_e<<20|Ae>>>12,k0=it<<7|Be>>>25,G0=Be<<7|it>>>25,j0=dt<<8|De>>>24,Q0=De<<8|dt>>>24,z0=Ve<<14|Lt>>>18,W0=Lt<<14|Ve>>>18;t[0]=Ei^~l0&b0,t[1]=Ss^~f0&I0,t[10]=x0^~V0&Qn,t[11]=N0^~H0&Kt,t[20]=u0^~v0&P0,t[21]=c0^~A0&R0,t[30]=U0^~Ts&d0,t[31]=q0^~cr&h0,t[40]=w0^~O0&k0,t[41]=E0^~D0&G0,t[2]=l0^~b0&B0,t[3]=f0^~I0&L0,t[12]=V0^~Qn&p0,t[13]=H0^~Kt&g0,t[22]=v0^~P0&j0,t[23]=A0^~R0&Q0,t[32]=Ts^~d0&_0,t[33]=cr^~h0&S0,t[42]=O0^~k0&Ft,t[43]=D0^~G0&Je,t[4]=b0^~B0&z0,t[5]=I0^~L0&W0,t[14]=Qn^~p0&T0,t[15]=Kt^~g0&C0,t[24]=P0^~j0&o0,t[25]=R0^~Q0&a0,t[34]=d0^~_0&F0,t[35]=h0^~S0&M0,t[44]=k0^~Ft&y0,t[45]=G0^~Je&m0,t[6]=B0^~z0&Ei,t[7]=L0^~W0&Ss,t[16]=p0^~T0&x0,t[17]=g0^~C0&N0,t[26]=j0^~o0&u0,t[27]=Q0^~a0&c0,t[36]=_0^~F0&U0,t[37]=S0^~M0&q0,t[46]=Ft^~y0&w0,t[47]=Je^~m0&E0,t[8]=z0^~Ei&l0,t[9]=W0^~Ss&f0,t[18]=T0^~x0&V0,t[19]=C0^~N0&H0,t[28]=o0^~u0&v0,t[29]=a0^~c0&A0,t[38]=F0^~U0&Ts,t[39]=M0^~q0&cr,t[48]=y0^~w0&O0,t[49]=m0^~E0&D0,t[0]^=ZO[e*2],t[1]^=ZO[e*2+1]}}});var n2=v((jle,r2)=>{l();var Qh=t2();function _a(){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}_a.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};_a.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Qh.p1600(this.state),this.count=0);return e};_a.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};r2.exports=_a});var xv=v((zle,i2)=>{l();i2.exports=XO()(n2())});var Pv=v(Sa=>{"use strict";l();var mQ=Sa&&Sa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sa,"__esModule",{value:!0});Sa.SmartContract=void 0;var wQ=mQ(Yt()),$c=pt(),Nv=ah(),EQ=Le(),Ov=Yr(),vQ=br(),AQ=Tc(),s2=OE(),o2=qc(),a2=qE(),bQ=kE(),IQ=Vc(),zh=KE(),_Q=xv(),Dv=class{constructor(e={}){this.address=new $c.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new $c.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 o2.ContractFunction(i);return new a2.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new o2.ContractFunction(i),a=bQ.NativeSerializer.nativeToTypedValues(s||[],n);return new a2.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return vQ.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}){Nv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new s2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Ov.Transaction({receiver:$c.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){Nv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new s2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Ov.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){Nv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let c=new zh.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new Ov.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:c,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new IQ.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new EQ.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new $c.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new wQ.default(r.valueOf().toString(10)),u=AQ.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let c=h.Buffer.concat([i,o]),f=_Q("keccak256").update(c).digest(),d=h.Buffer.from(zh.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new $c.Address(g)}};Sa.SmartContract=Dv});var Wh=v(Js=>{"use strict";l();Object.defineProperty(Js,"__esModule",{value:!0});Js.SignableMessage=Js.MESSAGE_PREFIX=void 0;var SQ=pt(),TQ=Rc(),CQ=xv();Js.MESSAGE_PREFIX=`Elrond Signed Message: -`;var Rv=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new SQ.Address,Object.assign(this,e)}serializeForSigning(){let e=h.Buffer.from(this.message.length.toString()),r=h.Buffer.concat([e,this.message]),n=h.Buffer.concat([h.Buffer.from(Js.MESSAGE_PREFIX),r]);return CQ("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=TQ.interpretSignatureAsBuffer(e)}getMessageSize(){let e=h.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};Js.SignableMessage=Rv});var u2=v(Hi=>{"use strict";l();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.ErrAccountNotConnected=Hi.ErrCannotSignSingleTransaction=Hi.Err=void 0;var Kc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Hi.Err=Kc;var Bv=class extends Kc{constructor(){super("Cannot sign single transaction.")}};Hi.ErrCannotSignSingleTransaction=Bv;var Lv=class extends Kc{constructor(){super("Account is not connected.")}};Hi.ErrAccountNotConnected=Lv});var c2=v(Yc=>{"use strict";l();Object.defineProperty(Yc,"__esModule",{value:!0});Yc.Operation=void 0;var xQ;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(xQ=Yc.Operation||(Yc.Operation={}))});var Fv=v(Ta=>{"use strict";l();var ki=Ta&&Ta.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ta,"__esModule",{value:!0});Ta.ExtensionProvider=void 0;var NQ=Yr(),l2=u2(),Jc=c2(),Xc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return ki(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return ki(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(Jc.Operation.Connect,n),this.account.address})}logout(){return ki(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Jc.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 ki(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 ki(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return ki(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new l2.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new l2.ErrAccountNotConnected}signTransactions(e){return ki(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Jc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>NQ.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return ki(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Jc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Jc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(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)})}};Ta.ExtensionProvider=Xc;Xc._instance=new Xc});function RQ(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){BQ(t);return}return e}function BQ(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zc(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!PQ.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(OQ.test(t)||DQ.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,RQ)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var OQ,DQ,PQ,g2=he(()=>{l();OQ=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,DQ=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,PQ=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function LQ(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mt(t,...e){try{return LQ(t(...e))}catch(r){return Promise.reject(r)}}function FQ(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function MQ(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function el(t){if(FQ(t))return String(t);if(MQ(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return el(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function y2(){if(typeof h.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function m2(t){if(typeof t=="string")return t;y2();let e=h.Buffer.from(t).toString("base64");return Mv+e}function w2(t){return typeof t!="string"||!t.startsWith(Mv)?t:(y2(),h.Buffer.from(t.slice(Mv.length),"base64"))}function ir(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function E2(...t){return ir(t.join(":"))}function tl(t){return t=ir(t),t?t+":":""}var Mv,v2=he(()=>{l();Mv="base64:"});function I2(t={}){let e={mounts:{"":t.driver||qQ()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(d=>d.startsWith(c)||f&&c.startsWith(d)).map(d=>({relativeBase:c.length>d.length?c.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),i=(c,f)=>{if(e.watching){f=ir(f);for(let d of e.watchListeners)d(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await A2(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},a=(c,f,d)=>{let g=new Map,m=y=>{let A=g.get(y.base);return A||(A={driver:y.driver,base:y.base,items:[]},g.set(y.base,A)),A};for(let y of c){let A=typeof y=="string",O=ir(A?y:y.key),R=A?void 0:y.value,z=A||!y.options?f:{...f,...y.options},M=r(O);m(M).items.push({key:O,value:R,relativeKey:M.relativeKey,options:z})}return Promise.all([...g.values()].map(y=>d(y))).then(y=>y.flat())},u={hasItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.hasItem,d,f)},getItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.getItem,d,f).then(m=>Zc(m))},getItems(c,f){return a(c,f,d=>d.driver.getItems?Mt(d.driver.getItems,d.items.map(g=>({key:g.relativeKey,options:g.options})),f).then(g=>g.map(m=>({key:E2(d.base,m.key),value:Zc(m.value)}))):Promise.all(d.items.map(g=>Mt(d.driver.getItem,g.relativeKey,g.options).then(m=>({key:g.key,value:Zc(m)})))))},getItemRaw(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return g.getItemRaw?Mt(g.getItemRaw,d,f):Mt(g.getItem,d,f).then(m=>w2(m))},async setItem(c,f,d={}){if(f===void 0)return u.removeItem(c);c=ir(c);let{relativeKey:g,driver:m}=r(c);m.setItem&&(await Mt(m.setItem,g,el(f),d),m.watch||i("update",c))},async setItems(c,f){await a(c,f,async d=>{d.driver.setItems&&await Mt(d.driver.setItems,d.items.map(g=>({key:g.relativeKey,value:el(g.value),options:g.options})),f),d.driver.setItem&&await Promise.all(d.items.map(g=>Mt(d.driver.setItem,g.relativeKey,el(g.value),g.options)))})},async setItemRaw(c,f,d={}){if(f===void 0)return u.removeItem(c,d);c=ir(c);let{relativeKey:g,driver:m}=r(c);if(m.setItemRaw)await Mt(m.setItemRaw,g,f,d);else if(m.setItem)await Mt(m.setItem,g,m2(f),d);else return;m.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c);g.removeItem&&(await Mt(g.removeItem,d,f),(f.removeMeta||f.removeMata)&&await Mt(g.removeItem,d+"$",f),g.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c),m=Object.create(null);if(g.getMeta&&Object.assign(m,await Mt(g.getMeta,d,f)),!f.nativeOnly){let y=await Mt(g.getItem,d+"$",f).then(A=>Zc(A));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(m,y))}return m},setMeta(c,f,d={}){return this.setItem(c+"$",f,d)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=tl(c);let d=n(c,!0),g=[],m=[];for(let y of d){let O=(await Mt(y.driver.getKeys,y.relativeBase,f)).map(R=>y.mountpoint+ir(R)).filter(R=>!g.some(z=>R.startsWith(z)));m.push(...O),g=[y.mountpoint,...g.filter(R=>!R.startsWith(y.mountpoint))]}return c?m.filter(y=>y.startsWith(c)&&!y.endsWith("$")):m.filter(y=>!y.endsWith("$"))},async clear(c,f={}){c=tl(c),await Promise.all(n(c,!1).map(async d=>{if(d.driver.clear)return Mt(d.driver.clear,d.relativeBase,f);if(d.driver.removeItem){let g=await d.driver.getKeys(d.relativeBase||"",f);return Promise.all(g.map(m=>d.driver.removeItem(m,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>b2(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=tl(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((d,g)=>g.length-d.length)),e.mounts[c]=f,e.watching&&Promise.resolve(A2(f,i,c)).then(d=>{e.unwatch[c]=d}).catch(console.error),u},async unmount(c,f=!0){c=tl(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await b2(e.mounts[c]),e.mountpoints=e.mountpoints.filter(d=>d!==c),delete e.mounts[c])},getMount(c=""){c=ir(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=ir(c),n(c,f.parents).map(g=>({driver:g.driver,base:g.mountpoint}))}};return u}function A2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function b2(t){typeof t.dispose=="function"&&await Mt(t.dispose)}var UQ,qQ,_2=he(()=>{l();g2();v2();UQ="memory",qQ=()=>{let t=new Map;return{name:UQ,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function Xs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function qv(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Xs(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function rl(){return Uv||(Uv=qv("keyval-store","keyval")),Uv}function Vv(t,e=rl()){return e("readonly",r=>Xs(r.get(t)))}function S2(t,e,r=rl()){return r("readwrite",n=>(n.put(e,t),Xs(n.transaction)))}function T2(t,e=rl()){return e("readwrite",r=>(r.delete(t),Xs(r.transaction)))}function C2(t=rl()){return t("readwrite",e=>(e.clear(),Xs(e.transaction)))}function VQ(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xs(t.transaction)}function x2(t=rl()){return t("readonly",e=>{if(e.getAllKeys)return Xs(e.getAllKeys());let r=[];return VQ(e,n=>r.push(n.key)).then(()=>r)})}var Uv,N2=he(()=>{l()});var O2={};ft(O2,{safeJsonParse:()=>ji,safeJsonStringify:()=>Qi});function ji(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return kQ(t)}catch{return t}}function Qi(t){return typeof t=="string"?t:HQ(t)||""}var HQ,kQ,nl=he(()=>{l();HQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),kQ=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 P2={};ft(P2,{KeyValueStorage:()=>jv,default:()=>jv});function WQ(t){var e;return[t[0],ji((e=t[1])!=null?e:"")]}var GQ,jQ,QQ,zQ,kv,Hv,Jh,Gv,$Q,D2,KQ,YQ,jv,R2=he(()=>{l();_2();N2();nl();GQ="idb-keyval",jQ=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=qv(t.dbName,t.storeName)),{name:GQ,options:t,async hasItem(i){return!(typeof await Vv(r(i),n)>"u")},async getItem(i){return await Vv(r(i),n)??null},setItem(i,s){return S2(r(i),s,n)},removeItem(i){return T2(r(i),n)},getKeys(){return x2(n)},clear(){return C2(n)}}},QQ="WALLET_CONNECT_V2_INDEXED_DB",zQ="keyvaluestorage",kv=class{constructor(){this.indexedDb=I2({driver:jQ({dbName:QQ,storeName:zQ})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Qi(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},Hv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Jh={exports:{}};(function(){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 Hv<"u"&&Hv.localStorage?Jh.exports=Hv.localStorage:typeof window<"u"&&window.localStorage?Jh.exports=window.localStorage:Jh.exports=new e})();Gv=class{constructor(){this.localStorage=Jh.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(WQ)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return ji(r)}async setItem(e,r){this.localStorage.setItem(e,Qi(r))}async removeItem(e){this.localStorage.removeItem(e)}},$Q="wc_storage_version",D2=1,KQ=async(t,e,r)=>{let n=$Q,i=await e.getItem(n);if(i&&i>=D2){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let a=s.shift();if(!a)continue;let u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){let c=await t.getItem(a);await e.setItem(a,c),o.push(a)}}await e.setItem(n,D2),r(e),YQ(t,o)},YQ=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},jv=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new Gv;this.storage=e;try{let r=new kv;KQ(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var Zr={};ft(Zr,{__assign:()=>zv,__asyncDelegator:()=>c7,__asyncGenerator:()=>u7,__asyncValues:()=>l7,__await:()=>il,__awaiter:()=>r7,__classPrivateFieldGet:()=>p7,__classPrivateFieldSet:()=>g7,__createBinding:()=>i7,__decorate:()=>ZQ,__exportStar:()=>s7,__extends:()=>JQ,__generator:()=>n7,__importDefault:()=>h7,__importStar:()=>d7,__makeTemplateObject:()=>f7,__metadata:()=>t7,__param:()=>e7,__read:()=>B2,__rest:()=>XQ,__spread:()=>o7,__spreadArrays:()=>a7,__values:()=>Wv});function JQ(t,e){Qv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function XQ(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 e7(t,e){return function(r,n){e(r,n,t)}}function t7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function r7(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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function n7(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(c){return function(f){return u([c,f])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[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 B2(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 o7(){for(var t=[],e=0;e1||a(g,m)})})}function a(g,m){try{u(n[g](m))}catch(y){d(s[0][3],y)}}function u(g){g.value instanceof il?Promise.resolve(g.value.v).then(c,f):d(s[0][2],g)}function c(g){a("next",g)}function f(g){a("throw",g)}function d(g,m){g(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function c7(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:il(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function l7(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 Wv=="function"?Wv(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(c){s({value:c,done:a})},o)}}function f7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function d7(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 h7(t){return t&&t.__esModule?t:{default:t}}function p7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function g7(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 Qv,zv,en=he(()=>{l();Qv=function(t,e){return Qv=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])},Qv(t,e)};zv=function(){return zv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";l();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.delay=void 0;function y7(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Xh.delay=y7});var F2=v(Ca=>{"use strict";l();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ONE_THOUSAND=Ca.ONE_HUNDRED=void 0;Ca.ONE_HUNDRED=100;Ca.ONE_THOUSAND=1e3});var M2=v(ge=>{"use strict";l();Object.defineProperty(ge,"__esModule",{value:!0});ge.ONE_YEAR=ge.FOUR_WEEKS=ge.THREE_WEEKS=ge.TWO_WEEKS=ge.ONE_WEEK=ge.THIRTY_DAYS=ge.SEVEN_DAYS=ge.FIVE_DAYS=ge.THREE_DAYS=ge.ONE_DAY=ge.TWENTY_FOUR_HOURS=ge.TWELVE_HOURS=ge.SIX_HOURS=ge.THREE_HOURS=ge.ONE_HOUR=ge.SIXTY_MINUTES=ge.THIRTY_MINUTES=ge.TEN_MINUTES=ge.FIVE_MINUTES=ge.ONE_MINUTE=ge.SIXTY_SECONDS=ge.THIRTY_SECONDS=ge.TEN_SECONDS=ge.FIVE_SECONDS=ge.ONE_SECOND=void 0;ge.ONE_SECOND=1;ge.FIVE_SECONDS=5;ge.TEN_SECONDS=10;ge.THIRTY_SECONDS=30;ge.SIXTY_SECONDS=60;ge.ONE_MINUTE=ge.SIXTY_SECONDS;ge.FIVE_MINUTES=ge.ONE_MINUTE*5;ge.TEN_MINUTES=ge.ONE_MINUTE*10;ge.THIRTY_MINUTES=ge.ONE_MINUTE*30;ge.SIXTY_MINUTES=ge.ONE_MINUTE*60;ge.ONE_HOUR=ge.SIXTY_MINUTES;ge.THREE_HOURS=ge.ONE_HOUR*3;ge.SIX_HOURS=ge.ONE_HOUR*6;ge.TWELVE_HOURS=ge.ONE_HOUR*12;ge.TWENTY_FOUR_HOURS=ge.ONE_HOUR*24;ge.ONE_DAY=ge.TWENTY_FOUR_HOURS;ge.THREE_DAYS=ge.ONE_DAY*3;ge.FIVE_DAYS=ge.ONE_DAY*5;ge.SEVEN_DAYS=ge.ONE_DAY*7;ge.THIRTY_DAYS=ge.ONE_DAY*30;ge.ONE_WEEK=ge.SEVEN_DAYS;ge.TWO_WEEKS=ge.ONE_WEEK*2;ge.THREE_WEEKS=ge.ONE_WEEK*3;ge.FOUR_WEEKS=ge.ONE_WEEK*4;ge.ONE_YEAR=ge.ONE_DAY*365});var $v=v(Zh=>{"use strict";l();Object.defineProperty(Zh,"__esModule",{value:!0});var U2=(en(),ht(Zr));U2.__exportStar(F2(),Zh);U2.__exportStar(M2(),Zh)});var V2=v(xa=>{"use strict";l();Object.defineProperty(xa,"__esModule",{value:!0});xa.fromMiliseconds=xa.toMiliseconds=void 0;var q2=$v();function m7(t){return t*q2.ONE_THOUSAND}xa.toMiliseconds=m7;function w7(t){return Math.floor(t/q2.ONE_THOUSAND)}xa.fromMiliseconds=w7});var k2=v(ep=>{"use strict";l();Object.defineProperty(ep,"__esModule",{value:!0});var H2=(en(),ht(Zr));H2.__exportStar(L2(),ep);H2.__exportStar(V2(),ep)});var G2=v(sl=>{"use strict";l();Object.defineProperty(sl,"__esModule",{value:!0});sl.Watch=void 0;var tp=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}};sl.Watch=tp;sl.default=tp});var j2=v(rp=>{"use strict";l();Object.defineProperty(rp,"__esModule",{value:!0});rp.IWatch=void 0;var Kv=class{};rp.IWatch=Kv});var Q2=v(Yv=>{"use strict";l();Object.defineProperty(Yv,"__esModule",{value:!0});var E7=(en(),ht(Zr));E7.__exportStar(j2(),Yv)});var Zs=v(Na=>{"use strict";l();Object.defineProperty(Na,"__esModule",{value:!0});var np=(en(),ht(Zr));np.__exportStar(k2(),Na);np.__exportStar(G2(),Na);np.__exportStar(Q2(),Na);np.__exportStar($v(),Na)});var Jv,z2=he(()=>{l();Jv=class{}});var Xv={};ft(Xv,{IEvents:()=>Jv});var Zv=he(()=>{l();z2()});var W2=v(ip=>{"use strict";l();Object.defineProperty(ip,"__esModule",{value:!0});ip.IHeartBeat=void 0;var v7=(Zv(),ht(Xv)),e1=class extends v7.IEvents{constructor(e){super()}};ip.IHeartBeat=e1});var r1=v(t1=>{"use strict";l();Object.defineProperty(t1,"__esModule",{value:!0});var A7=(en(),ht(Zr));A7.__exportStar(W2(),t1)});var $2=v(Oa=>{"use strict";l();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.HEARTBEAT_EVENTS=Oa.HEARTBEAT_INTERVAL=void 0;var b7=Zs();Oa.HEARTBEAT_INTERVAL=b7.FIVE_SECONDS;Oa.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var i1=v(n1=>{"use strict";l();Object.defineProperty(n1,"__esModule",{value:!0});var I7=(en(),ht(Zr));I7.__exportStar($2(),n1)});var K2=v(sp=>{"use strict";l();Object.defineProperty(sp,"__esModule",{value:!0});sp.HeartBeat=void 0;var s1=(en(),ht(Zr)),_7=ti(),S7=Zs(),T7=r1(),o1=i1(),a1=class t extends T7.IHeartBeat{constructor(e){super(e),this.events=new _7.EventEmitter,this.interval=o1.HEARTBEAT_INTERVAL,this.interval=e?.interval||o1.HEARTBEAT_INTERVAL}static init(e){return s1.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return s1.__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 s1.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),S7.toMiliseconds(this.interval))})}pulse(){this.events.emit(o1.HEARTBEAT_EVENTS.pulse)}};sp.HeartBeat=a1});var Y2=v(ol=>{"use strict";l();Object.defineProperty(ol,"__esModule",{value:!0});var u1=(en(),ht(Zr));u1.__exportStar(K2(),ol);u1.__exportStar(r1(),ol);u1.__exportStar(i1(),ol)});var X2=v((lde,J2)=>{"use strict";l();function C7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}J2.exports=x7;function x7(t,e,r){var n=r&&r.stringify||C7,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(m+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=m+2,m++;break}c+=n(e[f]),d=m+2,m++;break;case 115:if(f>=u)break;d{"use strict";l();var Z2=X2();rD.exports=xn;var al=U7().console||{},N7={mapHttpRequest:op,mapHttpResponse:op,wrapRequestSerializer:c1,wrapResponseSerializer:c1,wrapErrorSerializer:c1,req:op,res:op,err:B7};function O7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function xn(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||al;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=O7(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=ul),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:L7(t)};u.levels=xn.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=ul,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=m,e&&(u._logEvent=l1());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,Da(c,u,"error","log"),Da(c,u,"fatal","error"),Da(c,u,"warn","error"),Da(c,u,"info","log"),Da(c,u,"debug","log"),Da(c,u,"trace","log")}function m(y,A){if(!y)throw new Error("missing bindings for child Pino");A=A||{},i&&y.serializers&&(A.serializers=y.serializers);let O=A.serializers;if(i&&O){var R=Object.assign({},n,O),z=t.browser.serialize===!0?Object.keys(R):i;delete y.serializers,ap([y],z,R,this._stdErrSerialize)}function M(b){this._childLevel=(b._childLevel|0)+1,this.error=Pa(b,y,"error"),this.fatal=Pa(b,y,"fatal"),this.warn=Pa(b,y,"warn"),this.info=Pa(b,y,"info"),this.debug=Pa(b,y,"debug"),this.trace=Pa(b,y,"trace"),R&&(this.serializers=R,this._serialize=z),e&&(this._logEvent=l1([].concat(b._logEvent.bindings,y)))}return M.prototype=this,new M(this)}return u}xn.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"}};xn.stdSerializers=N7;xn.stdTimeFunctions=Object.assign({},{nullTime:eD,epochTime:tD,unixTime:F7,isoTime:M7});function Da(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?ul:i[r]?i[r]:al[r]||al[n]||ul,D7(t,e,r)}function D7(t,e,r){!t.transmit&&e[r]===ul||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===al?al:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Pa(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";l();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.PINO_CUSTOM_CONTEXT_KEY=Ra.PINO_LOGGER_DEFAULTS=void 0;Ra.PINO_LOGGER_DEFAULTS={level:"info"};Ra.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var uD=v(mr=>{"use strict";l();Object.defineProperty(mr,"__esModule",{value:!0});mr.generateChildLogger=mr.formatChildLoggerContext=mr.getLoggerContext=mr.setBrowserLoggerContext=mr.getBrowserLoggerContext=mr.getDefaultLoggerOptions=void 0;var Ba=f1();function q7(t){return Object.assign(Object.assign({},t),{level:t?.level||Ba.PINO_LOGGER_DEFAULTS.level})}mr.getDefaultLoggerOptions=q7;function iD(t,e=Ba.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}mr.getBrowserLoggerContext=iD;function sD(t,e,r=Ba.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}mr.setBrowserLoggerContext=sD;function oD(t,e=Ba.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=iD(t,e):r=t.bindings().context||"",r}mr.getLoggerContext=oD;function aD(t,e,r=Ba.PINO_CUSTOM_CONTEXT_KEY){let n=oD(t,r);return n.trim()?`${n}/${e}`:e}mr.formatChildLoggerContext=aD;function V7(t,e,r=Ba.PINO_CUSTOM_CONTEXT_KEY){let n=aD(t,e,r),i=t.child({context:n});return sD(i,n,r)}mr.generateChildLogger=V7});var h1=v(La=>{"use strict";l();Object.defineProperty(La,"__esModule",{value:!0});La.pino=void 0;var d1=(en(),ht(Zr)),H7=d1.__importDefault(nD());Object.defineProperty(La,"pino",{enumerable:!0,get:function(){return H7.default}});d1.__exportStar(f1(),La);d1.__exportStar(uD(),La)});var P1=v(Ot=>{"use strict";l();Object.defineProperty(Ot,"__esModule",{value:!0});var Fa=(Zv(),ht(Xv)),cD=ti();function k7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var G7=k7(cD),p1=class extends Fa.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},g1=class{constructor(e,r,n){this.core=e,this.logger=r}},y1=class extends Fa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},m1=class{constructor(e,r){this.logger=e,this.core=r}},w1=class extends Fa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},E1=class extends Fa.IEvents{constructor(e){super()}},v1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},A1=class{constructor(){this.map=new Map}},b1=class extends Fa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},I1=class{constructor(e,r){this.core=e,this.logger=r}},_1=class extends Fa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},S1=class{constructor(e,r){this.logger=e,this.core=r}},T1=class{constructor(e,r){this.projectId=e,this.logger=r}},C1=class{constructor(e,r){this.projectId=e,this.logger=r}},x1=class extends G7.default{constructor(){super()}},N1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},O1=class extends cD.EventEmitter{constructor(){super()}},D1=class{constructor(e){this.client=e}};Ot.ICore=p1,Ot.ICrypto=g1,Ot.IEchoClient=C1,Ot.IEngine=D1,Ot.IEngineEvents=O1,Ot.IExpirer=_1,Ot.IJsonRpcHistory=y1,Ot.IKeyChain=I1,Ot.IMessageTracker=m1,Ot.IPairing=S1,Ot.IPublisher=w1,Ot.IRelayer=E1,Ot.ISignClient=N1,Ot.ISignClientEvents=x1,Ot.IStore=v1,Ot.ISubscriber=b1,Ot.ISubscriberTopicMap=A1,Ot.IVerify=T1});var fD=v(up=>{"use strict";l();Object.defineProperty(up,"__esModule",{value:!0});up.BrowserRandomSource=void 0;var lD=65536,R1=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";l();Object.defineProperty(B1,"__esModule",{value:!0});function j7(t){for(var e=0;e{l()});var hD=v(cp=>{"use strict";l();Object.defineProperty(cp,"__esModule",{value:!0});cp.NodeRandomSource=void 0;var Q7=Hr(),L1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof _S<"u"){let e=dD();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";l();Object.defineProperty(lp,"__esModule",{value:!0});lp.SystemRandomSource=void 0;var z7=fD(),W7=hD(),F1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new z7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new W7.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)}};lp.SystemRandomSource=F1});var gD=v(Ir=>{"use strict";l();Object.defineProperty(Ir,"__esModule",{value:!0});function $7(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}Ir.mul=Math.imul||$7;function K7(t,e){return t+e|0}Ir.add=K7;function Y7(t,e){return t-e|0}Ir.sub=Y7;function J7(t,e){return t<>>32-e}Ir.rotl=J7;function X7(t,e){return t<<32-e|t>>>e}Ir.rotr=X7;function Z7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ir.isInteger=Number.isInteger||Z7;Ir.MAX_SAFE_INTEGER=9007199254740991;Ir.isSafeInteger=function(t){return Ir.isInteger(t)&&t>=-Ir.MAX_SAFE_INTEGER&&t<=Ir.MAX_SAFE_INTEGER}});var Ma=v(Oe=>{"use strict";l();Object.defineProperty(Oe,"__esModule",{value:!0});var yD=gD();function e9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Oe.readInt16BE=e9;function t9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Oe.readUint16BE=t9;function r9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Oe.readInt16LE=r9;function n9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Oe.readUint16LE=n9;function mD(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}Oe.writeUint16BE=mD;Oe.writeInt16BE=mD;function wD(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}Oe.writeUint16LE=wD;Oe.writeInt16LE=wD;function M1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Oe.readInt32BE=M1;function U1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Oe.readUint32BE=U1;function q1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Oe.readInt32LE=q1;function V1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Oe.readUint32LE=V1;function fp(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}Oe.writeUint32BE=fp;Oe.writeInt32BE=fp;function dp(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}Oe.writeUint32LE=dp;Oe.writeInt32LE=dp;function i9(t,e){e===void 0&&(e=0);var r=M1(t,e),n=M1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Oe.readInt64BE=i9;function s9(t,e){e===void 0&&(e=0);var r=U1(t,e),n=U1(t,e+4);return r*4294967296+n}Oe.readUint64BE=s9;function o9(t,e){e===void 0&&(e=0);var r=q1(t,e),n=q1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Oe.readInt64LE=o9;function a9(t,e){e===void 0&&(e=0);var r=V1(t,e),n=V1(t,e+4);return n*4294967296+r}Oe.readUint64LE=a9;function ED(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fp(t/4294967296>>>0,e,r),fp(t>>>0,e,r+4),e}Oe.writeUint64BE=ED;Oe.writeInt64BE=ED;function vD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),dp(t>>>0,e,r),dp(t/4294967296>>>0,e,r+4),e}Oe.writeUint64LE=vD;Oe.writeInt64LE=vD;function u9(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}Oe.readUintBE=u9;function c9(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}Oe.writeUintBE=l9;function f9(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(!yD.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";l();Object.defineProperty(er,"__esModule",{value:!0});er.randomStringForEntropy=er.randomString=er.randomUint32=er.randomBytes=er.defaultRandomSource=void 0;var v9=pD(),A9=Ma(),AD=Hr();er.defaultRandomSource=new v9.SystemRandomSource;function H1(t,e=er.defaultRandomSource){return e.randomBytes(t)}er.randomBytes=H1;function b9(t=er.defaultRandomSource){let e=H1(4,t),r=(0,A9.readUint32LE)(e);return(0,AD.wipe)(e),r}er.randomUint32=b9;var bD="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function ID(t,e=bD,r=er.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=H1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(ni,"__esModule",{value:!0});var qa=Ma(),Ua=Hr();ni.DIGEST_LENGTH=64;ni.BLOCK_SIZE=128;var SD=function(){function t(){this.digestLength=ni.DIGEST_LENGTH,this.blockSize=ni.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(){Ua.wipe(this._buffer),Ua.wipe(this._tempHi),Ua.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&&(k1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=k1(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){Ua.wipe(e.stateHi),Ua.wipe(e.stateLo),e.buffer&&Ua.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();ni.SHA512=SD;var _D=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 k1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],c=r[2],f=r[3],d=r[4],g=r[5],m=r[6],y=r[7],A=n[0],O=n[1],R=n[2],z=n[3],M=n[4],b=n[5],S=n[6],N=n[7],_,T,B,X,Q,H,j,K;o>=128;){for(var me=0;me<16;me++){var ce=8*me+s;t[me]=qa.readUint32BE(i,ce),e[me]=qa.readUint32BE(i,ce+4)}for(var me=0;me<80;me++){var ie=a,J=u,oe=c,re=f,se=d,U=g,fe=m,ue=y,de=A,ae=O,le=R,w=z,E=M,I=b,P=S,C=N;if(_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(d>>>14|M<<18)^(d>>>18|M<<14)^(M>>>9|d<<23),T=(M>>>14|d<<18)^(M>>>18|d<<14)^(d>>>9|M<<23),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=d&g^~d&m,T=M&b^~M&S,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=_D[me*2],T=_D[me*2+1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=t[me%16],T=e[me%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,B=j&65535|K<<16,X=Q&65535|H<<16,_=B,T=X,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(a>>>28|A<<4)^(A>>>2|a<<30)^(A>>>7|a<<25),T=(A>>>28|a<<4)^(a>>>2|A<<30)^(a>>>7|A<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=a&u^a&c^u&c,T=A&O^A&R^O&R,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,ue=j&65535|K<<16,C=Q&65535|H<<16,_=re,T=w,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=B,T=X,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,re=j&65535|K<<16,w=Q&65535|H<<16,u=ie,c=J,f=oe,d=re,g=se,m=U,y=fe,a=ue,O=de,R=ae,z=le,M=w,b=E,S=I,N=P,A=C,me%16===15)for(var ce=0;ce<16;ce++)_=t[ce],T=e[ce],Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=t[(ce+9)%16],T=e[(ce+9)%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+1)%16],X=e[(ce+1)%16],_=(B>>>1|X<<31)^(B>>>8|X<<24)^B>>>7,T=(X>>>1|B<<31)^(X>>>8|B<<24)^(X>>>7|B<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+14)%16],X=e[(ce+14)%16],_=(B>>>19|X<<13)^(X>>>29|B<<3)^B>>>6,T=(X>>>19|B<<13)^(B>>>29|X<<3)^(X>>>6|B<<26),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,t[ce]=j&65535|K<<16,e[ce]=Q&65535|H<<16}_=a,T=A,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[0],T=n[0],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[0]=a=j&65535|K<<16,n[0]=A=Q&65535|H<<16,_=u,T=O,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[1],T=n[1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[1]=u=j&65535|K<<16,n[1]=O=Q&65535|H<<16,_=c,T=R,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[2],T=n[2],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[2]=c=j&65535|K<<16,n[2]=R=Q&65535|H<<16,_=f,T=z,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[3],T=n[3],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[3]=f=j&65535|K<<16,n[3]=z=Q&65535|H<<16,_=d,T=M,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[4],T=n[4],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[4]=d=j&65535|K<<16,n[4]=M=Q&65535|H<<16,_=g,T=b,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[5],T=n[5],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[5]=g=j&65535|K<<16,n[5]=b=Q&65535|H<<16,_=m,T=S,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[6],T=n[6],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[6]=m=j&65535|K<<16,n[6]=S=Q&65535|H<<16,_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[7],T=n[7],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[7]=y=j&65535|K<<16,n[7]=N=Q&65535|H<<16,s+=128,o-=128}return s}function _9(t){var e=new SD;e.update(t);var r=e.digest();return e.clean(),r}ni.hash=_9});var VD=v(ke=>{"use strict";l();Object.defineProperty(ke,"__esModule",{value:!0});ke.convertSecretKeyToX25519=ke.convertPublicKeyToX25519=ke.verify=ke.sign=ke.extractPublicKeyFromSecretKey=ke.generateKeyPair=ke.generateKeyPairFromSeed=ke.SEED_LENGTH=ke.SECRET_KEY_LENGTH=ke.PUBLIC_KEY_LENGTH=ke.SIGNATURE_LENGTH=void 0;var S9=cl(),ll=TD(),DD=Hr();ke.SIGNATURE_LENGTH=64;ke.PUBLIC_KEY_LENGTH=32;ke.SECRET_KEY_LENGTH=64;ke.SEED_LENGTH=32;function Te(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,PD(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 RD(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function ND(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return fl(r,t),fl(n,e),RD(r,n)}function BD(t){let e=new Uint8Array(32);return fl(e,t),e[0]&1}function O9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function eo(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ro(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $e(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,A=0,O=0,R=0,z=0,M=0,b=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],E=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*E,A+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,b+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,A+=n*E,O+=n*I,R+=n*P,z+=n*C,M+=n*D,b+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,A+=n*w,O+=n*E,R+=n*I,z+=n*P,M+=n*C,b+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,A+=n*le,O+=n*w,R+=n*E,z+=n*I,M+=n*P,b+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,A+=n*ae,O+=n*le,R+=n*w,z+=n*E,M+=n*I,b+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,A+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*E,b+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,A+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,b+=n*E,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,A+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,b+=n*w,S+=n*E,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,A+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,b+=n*le,S+=n*w,N+=n*E,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,A+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,b+=n*ae,S+=n*le,N+=n*w,_+=n*E,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],A+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,b+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*E,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,b+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*E,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,b+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*E,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,b+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*E,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,b+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*E,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],b+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*E,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,A+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=A,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=b}function to(t,e){$e(t,e,e)}function LD(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)to(r,r),n!==2&&n!==4&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function D9(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)to(r,r),n!==1&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function z1(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te(),c=Te(),f=Te();ro(r,t[1],t[0]),ro(f,e[1],e[0]),$e(r,r,f),eo(n,t[0],t[1]),eo(f,e[0],e[1]),$e(n,n,f),$e(i,t[3],e[3]),$e(i,i,x9),$e(s,t[2],e[2]),eo(s,s,s),ro(o,n,r),ro(a,s,i),eo(u,s,i),eo(c,n,r),$e(t[0],o,a),$e(t[1],c,u),$e(t[2],u,a),$e(t[3],o,c)}function OD(t,e,r){for(let n=0;n<4;n++)PD(t[n],e[n],r)}function $1(t,e){let r=Te(),n=Te(),i=Te();LD(i,e[2]),$e(r,e[0],i),$e(n,e[1],i),fl(t,n),t[31]^=BD(r)<<7}function FD(t,e,r){zi(t[0],Q1),zi(t[1],Va),zi(t[2],Va),zi(t[3],Q1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;OD(t,e,i),z1(e,t),z1(t,t),OD(t,e,i)}}function K1(t,e){let r=[Te(),Te(),Te(),Te()];zi(r[0],CD),zi(r[1],xD),zi(r[2],Va),$e(r[3],CD,xD),FD(t,r,e)}function MD(t){if(t.length!==ke.SEED_LENGTH)throw new Error(`ed25519: seed must be ${ke.SEED_LENGTH} bytes`);let e=(0,ll.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Te(),Te(),Te(),Te()];K1(n,e),$1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}ke.generateKeyPairFromSeed=MD;function P9(t){let e=(0,S9.randomBytes)(32,t),r=MD(e);return(0,DD.wipe)(e),r}ke.generateKeyPair=P9;function R9(t){if(t.length!==ke.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${ke.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}ke.extractPublicKeyFromSecretKey=R9;var j1=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 UD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*j1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*j1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function W1(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;UD(t,e)}function B9(t,e){let r=new Float64Array(64),n=[Te(),Te(),Te(),Te()],i=(0,ll.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 ll.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),W1(a),K1(n,a),$1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();W1(u);for(let c=0;c<32;c++)r[c]=a[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=u[c]*i[f];return UD(s.subarray(32),r),s}ke.sign=B9;function qD(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te();return zi(t[2],Va),O9(t[1],e),to(i,t[1]),$e(s,i,C9),ro(i,i,t[2]),eo(s,t[2],s),to(o,s),to(a,o),$e(u,a,o),$e(r,u,i),$e(r,r,s),D9(r,r),$e(r,r,i),$e(r,r,s),$e(r,r,s),$e(t[0],r,s),to(n,t[0]),$e(n,n,s),ND(n,i)&&$e(t[0],t[0],N9),to(n,t[0]),$e(n,n,s),ND(n,i)?-1:(BD(t[0])===e[31]>>7&&ro(t[0],Q1,t[0]),$e(t[3],t[0],t[1]),0)}function L9(t,e,r){let n=new Uint8Array(32),i=[Te(),Te(),Te(),Te()],s=[Te(),Te(),Te(),Te()];if(r.length!==ke.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${ke.SIGNATURE_LENGTH} bytes`);if(qD(s,t))return!1;let o=new ll.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return W1(a),FD(i,s,a),K1(s,r.subarray(32)),z1(i,s),$1(n,i),!RD(r,n)}ke.verify=L9;function F9(t){let e=[Te(),Te(),Te(),Te()];if(qD(e,t))throw new Error("Ed25519: invalid public key");let r=Te(),n=Te(),i=e[1];eo(r,Va,i),ro(n,Va,i),LD(n,n),$e(r,r,n);let s=new Uint8Array(32);return fl(s,r),s}ke.convertPublicKeyToX25519=F9;function M9(t){let e=(0,ll.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,DD.wipe)(e),r}ke.convertSecretKeyToX25519=M9});var hp,pp,no,Ha,gp,dl,yp,mp,wp,ka,Ep,vp,HD,kD,Ap=he(()=>{l();hp="EdDSA",pp="JWT",no=".",Ha="base64url",gp="utf8",dl="utf8",yp=":",mp="did",wp="key",ka="base58btc",Ep="z",vp="K36",HD=32,kD=32});function Wi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var hl=he(()=>{l()});function Ga(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Wi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var bp=he(()=>{l();hl()});function Ip(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ga(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Wi(r)}var Y1=he(()=>{l();bp();hl()});function U9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,b=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,b[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&b[T]===0;)T++;for(var B=u.repeat(A);T>>0,M=new Uint8Array(z);y[A];){var b=r[y.charCodeAt(A)];if(b===255)return;for(var S=0,N=z-1;(b!==0||S>>0,M[N]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");R=S,A++}if(y[A]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var A=g(y);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var q9,V9,GD,jD=he(()=>{l();q9=U9,V9=q9,GD=V9});var nhe,QD,ii,zD,WD,$i=he(()=>{l();nhe=new Uint8Array(0),QD=(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")},zD=t=>new TextEncoder().encode(t),WD=t=>new TextDecoder().decode(t)});var J1,X1,Z1,KD,eA,ja,Ki,H9,k9,yt,tn=he(()=>{l();jD();$i();J1=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")}},X1=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 KD(this,e)}},Z1=class{constructor(e){this.decoders=e}or(e){return KD(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`)}},KD=(t,e)=>new Z1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),eA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new J1(e,r,n),this.decoder=new X1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ja=({name:t,prefix:e,encode:r,decode:n})=>new eA(t,e,r,n),Ki=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=GD(r,e);return ja({prefix:t,name:e,encode:n,decode:s=>ii(i(s))})},H9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},k9=(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<ja({prefix:e,name:t,encode(i){return k9(i,n,r)},decode(i){return H9(i,n,r,t)}})});var tA={};ft(tA,{identity:()=>G9});var G9,YD=he(()=>{l();tn();$i();G9=ja({prefix:"\0",name:"identity",encode:t=>WD(t),decode:t=>zD(t)})});var rA={};ft(rA,{base2:()=>j9});var j9,JD=he(()=>{l();tn();j9=yt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var nA={};ft(nA,{base8:()=>Q9});var Q9,XD=he(()=>{l();tn();Q9=yt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var iA={};ft(iA,{base10:()=>z9});var z9,ZD=he(()=>{l();tn();z9=Ki({prefix:"9",name:"base10",alphabet:"0123456789"})});var sA={};ft(sA,{base16:()=>W9,base16upper:()=>$9});var W9,$9,eP=he(()=>{l();tn();W9=yt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$9=yt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var oA={};ft(oA,{base32:()=>Qa,base32hex:()=>X9,base32hexpad:()=>ez,base32hexpadupper:()=>tz,base32hexupper:()=>Z9,base32pad:()=>Y9,base32padupper:()=>J9,base32upper:()=>K9,base32z:()=>rz});var Qa,K9,Y9,J9,X9,Z9,ez,tz,rz,aA=he(()=>{l();tn();Qa=yt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),K9=yt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Y9=yt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),J9=yt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),X9=yt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Z9=yt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ez=yt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),tz=yt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rz=yt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var uA={};ft(uA,{base36:()=>nz,base36upper:()=>iz});var nz,iz,tP=he(()=>{l();tn();nz=Ki({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),iz=Ki({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var cA={};ft(cA,{base58btc:()=>Nn,base58flickr:()=>sz});var Nn,sz,lA=he(()=>{l();tn();Nn=Ki({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),sz=Ki({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var fA={};ft(fA,{base64:()=>oz,base64pad:()=>az,base64url:()=>uz,base64urlpad:()=>cz});var oz,az,uz,cz,rP=he(()=>{l();tn();oz=yt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),az=yt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),uz=yt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),cz=yt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var dA={};ft(dA,{base256emoji:()=>pz});function dz(t){return t.reduce((e,r)=>(e+=lz[r],e),"")}function hz(t){let e=[];for(let r of t){let n=fz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var nP,lz,fz,pz,iP=he(()=>{l();tn();nP=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}"),lz=nP.reduce((t,e,r)=>(t[r]=e,t),[]),fz=nP.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);pz=ja({prefix:"\u{1F680}",name:"base256emoji",encode:dz,decode:hz})});function aP(t,e,r){e=e||[],r=r||0;for(var n=r;t>=wz;)e[r++]=t&255|sP,t/=128;for(;t&mz;)e[r++]=t&255|sP,t>>>=7;return e[r]=t|0,aP.bytes=r-n+1,e}function hA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw hA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&oP)<=vz);return hA.bytes=s-n,r}var gz,sP,yz,mz,wz,Ez,vz,oP,Az,bz,Iz,_z,Sz,Tz,Cz,xz,Nz,Oz,Dz,Pz,pl,uP=he(()=>{l();gz=aP,sP=128,yz=127,mz=~yz,wz=Math.pow(2,31);Ez=hA,vz=128,oP=127;Az=Math.pow(2,7),bz=Math.pow(2,14),Iz=Math.pow(2,21),_z=Math.pow(2,28),Sz=Math.pow(2,35),Tz=Math.pow(2,42),Cz=Math.pow(2,49),xz=Math.pow(2,56),Nz=Math.pow(2,63),Oz=function(t){return t{l();uP();gl=(t,e=0)=>[pl.decode(t,e),pl.decode.bytes],za=(t,e,r=0)=>(pl.encode(t,e,r),e),Wa=t=>pl.encodingLength(t)});var io,cP,lP,$a,ml=he(()=>{l();$i();Sp();io=(t,e)=>{let r=e.byteLength,n=Wa(t),i=n+Wa(r),s=new Uint8Array(i+r);return za(t,s,0),za(r,s,n),s.set(e,i),new $a(t,r,e,s)},cP=t=>{let e=ii(t),[r,n]=gl(e),[i,s]=gl(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new $a(r,i,o,e)},lP=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&QD(t.bytes,e.bytes),$a=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var gA,pA,yA=he(()=>{l();ml();gA=({name:t,code:e,encode:r})=>new pA(t,e,r),pA=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?io(this.code,r):r.then(n=>io(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var mA={};ft(mA,{sha256:()=>Rz,sha512:()=>Bz});var dP,Rz,Bz,hP=he(()=>{l();yA();dP=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Rz=gA({name:"sha2-256",code:18,encode:dP("SHA-256")}),Bz=gA({name:"sha2-512",code:19,encode:dP("SHA-512")})});var wA={};ft(wA,{identity:()=>Mz});var pP,Lz,gP,Fz,Mz,yP=he(()=>{l();$i();ml();pP=0,Lz="identity",gP=ii,Fz=t=>io(pP,gP(t)),Mz={code:pP,name:Lz,encode:gP,digest:Fz}});var mP=he(()=>{l();$i()});var Ghe,jhe,wP=he(()=>{l();Ghe=new TextEncoder,jhe=new TextDecoder});var xp,Vz,Hz,kz,wl,Gz,EP,vP,Tp,Cp,jz,Qz,zz,AP=he(()=>{l();Sp();ml();lA();aA();$i();xp=class t{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:Cp,byteLength:Cp,code:Tp,version:Tp,multihash:Tp,bytes:Tp,_baseCache:Cp,asCID:Cp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==wl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Gz)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=io(e,r);return t.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&&lP(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return Hz(r,i,e||Nn.encoder);default:return kz(r,i,e||Qa.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 Qz(/^0\.0/,zz),!!(e&&(e[vP]||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 t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||EP(r,n,i.bytes))}else if(e!=null&&e[vP]===!0){let{version:r,multihash:n,code:i}=e,s=cP(n);return t.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!==wl)throw new Error(`Version 0 CID must use dag-pb (code: ${wl}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=EP(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,wl,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=ii(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 $a(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,g]=gl(e.subarray(r));return r+=g,d},i=n(),s=wl;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(),c=r+u,f=c-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=Vz(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Vz=(t,e)=>{switch(t[0]){case"Q":{let r=e||Nn;return[Nn.prefix,r.decode(`${Nn.prefix}${t}`)]}case Nn.prefix:{let r=e||Nn;return[Nn.prefix,r.decode(t)]}case Qa.prefix:{let r=e||Qa;return[Qa.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)]}}},Hz=(t,e,r)=>{let{prefix:n}=r;if(n!==Nn.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},kz=(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},wl=112,Gz=18,EP=(t,e,r)=>{let n=Wa(t),i=n+Wa(e),s=new Uint8Array(i+r.byteLength);return za(t,s,0),za(e,s,n),s.set(r,i),s},vP=Symbol.for("@ipld/js-cid/CID"),Tp={writable:!1,configurable:!1,enumerable:!0},Cp={writable:!1,enumerable:!1,configurable:!1},jz="0.0.0-dev",Qz=(t,e)=>{if(t.test(jz))console.warn(e);else throw new Error(e)},zz=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};pe.ErrContractHasNoAddress=Sm;var Tm=class extends Pe{constructor(e){super(e)}};pe.ErrMock=Tm;var Cm=class extends Pe{constructor(e){super(e)}};pe.ErrTypingSystem=Cm;var xm=class extends Pe{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=xm;var Nm=class extends Pe{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=Nm;var Om=class extends Pe{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Om;var Dm=class extends Pe{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=Dm;var Pm=class extends Pe{constructor(e){super(e)}};pe.ErrCodec=Pm;var Rm=class extends Pe{constructor(e){super(e)}};pe.ErrContractInteraction=Rm;var Bm=class extends Pe{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Bm;var Lm=class extends Pe{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Lm;var Fm=class extends Pe{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=Fm;var Mm=class extends Pe{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=Mm;var Um=class extends Pe{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};pe.ErrIsCompletedFieldIsMissingOnTransaction=Um});var Vm=A(vi=>{"use strict";l();var g5=vi&&vi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vi,"__esModule",{value:!0});vi.TokenPayment=vi.TokenTransfer=void 0;var ju=g5(Yt()),y5=Le(),$S="EGLD",KS=18;ju.default.set({ROUNDING_MODE:1});var Tf=class t{constructor(e){let r=new ju.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new y5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new ju.default(e).shiftedBy(KS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:$S,nonce:0,amountAsBigInteger:e,numDecimals:KS})}static fungibleFromAmount(e,r,n){let i=new ju.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new ju.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({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==$S}isFungible(){return this.nonce==0}};vi.TokenTransfer=Tf;var qm=class extends Tf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};vi.TokenPayment=qm});var Os=A(Xe=>{"use strict";l();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ARGUMENTS_SEPARATOR=Xe.ESDT_TRANSFER_VALUE=Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDTNFT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_FUNCTION_NAME=Xe.ESDT_TRANSFER_GAS_LIMIT=Xe.TRANSACTION_VERSION_WITH_OPTIONS=Xe.TRANSACTION_VERSION_DEFAULT=Xe.TRANSACTION_OPTIONS_TX_GUARDED=Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=Xe.TRANSACTION_OPTIONS_DEFAULT=Xe.TRANSACTION_MIN_GAS_PRICE=void 0;Xe.TRANSACTION_MIN_GAS_PRICE=1e9;Xe.TRANSACTION_OPTIONS_DEFAULT=0;Xe.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;Xe.TRANSACTION_OPTIONS_TX_GUARDED=2;Xe.TRANSACTION_VERSION_DEFAULT=1;Xe.TRANSACTION_VERSION_WITH_OPTIONS=2;Xe.ESDT_TRANSFER_GAS_LIMIT=5e5;Xe.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";Xe.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";Xe.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";Xe.ESDT_TRANSFER_VALUE="0";Xe.ARGUMENTS_SEPARATOR="@"});var br=A(ot=>{"use strict";l();var m5=ot&&ot.__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]}),w5=ot&&ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E5=ot&&ot.__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 w5(e,t),e};Object.defineProperty(ot,"__esModule",{value:!0});ot.isEmpty=ot.guardEmpty=ot.guardNotEmpty=ot.guardLength=ot.guardSameLength=ot.guardValueIsSetWithMessage=ot.guardValueIsSet=ot.guardTrue=void 0;var Do=E5(Le());function v5(t,e){if(!t)throw new Do.ErrInvariantFailed(`[<${e}>] isn't true`)}ot.guardTrue=v5;function A5(t,e){YS(`${t} isn't set (null or undefined)`,e)}ot.guardValueIsSet=A5;function YS(t,e){if(e==null||e===void 0)throw new Do.ErrInvariantFailed(t)}ot.guardValueIsSetWithMessage=YS;function b5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Do.ErrInvariantFailed("arrays do not have the same length")}ot.guardSameLength=b5;function I5(t,e){let r=t.length||0;if(r!=e)throw new Do.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}ot.guardLength=I5;function _5(t,e){if(Hm(t))throw new Do.ErrInvariantFailed(`${e} is empty`)}ot.guardNotEmpty=_5;function S5(t,e){if(!Hm(t))throw new Do.ErrInvariantFailed(`${e} is not empty`)}ot.guardEmpty=S5;function Hm(t){return t.isEmpty?t.isEmpty():t.length===0}ot.isEmpty=Hm});var JS=A(Cf=>{"use strict";l();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.getJavascriptPrototypesInHierarchy=void 0;function T5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Cf.getJavascriptPrototypesInHierarchy=T5});var Ct=A(Tt=>{"use strict";l();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.NullType=Tt.TypePlaceholder=Tt.isTyped=Tt.PrimitiveValue=Tt.TypedValue=Tt.CustomType=Tt.PrimitiveType=Tt.TypeCardinality=Tt.Type=void 0;var km=JS(),XS=br(),Ai=class t{constructor(e,r=[],n=Qu.fixed(1)){XS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return km.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 XS.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 t.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(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return km.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(){}};Tt.Type=Ai;Ai.ClassName="Type";var Qu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(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||t.MaxCardinality}};Tt.TypeCardinality=Qu;Qu.MaxCardinality=4096;var xf=class t extends Ai{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveType=xf;xf.ClassName="PrimitiveType";var Nf=class t extends Ai{getClassName(){return t.ClassName}};Tt.CustomType=Nf;Nf.ClassName="CustomType";var zu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return km.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(){}};Tt.TypedValue=zu;zu.ClassName="TypedValue";var Of=class t extends zu{constructor(e){super(e)}getClassName(){return t.ClassName}};Tt.PrimitiveValue=Of;Of.ClassName="PrimitiveValue";function C5(t){return t.belongsToTypesystem!==void 0}Tt.isTyped=C5;var Df=class t extends Ai{constructor(){super("...")}getClassName(){return t.ClassName}};Tt.TypePlaceholder=Df;Df.ClassName="TypePlaceholder";var Pf=class t extends Ai{constructor(){super("?")}getClassName(){return t.ClassName}};Tt.NullType=Pf;Pf.ClassName="NullType"});var ZS=A((Po,Ro)=>{l();(function(t){var e=typeof Po=="object"&&Po&&!Po.nodeType&&Po,r=typeof Ro=="object"&&Ro&&!Ro.nodeType&&Ro,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,c=38,f=700,d=72,g=128,m="-",y=/^xn--/,b=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=o-a,M=Math.floor,E=String.fromCharCode,S;function N(J){throw new RangeError(R[J])}function _(J,oe){for(var re=J.length,se=[];re--;)se[re]=oe(J[re]);return se}function T(J,oe){var re=J.split("@"),se="";re.length>1&&(se=re[0]+"@",J=re[1]),J=J.replace(O,".");var U=J.split("."),fe=_(U,oe).join(".");return se+fe}function B(J){for(var oe=[],re=0,se=J.length,U,fe;re=55296&&U<=56319&&re65535&&(oe-=65536,re+=E(oe>>>10&1023|55296),oe=56320|oe&1023),re+=E(oe),re}).join("")}function Q(J){return J-48<10?J-22:J-65<26?J-65:J-97<26?J-97:o}function H(J,oe){return J+22+75*(J<26)-((oe!=0)<<5)}function j(J,oe,re){var se=0;for(J=re?M(J/f):J>>1,J+=M(J/oe);J>z*u>>1;se+=o)J=M(J/z);return M(se+(z+1)*J/(J+c))}function K(J){var oe=[],re=J.length,se,U=0,fe=g,ue=d,de,ae,le,w,v,I,P,C,D;for(de=J.lastIndexOf(m),de<0&&(de=0),ae=0;ae=128&&N("not-basic"),oe.push(J.charCodeAt(ae));for(le=de>0?de+1:0;le=re&&N("invalid-input"),P=Q(J.charCodeAt(le++)),(P>=o||P>M((s-U)/v))&&N("overflow"),U+=P*v,C=I<=ue?a:I>=ue+u?u:I-ue,!(PM(s/D)&&N("overflow"),v*=D;se=oe.length+1,ue=j(U-w,se,w==0),M(U/se)>s-fe&&N("overflow"),fe+=M(U/se),U%=se,oe.splice(U++,0,fe)}return X(oe)}function me(J){var oe,re,se,U,fe,ue,de,ae,le,w,v,I=[],P,C,D,L;for(J=B(J),P=J.length,oe=g,re=0,fe=d,ue=0;ue=oe&&vM((s-re)/C)&&N("overflow"),re+=(de-oe)*C,oe=de,ue=0;ues&&N("overflow"),v==oe){for(ae=re,le=o;w=le<=fe?a:le>=fe+u?u:le-fe,!(ae{"use strict";l();var tT=ZS();function x5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Gm(t){return t>="0"&&t<="7"}function N5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function eT(t){return t=parseInt(t,16),tT.ucs2.encode([t])}function rT(t,e,r){var n=!1,i=[];function s(u){var c=t[u];if(!N5(c))throw new x5(u,"Unexpected token ILLEGAL");return c}for(;e{l();var oT=nT();cT.exports={validate:O5,parse:D5};function O5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Rf(t,0,e,!1)}catch(n){r=n.message}return r}function D5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Rf(t,0,e,!0);return r.value}function aT(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function L5(t,e,r,n){for(var i=e,s=",",o=[],a=e;Ds(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Rf(t,i,r,n),c=aT(t,u.end);n&&o.push(u.value),i=c.end,s=c.value}return{start:e,end:i,value:o}}function F5(t,e){return t.substr(e,4)==="true"}function M5(t,e){return t.substr(e,5)==="false"}function U5(t,e){return t.substr(e,4)==="null"}var q5=new RegExp(/^\s$/);function Ds(t){return q5.test(t)}var V5=new RegExp(/^\d$/);function iT(t){return V5.test(t)}function Kn(t,e,r){var n=10,i;t.length{"use strict";l();var H5=cn&&cn.__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=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G5=cn&&cn.__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 k5(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.TypeExpressionParser=void 0;var fT=G5(Le()),j5=Ct(),Q5=lT(),Qm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new fT.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return Q5.parse(r)}catch{throw new fT.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 j5.Type(e,n)}};cn.TypeExpressionParser=Qm});var Wm=A(bi=>{"use strict";l();Object.defineProperty(bi,"__esModule",{value:!0});bi.EndpointParameterDefinition=bi.EndpointModifiers=bi.EndpointDefinition=void 0;var z5=Wu(),dT="?",W5="N / A",zm=class t{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?dT:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>$u.fromJSON(s)),n=e.outputs.map(s=>$u.fromJSON(s)),i=new Bf(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};bi.EndpointDefinition=zm;var Bf=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}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"}isOnlyOwner(){return this.onlyOwner}};bi.EndpointModifiers=Bf;var $u=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new z5.TypeExpressionParser().parse(e.type);return new t(e.name||dT,e.description||W5,r)}};bi.EndpointParameterDefinition=$u});var Bo=A(fr=>{"use strict";l();var $5=fr&&fr.__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=fr&&fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y5=fr&&fr.__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)&&$5(e,t,r);return K5(e,t),e};Object.defineProperty(fr,"__esModule",{value:!0});fr.Fields=fr.Field=fr.FieldDefinition=void 0;var $m=Y5(Le()),J5=Wu(),Km=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new J5.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};fr.FieldDefinition=Km;var Ym=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new $m.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new $m.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};fr.Field=Ym;var Jm=class{static checkTyping(e,r){if(e.length!=r.length)throw new $m.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";l();Object.defineProperty(Ii,"__esModule",{value:!0});Ii.EnumValue=Ii.EnumVariantDefinition=Ii.EnumType=void 0;var X5=Le(),Xm=br(),Lf=Bo(),pT=Ct(),hT=256,Ff=class t extends pT.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>Mf.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>Object.assign(Object.assign({},n),{discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Xm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Xm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};Ii.EnumType=Ff;Ff.ClassName="EnumType";var Mf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Xm.guardTrue(rLf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Lf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ii.EnumVariantDefinition=Mf;var Uf=class t extends pT.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();Lf.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(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=Lf.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 X5.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};Ii.EnumValue=Uf;Uf.ClassName="EnumValue"});var yT=A(Lo=>{"use strict";l();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.EventTopicDefinition=Lo.EventDefinition=void 0;var Z5=Wu(),gT="?",Zm=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?gT:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>qf.fromJSON(n));return new t(e.identifier,r)}};Lo.EventDefinition=Zm;var qf=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new Z5.TypeExpressionParser().parse(e.type);return new t({name:e.name||gT,type:r,indexed:e.indexed})}};Lo.EventTopicDefinition=qf});var Mo=A(Fo=>{"use strict";l();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Struct=Fo.StructType=void 0;var eq=Le(),Vf=Bo(),mT=Ct(),Hf=class t extends mT.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Vf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Vf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Fo.StructType=Hf;Hf.ClassName="StructType";var kf=class t extends mT.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Vf.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 eq.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 Vf.Fields.equals(r,n)}};Fo.Struct=kf;kf.ClassName="Struct"});var tw=A((Coe,vT)=>{"use strict";l();var jf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ew={};for(Yu=0;Yu>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 wT(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Uo(e)^n>>5}for(e=Uo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=wT(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=Uo(n)^o,i+=jf.charAt(o)}for(s=0;s<6;++s)n=Uo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=jf.charAt(a)}return i}function ET(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=wT(s);if(typeof a=="string")return a;for(var u=[],c=0;c=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function rq(){var t=ET.apply(null,arguments);if(typeof t=="object")return t}function nq(t){var e=ET.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Qf(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";l();var uq=ln&&ln.__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]}),cq=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AT=ln&&ln.__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)&&uq(e,t,r);return cq(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.Address=void 0;var qo=AT(tw()),Vo=AT(Le()),zf="erd",Wf=32,lq="0".repeat(16),rw=class t{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 Vo.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!=Wf)throw new Vo.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==Wf}static fromHex(e){if(!t.isValidHex(e))throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=qo.decode(e)}catch(s){throw new Vo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=zf)throw new Vo.ErrAddressBadHrp(zf,n);let i=h.Buffer.from(qo.fromWords(r.words));if(i.length!=Wf)throw new Vo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}static isValid(e){let r=qo.decodeUnsafe(e),n=r?.prefix,i=r?h.Buffer.from(qo.fromWords(r.words)):void 0;return!(n!==zf||i?.length!==Wf)}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=qo.toWords(this.pubkey());return qo.encode(zf,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(lq)}};ln.Address=rw});var ko=A(Ho=>{"use strict";l();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.AddressValue=Ho.AddressType=void 0;var fq=pt(),bT=Ct(),Ju=class t extends bT.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Ho.AddressType=Ju;Ju.ClassName="AddressType";var $f=class t extends bT.PrimitiveValue{constructor(e){super(new Ju),this.value=new fq.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ho.AddressValue=$f;$f.ClassName="AddressValue"});var Yf=A(Go=>{"use strict";l();Object.defineProperty(Go,"__esModule",{value:!0});Go.OptionalValue=Go.OptionalType=void 0;var dq=br(),Xu=Ct(),Zu=class t extends Xu.Type{constructor(e){super("Optional",[e],Xu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Xu.NullType.ClassName);return r||n}};Go.OptionalType=Zu;Zu.ClassName="OptionalType";var Kf=class t extends Xu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Zu(new Xu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return dq.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}};Go.OptionalValue=Kf;Kf.ClassName="OptionalValue"});var tc=A(jo=>{"use strict";l();Object.defineProperty(jo,"__esModule",{value:!0});jo.BooleanValue=jo.BooleanType=void 0;var IT=Ct(),ec=class t extends IT.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};jo.BooleanType=ec;ec.ClassName="BooleanType";var Jf=class t extends IT.PrimitiveValue{constructor(e){super(new ec),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};jo.BooleanValue=Jf;Jf.ClassName="BooleanValue"});var _i=A(Qo=>{"use strict";l();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.BytesValue=Qo.BytesType=void 0;var _T=Ct(),rc=class t extends _T.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Qo.BytesType=rc;rc.ClassName="BytesType";var Xf=class t extends _T.PrimitiveValue{constructor(e){super(new rc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new t(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()}};Qo.BytesValue=Xf;Xf.ClassName="BytesValue"});var TT=A(zo=>{"use strict";l();Object.defineProperty(zo,"__esModule",{value:!0});zo.CodeMetadataValue=zo.CodeMetadataType=void 0;var ST=Ct(),Zf=class extends ST.PrimitiveType{constructor(){super("CodeMetadata")}};zo.CodeMetadataType=Zf;var nw=class extends ST.PrimitiveValue{constructor(e){super(new Zf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};zo.CodeMetadataValue=nw});var td=A(Wo=>{"use strict";l();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.CompositeValue=Wo.CompositeType=void 0;var hq=br(),iw=Ct(),nc=class t extends iw.Type{constructor(...e){super("Composite",e,iw.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Wo.CompositeType=nc;nc.ClassName="CompositeType";var ed=class t extends iw.TypedValue{constructor(e,r){super(e),hq.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new nc(...r);return new t(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";l();Object.defineProperty(rd,"__esModule",{value:!0});rd.CollectionOfTypedValues=void 0;var sw=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";l();Object.defineProperty(fn,"__esModule",{value:!0});fn.List=fn.OptionValue=fn.ListType=fn.OptionType=void 0;var pq=br(),gq=ow(),Rs=Ct(),Ps=class t extends Rs.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Rs.NullType.ClassName);return r||n}};fn.OptionType=Ps;Ps.ClassName="OptionType";var ic=class t extends Rs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};fn.ListType=ic;ic.ClassName="ListType";var nd=class t extends Rs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Ps(new Rs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Ps(e))}static newProvided(e){let r=new Ps(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return pq.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}};fn.OptionValue=nd;nd.ClassName="OptionValue";var id=class t extends Rs.TypedValue{constructor(e,r){super(e),this.backingCollection=new gq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Rs.TypePlaceholder,[]);let r=e[0].getType(),n=new ic(r);return new t(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)}};fn.List=id;id.ClassName="List"});var ad=A($o=>{"use strict";l();Object.defineProperty($o,"__esModule",{value:!0});$o.ArrayVec=$o.ArrayVecType=void 0;var CT=br(),yq=ow(),xT=Ct(),sd=class t extends xT.Type{constructor(e,r){super("Array",[r]),CT.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};$o.ArrayVecType=sd;sd.ClassName="ArrayVecType";var od=class t extends xT.TypedValue{constructor(e,r){super(e),CT.guardLength(r,e.length),this.backingCollection=new yq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};$o.ArrayVec=od;od.ClassName="ArrayVec"});var ac=A(Ko=>{"use strict";l();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.H256Value=Ko.H256Type=void 0;var NT=Ct(),oc=class t extends NT.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Ko.H256Type=oc;oc.ClassName="H256Type";var ud=class t extends NT.PrimitiveValue{constructor(e){super(new oc),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ko.H256Value=ud;ud.ClassName="H256Value"});var ld=A(Yo=>{"use strict";l();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.NothingValue=Yo.NothingType=void 0;var OT=Ct(),uc=class t extends OT.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Yo.NothingType=uc;uc.ClassName="NothingType";var cd=class t extends OT.PrimitiveValue{constructor(){super(new uc)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Yo.NothingValue=cd;cd.ClassName="NothingValue"});var Ec=A(Ce=>{"use strict";l();var mq=Ce&&Ce.__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]}),wq=Ce&&Ce.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eq=Ce&&Ce.__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)&&mq(e,t,r);return wq(e,t),e},vq=Ce&&Ce.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.BigIntValue=Ce.BigUIntValue=Ce.I64Value=Ce.U64Value=Ce.I32Value=Ce.U32Value=Ce.I16Value=Ce.U16Value=Ce.I8Value=Ce.U8Value=Ce.NumericalValue=Ce.BigIntType=Ce.BigUIntType=Ce.I64Type=Ce.U64Type=Ce.I32Type=Ce.U32Type=Ce.I16Type=Ce.U16Type=Ce.I8Type=Ce.U8Type=Ce.NumericalType=void 0;var DT=Eq(Le()),PT=Ct(),Bs=vq(Yt()),dr=class t extends PT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ce.NumericalType=dr;dr.ClassName="NumericalType";var cc=class t extends dr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ce.U8Type=cc;cc.ClassName="U8Type";var lc=class t extends dr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ce.I8Type=lc;lc.ClassName="I8Type";var fc=class t extends dr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ce.U16Type=fc;fc.ClassName="U16Type";var dc=class t extends dr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ce.I16Type=dc;dc.ClassName="I16Type";var hc=class t extends dr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ce.U32Type=hc;hc.ClassName="U32Type";var pc=class t extends dr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ce.I32Type=pc;pc.ClassName="I32Type";var gc=class t extends dr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ce.U64Type=gc;gc.ClassName="U64Type";var yc=class t extends dr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ce.I64Type=yc;yc.ClassName="I64Type";var mc=class t extends dr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ce.BigUIntType=mc;mc.ClassName="BigUIntType";var wc=class t extends dr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ce.BigIntType=wc;wc.ClassName="BigIntType";var hr=class t extends PT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Bs.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new DT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new DT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ce.NumericalValue=hr;hr.ClassName="NumericalValue";var fd=class t extends hr{constructor(e){super(new cc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U8Value=fd;fd.ClassName="U8Value";var dd=class t extends hr{constructor(e){super(new lc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I8Value=dd;dd.ClassName="I8Value";var hd=class t extends hr{constructor(e){super(new fc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U16Value=hd;hd.ClassName="U16Value";var pd=class t extends hr{constructor(e){super(new dc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I16Value=pd;pd.ClassName="I16Value";var gd=class t extends hr{constructor(e){super(new hc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.U32Value=gd;gd.ClassName="U32Value";var yd=class t extends hr{constructor(e){super(new pc,new Bs.default(e))}getClassName(){return t.ClassName}};Ce.I32Value=yd;yd.ClassName="I32Value";var md=class t extends hr{constructor(e){super(new gc,e)}getClassName(){return t.ClassName}};Ce.U64Value=md;md.ClassName="U64Value";var wd=class t extends hr{constructor(e){super(new yc,e)}getClassName(){return t.ClassName}};Ce.I64Value=wd;wd.ClassName="I64Value";var Ed=class t extends hr{constructor(e){super(new mc,e)}getClassName(){return t.ClassName}};Ce.BigUIntValue=Ed;Ed.ClassName="BigUIntValue";var vd=class t extends hr{constructor(e){super(new wc,e)}getClassName(){return t.ClassName}};Ce.BigIntValue=vd;vd.ClassName="BigIntValue"});var bd=A(Jo=>{"use strict";l();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.StringValue=Jo.StringType=void 0;var RT=Ct(),vc=class t extends RT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Jo.StringType=vc;vc.ClassName="StringType";var Ad=class t extends RT.PrimitiveValue{constructor(e){super(new vc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Jo.StringValue=Ad;Ad.ClassName="StringValue"});var Zo=A(Xo=>{"use strict";l();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.TokenIdentifierValue=Xo.TokenIdentifierType=void 0;var BT=Ct(),Aq="EGLD",Ac=class t extends BT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Xo.TokenIdentifierType=Ac;Ac.ClassName="TokenIdentifierType";var Id=class t extends BT.PrimitiveValue{constructor(e){super(new Ac),this.value=e}static egld(){return new t(Aq)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.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()}};Xo.TokenIdentifierValue=Id;Id.ClassName="TokenIdentifierValue"});var Sd=A(Cr=>{"use strict";l();var bq=Cr&&Cr.__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]}),Iq=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_q=Cr&&Cr.__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)&&bq(e,t,r);return Iq(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Tuple=Cr.TupleType=void 0;var Sq=_q(Le()),LT=Bo(),FT=Mo(),bc=class t extends FT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new LT.FieldDefinition(MT(i),"anonymous tuple field",n))}};Cr.TupleType=bc;bc.ClassName="TupleType";function MT(t){return`field${t}`}var _d=class t extends FT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new Sq.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new bc(...r),i=e.map((s,o)=>new LT.Field(s,MT(o)));return new t(n,i)}};Cr.Tuple=_d;_d.ClassName="Tuple"});var xd=A(Si=>{"use strict";l();Object.defineProperty(Si,"__esModule",{value:!0});Si.VariadicValue=Si.CountedVariadicType=Si.VariadicType=void 0;var ea=Ct(),Ls=class t extends ea.Type{constructor(e,r=!1){super("Variadic",[e],ea.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};Si.VariadicType=Ls;Ls.ClassName="VariadicType";var Td=class extends ea.Type{constructor(e){super("Variadic",[e],ea.TypeCardinality.variable())}getClassName(){return Ls.ClassName}};Si.CountedVariadicType=Td;Td.ClassName="VariadicType";var Cd=class t extends ea.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Ls(new ea.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Ls(n,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";l();var Tq=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]}),Cq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xq=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)&&Tq(e,t,r);return Cq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.TypeMapper=void 0;var UT=xq(Le()),Nq=ko(),aw=Yf(),Oq=tc(),Dq=_i(),Pq=TT(),Nd=td(),uw=Ku(),Rq=Bo(),qT=sc(),dn=ad(),Bq=ac(),VT=ld(),xr=Ec(),Lq=bd(),HT=Mo(),kT=Zo(),Ti=Sd(),Od=xd(),cw=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new qT.OptionType(r[0])],["List",(...r)=>new qT.ListType(r[0])],["VarArgs",(...r)=>new Od.VariadicType(r[0])],["MultiResultVec",(...r)=>new Od.VariadicType(r[0])],["variadic",(...r)=>new Od.VariadicType(r[0])],["counted-variadic",(...r)=>new Od.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new aw.OptionalType(r[0])],["optional",(...r)=>new aw.OptionalType(r[0])],["OptionalResult",(...r)=>new aw.OptionalType(r[0])],["multi",(...r)=>new Nd.CompositeType(...r)],["MultiArg",(...r)=>new Nd.CompositeType(...r)],["MultiResult",(...r)=>new Nd.CompositeType(...r)],["multi",(...r)=>new Nd.CompositeType(...r)],["tuple",(...r)=>new Ti.TupleType(...r)],["tuple2",(...r)=>new Ti.TupleType(...r)],["tuple3",(...r)=>new Ti.TupleType(...r)],["tuple4",(...r)=>new Ti.TupleType(...r)],["tuple5",(...r)=>new Ti.TupleType(...r)],["tuple6",(...r)=>new Ti.TupleType(...r)],["tuple7",(...r)=>new Ti.TupleType(...r)],["tuple8",(...r)=>new Ti.TupleType(...r)],["array2",(...r)=>new dn.ArrayVecType(2,r[0])],["array8",(...r)=>new dn.ArrayVecType(8,r[0])],["array16",(...r)=>new dn.ArrayVecType(16,r[0])],["array20",(...r)=>new dn.ArrayVecType(20,r[0])],["array32",(...r)=>new dn.ArrayVecType(32,r[0])],["array46",(...r)=>new dn.ArrayVecType(46,r[0])],["array48",(...r)=>new dn.ArrayVecType(48,r[0])],["array64",(...r)=>new dn.ArrayVecType(64,r[0])],["array128",(...r)=>new dn.ArrayVecType(128,r[0])],["array256",(...r)=>new dn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new xr.U8Type],["u16",new xr.U16Type],["u32",new xr.U32Type],["u64",new xr.U64Type],["U64",new xr.U64Type],["BigUint",new xr.BigUIntType],["i8",new xr.I8Type],["i16",new xr.I16Type],["i32",new xr.I32Type],["i64",new xr.I64Type],["Bigint",new xr.BigIntType],["BigInt",new xr.BigIntType],["bool",new Oq.BooleanType],["bytes",new Dq.BytesType],["Address",new Nq.AddressType],["H256",new Bq.H256Type],["utf-8 string",new Lq.StringType],["TokenIdentifier",new kT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new kT.TokenIdentifierType],["CodeMetadata",new Pq.CodeMetadataType],["nothing",new VT.NothingType],["AsyncCall",new VT.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 UT.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(uw.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(HT.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 HT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new uw.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new uw.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new Rq.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 UT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};hn.TypeMapper=cw});var WT=A(pn=>{"use strict";l();var Fq=pn&&pn.__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]}),Mq=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uq=pn&&pn.__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)&&Fq(e,t,r);return Mq(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.AbiRegistry=void 0;var GT=Uq(Le()),Ic=br(),_c=Wm(),jT=Ku(),fw=yT(),QT=Mo(),qq=lw(),Vq="?",dw=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||Vq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=e.events||[],a=_c.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),u=i.map(m=>_c.EndpointDefinition.fromJSON(m)),c=[];for(let m in s){let y=s[m];if(y.type=="struct")c.push(QT.StructType.fromJSON({name:m,fields:y.fields}));else if(y.type=="enum"||y.type=="explicit-enum")c.push(jT.EnumType.fromJSON({name:m,variants:y.variants}));else throw new GT.ErrTypingSystem(`Cannot handle custom type: ${m}`)}let f=o.map(m=>fw.EventDefinition.fromJSON(m));return new t({name:r,constructorDefinition:a,endpoints:u,customTypes:c,events:f}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Ic.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(QT.StructType.ClassName));return Ic.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(jT.EnumType.ClassName));return Ic.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 Ic.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Ic.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new qq.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new GT.ErrTypingSystem("Did not re-map all custom types");let n=zT(this.constructorDefinition,e),i=[];for(let a of this.endpoints)i.push(zT(a,e));let s=this.events.map(a=>Hq(a,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r,events:s})}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(c=>c.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};pn.AbiRegistry=dw;function zT(t,e){let r=t.input.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new _c.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new _c.EndpointDefinition(t.name,r,n,t.modifiers)}function Hq(t,e){let r=t.inputs.map(n=>new fw.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new fw.EventDefinition(t.identifier,r)}});var KT=A(ta=>{"use strict";l();Object.defineProperty(ta,"__esModule",{value:!0});ta.createListOfTokenIdentifiers=ta.createListOfAddresses=void 0;var kq=ko(),$T=sc(),Gq=Zo();function jq(t){let e=t.map(n=>new kq.AddressValue(n));return $T.List.fromItems(e)}ta.createListOfAddresses=jq;function Qq(t){let e=t.map(n=>new Gq.TokenIdentifierValue(n));return $T.List.fromItems(e)}ta.createListOfTokenIdentifiers=Qq});var cC=A(Jt=>{"use strict";l();var zq=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]}),Wq=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$q=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)&&zq(e,t,r);return Wq(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.onPrimitiveTypeSelect=Jt.onPrimitiveValueSelect=Jt.onTypedValueSelect=Jt.onTypeSelect=void 0;var Pd=$q(Le()),YT=ko(),JT=tc(),XT=_i(),ZT=Ku(),Dd=sc(),eC=ac(),tC=Ec(),rC=ld(),nC=Mo(),iC=Zo(),sC=Sd(),oC=Ct(),aC=ad(),uC=bd();function Kq(t,e){if(t.hasExactClass(Dd.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Dd.ListType.ClassName))return e.onList();if(t.hasExactClass(aC.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(oC.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(nC.StructType.ClassName))return e.onStruct();if(t.hasExactClass(sC.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(ZT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't known: ${t}`)}Jt.onTypeSelect=Kq;function Yq(t,e){if(t.hasClassOrSuperclass(oC.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Dd.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Dd.List.ClassName))return e.onList();if(t.hasExactClass(aC.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(nC.Struct.ClassName))return e.onStruct();if(t.hasExactClass(sC.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(ZT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't typed: ${t}`)}Jt.onTypedValueSelect=Yq;function Jq(t,e){if(t.hasExactClass(JT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(YT.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(XT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(uC.StringValue.ClassName))return e.onString();if(t.hasExactClass(eC.H256Value.ClassName))return e.onH256();if(t.hasExactClass(iC.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(rC.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Jt.onPrimitiveValueSelect=Jq;function Xq(t,e){if(t.hasExactClass(JT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(YT.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(XT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(uC.StringType.ClassName))return e.onString();if(t.hasExactClass(eC.H256Type.ClassName))return e.onH256();if(t.hasExactClass(iC.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(rC.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Pd.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Jt.onPrimitiveTypeSelect=Xq});var xt=A(He=>{"use strict";l();var Zq=He&&He.__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]}),at=He&&He.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Zq(e,t,r)};Object.defineProperty(He,"__esModule",{value:!0});at(WT(),He);at(ko(),He);at(Yf(),He);at(tc(),He);at(_i(),He);at(td(),He);at(Wm(),He);at(Ku(),He);at(KT(),He);at(Bo(),He);at(sc(),He);at(ad(),He);at(ac(),He);at(cC(),He);at(ld(),He);at(Ec(),He);at(bd(),He);at(Mo(),He);at(Zo(),He);at(Sd(),He);at(Wu(),He);at(lw(),He);at(Ct(),He);at(xd(),He)});var fC=A(gn=>{"use strict";l();var eV=gn&&gn.__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]}),tV=gn&&gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rV=gn&&gn.__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)&&eV(e,t,r);return tV(e,t),e};Object.defineProperty(gn,"__esModule",{value:!0});gn.OptionValueBinaryCodec=void 0;var lC=rV(Le()),Rd=xt(),hw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Rd.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new lC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Rd.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Rd.OptionValue(r);if(e[0]!=1)throw new lC.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Rd.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([])}};gn.OptionValueBinaryCodec=hw});var dC=A(Bd=>{"use strict";l();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.AddressBinaryCodec=void 0;var nV=pt(),iV=xt(),pw=class{decodeNested(e){let r=e.slice(0,32),n=new nV.Address(r);return[new iV.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()}};Bd.AddressBinaryCodec=pw});var pC=A(yn=>{"use strict";l();var sV=yn&&yn.__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]}),oV=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aV=yn&&yn.__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)&&sV(e,t,r);return oV(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.BooleanBinaryCodec=void 0;var uV=aV(Le()),hC=xt(),Sc=class t{decodeNested(e){let r=e.readUInt8(0);return[new hC.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new uV.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new hC.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([])}};yn.BooleanBinaryCodec=Sc;Sc.TRUE=1;Sc.FALSE=0});var Fd=A(Ld=>{"use strict";l();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.SizeOfU32=void 0;Ld.SizeOfU32=4});var Md=A(mn=>{"use strict";l();var cV=mn&&mn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mn,"__esModule",{value:!0});mn.zeroPadStringIfOddLength=mn.isPaddedHex=mn.numberToPaddedHex=void 0;var lV=cV(Yt());function fV(t){let e=new lV.default(t).toString(16);return gC(e)}mn.numberToPaddedHex=fV;function dV(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}mn.isPaddedHex=dV;function gC(t){return t=t||"",t.length%2==1?"0"+t:t}mn.zeroPadStringIfOddLength=gC});var Tc=A(Nt=>{"use strict";l();var hV=Nt&&Nt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.prependByteToBuffer=Nt.flipBufferBitsInPlace=Nt.getHexMagnitudeOfBigInt=Nt.bigIntToBuffer=Nt.bufferToBigInt=Nt.cloneBuffer=Nt.isMsbZero=Nt.isMsbOne=void 0;var gw=hV(Yt()),pV=Md();function yC(t,e=0){return t[e]>>7==1}Nt.isMsbOne=yC;function gV(t,e=0){return!yC(t,e)}Nt.isMsbZero=gV;function yV(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Nt.cloneBuffer=yV;function mV(t){let e=t.toString("hex");return new gw.default(`0x${e}`,16)}Nt.bufferToBigInt=mV;function wV(t){let e=mC(t);return h.Buffer.from(e,"hex")}Nt.bigIntToBuffer=wV;function mC(t){return t=new gw.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new gw.default(-1))),pV.numberToPaddedHex(t)):""}Nt.getHexMagnitudeOfBigInt=mC;function EV(t){for(let e=0;e{"use strict";l();var AV=ra&&ra.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ra,"__esModule",{value:!0});ra.NumericalBinaryCodec=void 0;var Cc=AV(Yt()),yw=xt(),wC=Fd(),At=Tc(),mw=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=wC.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=At.cloneBuffer(e);if(e.length==0)return new yw.NumericalValue(r,new Cc.default(0));if(!r.withSign||At.isMsbZero(n)){let c=At.bufferToBigInt(n);return new yw.NumericalValue(r,c)}At.flipBufferBitsInPlace(n);let u=At.bufferToBigInt(n).multipliedBy(new Cc.default(-1)).minus(new Cc.default(1));return new yw.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(wC.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=At.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=At.bigIntToBuffer(e.value);At.isMsbOne(o)&&(o=At.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new Cc.default(1)),i=At.bigIntToBuffer(n);At.flipBufferBitsInPlace(i),At.isMsbZero(i)&&(i=At.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):At.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=At.bigIntToBuffer(e.value);return At.isMsbOne(i)&&(i=At.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Cc.default(1)),n=At.bigIntToBuffer(r);return At.flipBufferBitsInPlace(n),At.isMsbZero(n)&&(n=At.prependByteToBuffer(n,255)),n}};ra.NumericalBinaryCodec=mw});var vC=A(Ud=>{"use strict";l();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.H256BinaryCodec=void 0;var bV=ac(),ww=class{decodeNested(e){let r=e.slice(0,32);return[new bV.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Ud.H256BinaryCodec=ww});var Hd=A(Vd=>{"use strict";l();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.BytesBinaryCodec=void 0;var AC=_i(),qd=Fd(),Ew=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(qd.SizeOfU32,qd.SizeOfU32+r);return[new AC.BytesValue(n),qd.SizeOfU32+r]}decodeTopLevel(e){return new AC.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(qd.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Vd.BytesBinaryCodec=Ew});var IC=A(kd=>{"use strict";l();Object.defineProperty(kd,"__esModule",{value:!0});kd.TokenIdentifierCodec=void 0;var IV=_i(),bC=Zo(),_V=Hd(),vw=class{constructor(){this.bytesCodec=new _V.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new bC.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new bC.TokenIdentifierValue(r.toString())}encodeNested(e){let r=IV.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};kd.TokenIdentifierCodec=vw});var SC=A(Gd=>{"use strict";l();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.NothingCodec=void 0;var _C=xt(),Aw=class{decodeNested(){return[new _C.NothingValue,0]}decodeTopLevel(){return new _C.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};Gd.NothingCodec=Aw});var CC=A(jd=>{"use strict";l();Object.defineProperty(jd,"__esModule",{value:!0});jd.StringBinaryCodec=void 0;var TC=xt(),SV=_i(),TV=Hd(),bw=class{constructor(){this.bytesBinaryCodec=new TV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new TC.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new TC.StringValue(e.toString())}encodeNested(e){let r=SV.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};jd.StringBinaryCodec=bw});var xC=A(zd=>{"use strict";l();Object.defineProperty(zd,"__esModule",{value:!0});zd.PrimitiveBinaryCodec=void 0;var Qd=xt(),CV=dC(),xV=pC(),NV=EC(),OV=vC(),DV=Hd(),PV=IC(),RV=SC(),BV=CC(),Iw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new xV.BooleanBinaryCodec,this.numericalCodec=new NV.NumericalBinaryCodec,this.addressCodec=new CV.AddressBinaryCodec,this.h256Codec=new OV.H256BinaryCodec,this.bytesCodec=new DV.BytesBinaryCodec,this.stringCodec=new BV.StringBinaryCodec,this.tokenIdentifierCodec=new PV.TokenIdentifierCodec,this.nothingCodec=new RV.NothingCodec}decodeNested(e,r){return Qd.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 Qd.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 Qd.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 Qd.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()})}};zd.PrimitiveBinaryCodec=Iw});var DC=A(Wd=>{"use strict";l();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.ListBinaryCodec=void 0;var NC=xt(),OC=Fd(),_w=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=OC.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 NC.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(OC.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)}};Wd.ListBinaryCodec=_w});var Tw=A($d=>{"use strict";l();Object.defineProperty($d,"__esModule",{value:!0});$d.FieldsBinaryCodec=void 0;var LV=xt(),Sw=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 LV.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)}};$d.FieldsBinaryCodec=Sw});var xw=A(Kd=>{"use strict";l();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.StructBinaryCodec=void 0;var FV=xt(),MV=Tw(),Cw=class{constructor(e){this.fieldsCodec=new MV.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 FV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Kd.StructBinaryCodec=Cw});var PC=A(Jd=>{"use strict";l();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.EnumBinaryCodec=void 0;var Yd=xt(),UV=Tw(),Nw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new UV.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 Yd.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Yd.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Yd.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 Yd.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};Jd.EnumBinaryCodec=Nw});var RC=A(Xd=>{"use strict";l();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TupleBinaryCodec=void 0;var qV=xw(),Ow=class{constructor(e){this.structCodec=new qV.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)}};Xd.TupleBinaryCodec=Ow});var BC=A(Zd=>{"use strict";l();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ArrayVecBinaryCodec=void 0;var VV=xt(),Dw=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";l();var HV=Nr&&Nr.__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]}),kV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GV=Nr&&Nr.__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)&&HV(e,t,r);return kV(e,t),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.BinaryCodecConstraints=Nr.BinaryCodec=void 0;var LC=GV(Le()),eh=xt(),FC=br(),jV=fC(),QV=xC(),zV=DC(),WV=xw(),$V=PC(),KV=RC(),YV=BC(),Pw=class{constructor(e=null){this.constraints=e||new th,this.optionCodec=new jV.OptionValueBinaryCodec(this),this.listCodec=new zV.ListBinaryCodec(this),this.arrayCodec=new YV.ArrayVecBinaryCodec(this),this.primitiveCodec=new QV.PrimitiveBinaryCodec(this),this.structCodec=new WV.StructBinaryCodec(this),this.tupleCodec=new KV.TupleBinaryCodec(this),this.enumCodec=new $V.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),eh.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]=eh.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 FC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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 FC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),eh.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)})}};Nr.BinaryCodec=Pw;var th=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new LC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new LC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Nr.BinaryCodecConstraints=th});var MC=A(Or=>{"use strict";l();var JV=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var XV=JV(Yt()),rh=xt(),ZV=Rw(),nh=new ZV.BinaryCodec;function eH(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=eH;function tH(t){return!!nh.decodeTopLevel(t,new rh.BooleanType).valueOf()}Or.decodeBool=tH;function rH(t){let e=nh.decodeTopLevel(t,new rh.BytesType);return String(e.valueOf())}Or.decodeString=rH;function nH(t){let e=nh.decodeTopLevel(t,new rh.BigUIntType);return new XV.default(e.valueOf())}Or.decodeBigNumber=nH});var Bw=A(Ci=>{"use strict";l();var iH=Ci&&Ci.__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]}),UC=Ci&&Ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iH(e,t,r)};Object.defineProperty(Ci,"__esModule",{value:!0});UC(Rw(),Ci);UC(MC(),Ci)});var na=A(ih=>{"use strict";l();Object.defineProperty(ih,"__esModule",{value:!0});ih.ArgSerializer=void 0;var qC=Os(),sH=Bw(),VC=xt(),Lw=Yf(),Fw=td(),Mw=xd(),oH={codec:new sH.BinaryCodec},Uw=class{constructor(e){e=Object.assign(Object.assign({},oH),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(qC.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 d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(qC.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 o of e)i(o);function i(o){if(o.hasExactClass(Lw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(Mw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(Fw.CompositeValue.ClassName)){let u=o;for(let c of u.getItems())i(c);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new VC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};ih.ArgSerializer=Uw});var ah=A(oh=>{"use strict";l();Object.defineProperty(oh,"__esModule",{value:!0});oh.Compatibility=void 0;var aH=pt(),sh=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()==aH.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.`))}};oh.Compatibility=sh;sh.areWarningsEnabled=!0});var HC=A(wn=>{"use strict";l();var uH=wn&&wn.__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]}),cH=wn&&wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lH=wn&&wn.__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)&&uH(e,t,r);return cH(e,t),e};Object.defineProperty(wn,"__esModule",{value:!0});wn.Hash=void 0;var fH=lH(Le()),qw=class t{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 fH.ErrBadType("hash","buffer | string",e)}static empty(){return new t(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};wn.Hash=qw});var xc=A(Dr=>{"use strict";l();var dH=Dr&&Dr.__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]}),hH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pH=Dr&&Dr.__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)&&dH(e,t,r);return hH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionOptions=Dr.TransactionVersion=void 0;var Wr=Os(),kC=pH(Le()),Vw=class t{constructor(e){if(e=Number(e),e<1)throw new kC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Wr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Wr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Dr.TransactionVersion=Vw;var Hw=class t{constructor(e){if(e=Number(e),e<0)throw new kC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Wr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Wr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_GUARDED)==Wr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Wr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dr.TransactionOptions=Hw});var jC=A((mue,GC)=>{"use strict";l();GC.exports=gH;function gH(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";l();var uh=WC;uh.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 ia=new Array(64),zC=new Array(123);for($r=0;$r<64;)zC[ia[$r]=$r<26?$r+65:$r<52?$r+71:$r<62?$r-4:$r-59|43]=$r++;var $r;uh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=ia[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=ia[u|c>>6],s[o++]=ia[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ia[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 QC="invalid encoding";uh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=zC[u])===void 0)throw Error(QC);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(QC);return n-i};uh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var YC=A((Aue,KC)=>{"use strict";l();KC.exports=ch;function ch(){this._listeners={}}ch.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};ch.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";l();rx.exports=JC(JC);function JC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(u,c,f){e[0]=u,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],e[0]}function a(u,c){return r[3]=u[c],r[2]=u[c+1],r[1]=u[c+2],r[0]=u[c+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),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,XC),t.writeFloatBE=e.bind(null,ZC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}t.readFloatLE=r.bind(null,ex),t.readFloatBE=r.bind(null,tx)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(u,c,f){e[0]=u,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],r[4]=u[c+4],r[5]=u[c+5],r[6]=u[c+6],r[7]=u[c+7],e[0]}function a(u,c){return r[7]=u[c],r[6]=u[c+1],r[5]=u[c+2],r[4]=u[c+3],r[3]=u[c+4],r[2]=u[c+5],r[1]=u[c+6],r[0]=u[c+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(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((c<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((c<<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((c<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,XC,0,4),t.writeDoubleBE=e.bind(null,ZC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),f=(c>>31)*2+1,d=c>>>20&2047,g=4294967296*(c&1048575)+u;return d===2047?g?NaN:f*(1/0):d===0?f*5e-324*g:f*Math.pow(2,d-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,ex,0,4),t.readDoubleBE=r.bind(null,tx,4,0)}(),t}function XC(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 ZC(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 ex(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function tx(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var ix=A((exports,module)=>{"use strict";l();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 ox=A(sx=>{"use strict";l();var kw=sx;kw.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))};kw.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 ux=A((xue,ax)=>{"use strict";l();ax.exports=yH;function yH(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 c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var lx=A((Oue,cx)=>{"use strict";l();cx.exports=qt;var Nc=Ni();function qt(t,e){this.lo=t>>>0,this.hi=e>>>0}var Fs=qt.zero=new qt(0,0);Fs.toNumber=function(){return 0};Fs.zzEncode=Fs.zzDecode=function(){return this};Fs.length=function(){return 1};var mH=qt.zeroHash="\0\0\0\0\0\0\0\0";qt.fromNumber=function(e){if(e===0)return Fs;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 qt(n,i)};qt.from=function(e){if(typeof e=="number")return qt.fromNumber(e);if(Nc.isString(e))if(Nc.Long)e=Nc.Long.fromString(e);else return qt.fromNumber(parseInt(e,10));return e.low||e.high?new qt(e.low>>>0,e.high>>>0):Fs};qt.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};qt.prototype.toLong=function(e){return Nc.Long?new Nc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var xi=String.prototype.charCodeAt;qt.fromHash=function(e){return e===mH?Fs:new qt((xi.call(e,0)|xi.call(e,1)<<8|xi.call(e,2)<<16|xi.call(e,3)<<24)>>>0,(xi.call(e,4)|xi.call(e,5)<<8|xi.call(e,6)<<16|xi.call(e,7)<<24)>>>0)};qt.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)};qt.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};qt.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};qt.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 Ni=A(Gw=>{"use strict";l();var Ie=Gw;Ie.asPromise=jC();Ie.base64=$C();Ie.EventEmitter=YC();Ie.float=nx();Ie.inquire=ix();Ie.utf8=ox();Ie.pool=ux();Ie.LongBits=lx();Ie.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ie.global=Ie.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Gw;Ie.emptyArray=Object.freeze?Object.freeze([]):[];Ie.emptyObject=Object.freeze?Object.freeze({}):{};Ie.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ie.isString=function(e){return typeof e=="string"||e instanceof String};Ie.isObject=function(e){return e&&typeof e=="object"};Ie.isset=Ie.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};Ie.Buffer=function(){try{var t=Ie.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ie._Buffer_from=null;Ie._Buffer_allocUnsafe=null;Ie.newBuffer=function(e){return typeof e=="number"?Ie.Buffer?Ie._Buffer_allocUnsafe(e):new Ie.Array(e):Ie.Buffer?Ie._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ie.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ie.Long=Ie.global.dcodeIO&&Ie.global.dcodeIO.Long||Ie.global.Long||Ie.inquire("long");Ie.key2Re=/^true|false|0|1$/;Ie.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ie.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ie.longToHash=function(e){return e?Ie.LongBits.from(e).toHash():Ie.LongBits.zeroHash};Ie.longFromHash=function(e,r){var n=Ie.LongBits.fromHash(e);return Ie.Long?Ie.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function fx(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]}};Ie.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";l();yx.exports=Ue;var Pr=Ni(),jw,lh=Pr.LongBits,hx=Pr.base64,px=Pr.utf8;function Oc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function zw(){}function wH(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ue(){this.len=0,this.head=new Oc(zw,0,0),this.tail=this.head,this.states=null}var gx=function(){return Pr.Buffer?function(){return(Ue.create=function(){return new jw})()}:function(){return new Ue}};Ue.create=gx();Ue.alloc=function(e){return new Pr.Array(e)};Pr.Array!==Array&&(Ue.alloc=Pr.pool(Ue.alloc,Pr.Array.prototype.subarray));Ue.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Oc(e,r,n),this.len+=r,this};function Ww(t,e,r){e[r]=t&255}function EH(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function $w(t,e){this.len=t,this.next=void 0,this.val=e}$w.prototype=Object.create(Oc.prototype);$w.prototype.fn=EH;Ue.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new $w((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ue.prototype.int32=function(e){return e<0?this._push(Kw,10,lh.fromNumber(e)):this.uint32(e)};Ue.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Kw(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}Ue.prototype.uint64=function(e){var r=lh.from(e);return this._push(Kw,r.length(),r)};Ue.prototype.int64=Ue.prototype.uint64;Ue.prototype.sint64=function(e){var r=lh.from(e).zzEncode();return this._push(Kw,r.length(),r)};Ue.prototype.bool=function(e){return this._push(Ww,1,e?1:0)};function Qw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ue.prototype.fixed32=function(e){return this._push(Qw,4,e>>>0)};Ue.prototype.sfixed32=Ue.prototype.fixed32;Ue.prototype.fixed64=function(e){var r=lh.from(e);return this._push(Qw,4,r.lo)._push(Qw,4,r.hi)};Ue.prototype.sfixed64=Ue.prototype.fixed64;Ue.prototype.float=function(e){return this._push(Pr.float.writeFloatLE,4,e)};Ue.prototype.double=function(e){return this._push(Pr.float.writeDoubleLE,8,e)};var vH=Pr.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(Ww,1,0);if(Pr.isString(e)){var n=Ue.alloc(r=hx.length(e));hx.decode(e,n,0),e=n}return this.uint32(r)._push(vH,r,e)};Ue.prototype.string=function(e){var r=px.length(e);return r?this.uint32(r)._push(px.write,r,e):this._push(Ww,1,0)};Ue.prototype.fork=function(){return this.states=new wH(this),this.head=this.tail=new Oc(zw,0,0),this.len=0,this};Ue.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 Oc(zw,0,0),this.len=0),this};Ue.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};Ue.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};Ue._configure=function(t){jw=t,Ue.create=gx(),jw._configure()}});var Ex=A((Fue,wx)=>{"use strict";l();wx.exports=En;var mx=Yw();(En.prototype=Object.create(mx.prototype)).constructor=En;var Oi=Ni();function En(){mx.call(this)}En._configure=function(){En.alloc=Oi._Buffer_allocUnsafe,En.writeBytesBuffer=Oi.Buffer&&Oi.Buffer.prototype instanceof Uint8Array&&Oi.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(En.writeBytesBuffer,r,e),this};function AH(t,e,r){t.length<40?Oi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}En.prototype.string=function(e){var r=Oi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(AH,r,e),this};En._configure()});var Zw=A((Uue,_x)=>{"use strict";l();_x.exports=bt;var vn=Ni(),Xw,bx=vn.LongBits,bH=vn.utf8;function Kr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function bt(t){this.buf=t,this.pos=0,this.len=t.length}var vx=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new bt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new bt(e);throw Error("illegal buffer")},Ix=function(){return vn.Buffer?function(r){return(bt.create=function(i){return vn.Buffer.isBuffer(i)?new Xw(i):vx(i)})(r)}:vx};bt.create=Ix();bt.prototype._slice=vn.Array.prototype.subarray||vn.Array.prototype.slice;bt.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,Kr(this,10);return e}}();bt.prototype.int32=function(){return this.uint32()|0};bt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Jw(){var t=new bx(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 Kr(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 Kr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}bt.prototype.bool=function(){return this.uint32()!==0};function fh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}bt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)};bt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Kr(this,4);return fh(this.buf,this.pos+=4)|0};function Ax(){if(this.pos+8>this.len)throw Kr(this,8);return new bx(fh(this.buf,this.pos+=4),fh(this.buf,this.pos+=4))}bt.prototype.float=function(){if(this.pos+4>this.len)throw Kr(this,4);var e=vn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};bt.prototype.double=function(){if(this.pos+8>this.len)throw Kr(this,4);var e=vn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};bt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Kr(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)};bt.prototype.string=function(){var e=this.bytes();return bH.read(e,0,e.length)};bt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Kr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Kr(this);while(this.buf[this.pos++]&128);return this};bt.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};bt._configure=function(t){Xw=t,bt.create=Ix(),Xw._configure();var e=vn.Long?"toLong":"toNumber";vn.merge(bt.prototype,{int64:function(){return Jw.call(this)[e](!1)},uint64:function(){return Jw.call(this)[e](!0)},sint64:function(){return Jw.call(this).zzDecode()[e](!1)},fixed64:function(){return Ax.call(this)[e](!0)},sfixed64:function(){return Ax.call(this)[e](!1)}})}});var xx=A((Vue,Cx)=>{"use strict";l();Cx.exports=Ms;var Tx=Zw();(Ms.prototype=Object.create(Tx.prototype)).constructor=Ms;var Sx=Ni();function Ms(t){Tx.call(this,t)}Ms._configure=function(){Sx.Buffer&&(Ms.prototype._slice=Sx.Buffer.prototype.slice)};Ms.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))};Ms._configure()});var Ox=A((kue,Nx)=>{"use strict";l();Nx.exports=Dc;var eE=Ni();(Dc.prototype=Object.create(eE.EventEmitter.prototype)).constructor=Dc;function Dc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");eE.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Dc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return eE.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,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Dc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Px=A(Dx=>{"use strict";l();var IH=Dx;IH.Service=Ox()});var Bx=A((zue,Rx)=>{"use strict";l();Rx.exports={}});var Mx=A(Fx=>{"use strict";l();var pr=Fx;pr.build="minimal";pr.Writer=Yw();pr.BufferWriter=Ex();pr.Reader=Zw();pr.BufferReader=xx();pr.util=Ni();pr.rpc=Px();pr.roots=Bx();pr.configure=Lx;function Lx(){pr.util._configure(),pr.Writer._configure(pr.BufferWriter),pr.Reader._configure(pr.BufferReader)}Lx()});var qx=A((Yue,Ux)=>{"use strict";l();Ux.exports=Mx()});var Hx=A((Xue,Vx)=>{"use strict";l();var sa=qx(),dh=sa.Reader,_H=sa.Writer,Z=sa.util,Pc=sa.roots.default||(sa.roots.default={});Pc.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 dh||(n=new dh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!Z.isInteger(n.Nonce)&&!(n.Nonce&&Z.isInteger(n.Nonce.low)&&Z.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||Z.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||Z.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||Z.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||Z.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||Z.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!Z.isInteger(n.GasPrice)&&!(n.GasPrice&&Z.isInteger(n.GasPrice.low)&&Z.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!Z.isInteger(n.GasLimit)&&!(n.GasLimit&&Z.isInteger(n.GasLimit.low)&&Z.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||Z.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||Z.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!Z.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||Z.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!Z.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||Z.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||Z.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Pc.proto.Transaction)return n;var i=new Pc.proto.Transaction;return n.Nonce!=null&&(Z.Long?(i.Nonce=Z.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 Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?Z.base64.decode(n.Value,i.Value=Z.newBuffer(Z.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?Z.base64.decode(n.RcvAddr,i.RcvAddr=Z.newBuffer(Z.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?Z.base64.decode(n.RcvUserName,i.RcvUserName=Z.newBuffer(Z.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?Z.base64.decode(n.SndAddr,i.SndAddr=Z.newBuffer(Z.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?Z.base64.decode(n.SndUserName,i.SndUserName=Z.newBuffer(Z.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(Z.Long?(i.GasPrice=Z.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 Z.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(Z.Long?(i.GasLimit=Z.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 Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?Z.base64.decode(n.Data,i.Data=Z.newBuffer(Z.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?Z.base64.decode(n.ChainID,i.ChainID=Z.newBuffer(Z.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"?Z.base64.decode(n.Signature,i.Signature=Z.newBuffer(Z.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"?Z.base64.decode(n.GuardAddr,i.GuardAddr=Z.newBuffer(Z.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?Z.base64.decode(n.GuardSignature,i.GuardSignature=Z.newBuffer(Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=Z.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=Z.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=Z.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=Z.newBuffer(s.SndUserName))),Z.Long){var o=new Z.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(Z.Long){var o=new Z.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=Z.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=Z.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=Z.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=Z.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=Z.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?Z.Long.prototype.toString.call(n.Nonce):i.longs===Number?new Z.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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?Z.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new Z.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?Z.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new Z.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?Z.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?Z.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?Z.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?Z.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?Z.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,sa.util.toJSONOptions)},e}(),t}();Vx.exports=Pc});var kx=A(Rr=>{"use strict";l();var SH=Rr&&Rr.__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]}),TH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CH=Rr&&Rr.__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)&&SH(e,t,r);return TH(e,t),e},xH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var NH=xH(Yt()),tE=pt(),OH=Os(),DH=CH(Le()),PH=Tc(),rE=class{serializeTransaction(e){let r=Hx().proto,n=new tE.Address(e.getReceiver().bech32()).pubkey(),i=new tE.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:e.getReceiverUsername()?h.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?h.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,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()!==OH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new tE.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 NH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=PH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new DH.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=rE});var Gx=A(Us=>{"use strict";l();var RH=Us&&Us.__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]}),BH=Us&&Us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RH(e,t,r)};Object.defineProperty(Us,"__esModule",{value:!0});BH(kx(),Us)});var Rc=A(Br=>{"use strict";l();var LH=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]}),FH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MH=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)&&LH(e,t,r);return FH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.interpretSignatureAsBuffer=Br.Signature=void 0;var jx=MH(Le()),Qx=64,nE=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof h.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new jx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Qx}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Qx)throw new jx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Br.Signature=nE;function UH(t){if(ArrayBuffer.isView(t))return h.Buffer.from(t);if(t.hex!=null)return h.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Br.interpretSignatureAsBuffer=UH});var Yn=A(hh=>{"use strict";l();Object.defineProperty(hh,"__esModule",{value:!0});hh.TransactionPayload=void 0;var iE=class t{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=h.Buffer.from(e,"base64").toString();return new t(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}};hh.TransactionPayload=iE});var sE=A((uce,zx)=>{l();Jn.notEqual=VH;Jn.notOk=HH;Jn.equal=qH;Jn.ok=Jn;zx.exports=Jn;function qH(t,e,r){Jn(t==e,r)}function VH(t,e,r){Jn(t!=e,r)}function HH(t,e){Jn(!t,e)}function Jn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Vs=A(ca=>{"use strict";l();var oE=$0(),aa=Y0(),Wx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ca.Buffer=W;ca.SlowBuffer=WH;ca.INSPECT_MAX_BYTES=50;var ph=2147483647;ca.kMaxLength=ph;W.TYPED_ARRAY_SUPPORT=kH();!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 kH(){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(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 Xn(t){if(t>ph)throw new RangeError('The value "'+t+'" is invalid for option "size"');let 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 lE(t)}return Jx(t,e,r)}W.poolSize=8192;function Jx(t,e,r){if(typeof t=="string")return jH(t,e);if(ArrayBuffer.isView(t))return QH(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(An(t,ArrayBuffer)||t&&An(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(An(t,SharedArrayBuffer)||t&&An(t.buffer,SharedArrayBuffer)))return uE(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 W.from(n,e,r);let i=zH(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 Jx(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function Xx(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 GH(t,e,r){return Xx(t),t<=0?Xn(t):e!==void 0?typeof r=="string"?Xn(t).fill(e,r):Xn(t).fill(e):Xn(t)}W.alloc=function(t,e,r){return GH(t,e,r)};function lE(t){return Xx(t),Xn(t<0?0:fE(t)|0)}W.allocUnsafe=function(t){return lE(t)};W.allocUnsafeSlow=function(t){return lE(t)};function jH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Zx(t,e)|0,n=Xn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function aE(t){let e=t.length<0?0:fE(t.length)|0,r=Xn(e);for(let n=0;n=ph)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ph.toString(16)+" bytes");return t|0}function WH(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(An(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),An(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;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(W.isBuffer(o)||(o=W.from(o)),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 Zx(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||An(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 cE(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return uN(t).length;default:if(i)return n?-1:cE(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=Zx;function $H(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 ik(this,e,r);case"utf8":case"utf-8":return tN(this,e,r);case"ascii":return rk(this,e,r);case"latin1":case"binary":return nk(this,e,r);case"base64":return ek(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sk(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function qs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}W.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+=" ... "),""};Wx&&(W.prototype[Wx]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(An(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;let o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,hE(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:$x(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):$x(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function $x(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 c;if(i){let f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){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 KH(this,e,r,n);case"utf8":case"utf-8":return YH(this,e,r,n);case"ascii":case"latin1":case"binary":return JH(this,e,r,n);case"base64":return XH(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZH(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 ek(t,e,r){return e===0&&r===t.length?oE.fromByteArray(t):oE.fromByteArray(t.slice(e,r))}function tN(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,c,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],c=t[i+2],(u&192)===128&&(c&192)===128&&(d=(s&15)<<12|(u&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(c&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 tk(n)}var Kx=4096;function tk(t){let e=t.length;if(e<=Kx)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")}W.prototype.readUintLE=W.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Vt(e,r,this.length);let i=this[e+--r],s=1;for(;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||Vt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readBigUInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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||Vt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Vt(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};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Vt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Vt(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||Vt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readBigInt64LE=Di(function(e){e=e>>>0,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(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,ua(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Bc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Vt(e,4,this.length),aa.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),aa.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),aa.read(this,e,!1,52,8)};function gr(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){let a=Math.pow(2,8*n)-1;gr(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;gr(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};W.prototype.writeUint8=W.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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 rN(t,e,r,n,i){aN(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 nN(t,e,r,n,i){aN(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}W.prototype.writeBigUInt64LE=Di(function(e,r=0){return rN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeBigUInt64BE=Di(function(e,r=0){return nN(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);gr(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};W.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||gr(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||gr(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||gr(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||gr(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||gr(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};W.prototype.writeBigInt64LE=Di(function(e,r=0){return rN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W.prototype.writeBigInt64BE=Di(function(e,r=0){return nN(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function iN(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 sN(t,e,r,n,i){return e=+e,r=r>>>0,i||iN(t,e,r,4,34028234663852886e22,-34028234663852886e22),aa.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return sN(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return sN(this,e,r,!1,n)};function oN(t,e,r,n,i){return e=+e,r=r>>>0,i||iN(t,e,r,8,17976931348623157e292,-17976931348623157e292),aa.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return oN(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return oN(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);let s;if(typeof e=="number")for(s=r;s2**32?i=Yx(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Yx(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Yx(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 ok(t,e,r){ua(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Bc(e,t.length-(r+1))}function aN(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 oa.ERR_OUT_OF_RANGE("value",a,t)}ok(n,i,s)}function ua(t,e){if(typeof t!="number")throw new oa.ERR_INVALID_ARG_TYPE(e,"number",t)}function Bc(t,e,r){throw Math.floor(t)!==t?(ua(t,r),new oa.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new oa.ERR_BUFFER_OUT_OF_BOUNDS:new oa.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ak=/[^+/0-9A-Za-z-_]/g;function uk(t){if(t=t.split("=")[0],t=t.trim().replace(ak,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function cE(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 ck(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function uN(t){return oE.toByteArray(uk(t))}function gh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function An(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function hE(t){return t!==t}var fk=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 Di(t){return typeof BigInt>"u"?dk:t}function dk(){throw new Error("BigInt not supported")}});var lN=A((hce,cN)=>{l();cN.exports=pE;pE.supported=typeof WebAssembly<"u";function pE(t){if(!pE.supported)return null;var e=t&&t.imports,r=hk("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 hk(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(pk)):new(Vs()).Buffer(t,"base64")}function pk(t){return t.charCodeAt(0)}});var mN=A((mce,In)=>{l();var bn=sE(),Ze=lN()(),Zn=64,yh=[];In.exports=Lr;var fN=In.exports.BYTES_MIN=16,dN=In.exports.BYTES_MAX=64,gce=In.exports.BYTES=32,hN=In.exports.KEYBYTES_MIN=16,pN=In.exports.KEYBYTES_MAX=64,yce=In.exports.KEYBYTES=32,gN=In.exports.SALTBYTES=16,yN=In.exports.PERSONALBYTES=16;function Lr(t,e,r,n,i){if(!(this instanceof Lr))return new Lr(t,e,r,n,i);if(!(Ze&&Ze.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(bn(t>=fN,"digestLength must be at least "+fN+", was given "+t),bn(t<=dN,"digestLength must be at most "+dN+", was given "+t),e!=null&&bn(e.length>=hN,"key must be at least "+hN+", was given "+e.length),e!=null&&bn(e.length<=pN,"key must be at least "+pN+", was given "+e.length),r!=null&&bn(r.length===gN,"salt must be exactly "+gN+", was given "+r.length),n!=null&&bn(n.length===yN,"personal must be exactly "+yN+", was given "+n.length)),yh.length||(yh.push(Zn),Zn+=216),this.digestLength=t,this.finalized=!1,this.pointer=yh.pop(),Ze.memory.fill(0,0,64),Ze.memory[0]=this.digestLength,Ze.memory[1]=e?e.length:0,Ze.memory[2]=1,Ze.memory[3]=1,r&&Ze.memory.set(r,32),n&&Ze.memory.set(n,48),this.pointer+216>Ze.memory.length&&Ze.realloc(this.pointer+216),Ze.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ze.memory.fill(0,Zn,Zn+e.length),Ze.memory[this.pointer+200]=128)}Lr.prototype.update=function(t){return bn(this.finalized===!1,"Hash instance finalized"),bn(t,"input must be TypedArray or Buffer"),Zn+t.length>Ze.memory.length&&Ze.realloc(Zn+t.length),Ze.memory.set(t,Zn),Ze.exports.blake2b_update(this.pointer,Zn,Zn+t.length),this};Lr.prototype.digest=function(t){if(bn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,yh.push(this.pointer),Ze.exports.blake2b_final(this.pointer),!t||t==="binary")return Ze.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return yk(Ze.memory,this.pointer+128,this.digestLength);bn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Bi=sE(),Fc=mN();function mh(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 wN(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 SN(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Pi(t,e,r,n,i,s){var o=Lc[i],a=Lc[i+1],u=Lc[s],c=Lc[s+1];mh(xe,t,e),wN(xe,t,o,a);var f=xe[n]^xe[t],d=xe[n+1]^xe[t+1];xe[n]=d,xe[n+1]=f,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=f>>>24^d<<8,xe[e+1]=d>>>24^f<<8,mh(xe,t,e),wN(xe,t,u,c),f=xe[n]^xe[t],d=xe[n+1]^xe[t+1],xe[n]=f>>>16^d<<16,xe[n+1]=d>>>16^f<<16,mh(xe,r,n),f=xe[e]^xe[r],d=xe[e+1]^xe[r+1],xe[e]=d>>>31^f<<1,xe[e+1]=f>>>31^d<<1}var TN=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),wk=[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],Xt=new Uint8Array(wk.map(function(t){return t*2})),xe=new Uint32Array(32),Lc=new Uint32Array(32);function CN(t,e){var r=0;for(r=0;r<16;r++)xe[r]=t.h[r],xe[r+16]=TN[r];for(xe[24]=xe[24]^t.t,xe[25]=xe[25]^t.t/4294967296,e&&(xe[28]=~xe[28],xe[29]=~xe[29]),r=0;r<32;r++)Lc[r]=SN(t.b,4*r);for(r=0;r<12;r++)Pi(0,8,16,24,Xt[r*16+0],Xt[r*16+1]),Pi(2,10,18,26,Xt[r*16+2],Xt[r*16+3]),Pi(4,12,20,28,Xt[r*16+4],Xt[r*16+5]),Pi(6,14,22,30,Xt[r*16+6],Xt[r*16+7]),Pi(0,10,20,30,Xt[r*16+8],Xt[r*16+9]),Pi(2,12,22,24,Xt[r*16+10],Xt[r*16+11]),Pi(4,14,16,26,Xt[r*16+12],Xt[r*16+13]),Pi(6,8,18,28,Xt[r*16+14],Xt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^xe[r]^xe[r+16]}var Ri=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 la(t,e,r,n){Ri.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ri[0]=t,e&&(Ri[1]=e.length),Ri[2]=1,Ri[3]=1,r&&Ri.set(r,32),n&&Ri.set(n,48);for(var i=0;i<16;i++)this.h[i]=TN[i]^SN(Ri,i*4);e&&(xN(this,e),this.c=128)}la.prototype.update=function(t){return Bi(t!=null,"input must be Uint8Array or Buffer"),xN(this,t),this};la.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Bi(e.length>=this.outlen,"out must have at least outlen bytes of space"),Ek(this,e),t==="hex"?vk(e):e};la.prototype.final=la.prototype.digest;la.ready=function(t){Fc.ready(function(){t()})};function xN(t,e){for(var r=0;r>2]>>8*(r&3);return e}function vk(t){for(var e="",r=0;r=EN,"outlen must be at least "+EN+", was given "+e),Bi(e<=vN,"outlen must be at most "+vN+", was given "+e),r!=null&&Bi(r.length>=AN,"key must be at least "+AN+", was given "+r.length),r!=null&&Bi(r.length<=bN,"key must be at most "+bN+", was given "+r.length),n!=null&&Bi(n.length===IN,"salt must be exactly "+IN+", was given "+n.length),i!=null&&Bi(i.length===_N,"personal must be exactly "+_N+", was given "+i.length)),new NN(e,r,n,i)};yr.exports.ready=function(t){Fc.ready(function(){t()})};yr.exports.WASM_SUPPORTED=Fc.SUPPORTED;yr.exports.WASM_LOADED=!1;var EN=yr.exports.BYTES_MIN=16,vN=yr.exports.BYTES_MAX=64,Ece=yr.exports.BYTES=32,AN=yr.exports.KEYBYTES_MIN=16,bN=yr.exports.KEYBYTES_MAX=64,vce=yr.exports.KEYBYTES=32,IN=yr.exports.SALTBYTES=16,_N=yr.exports.PERSONALBYTES=16;Fc.ready(function(t){t||(yr.exports.WASM_LOADED=!0,NN=Fc)})});var Yr=A(Fr=>{"use strict";l();var bk=Fr&&Fr.__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]}),Ik=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_k=Fr&&Fr.__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)&&bk(e,t,r);return Ik(e,t),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var fa=Yt(),Mc=pt(),Sk=ah(),Tk=Os(),Ck=_k(Le()),xk=HC(),ei=xc(),Nk=Gx(),wh=Rc(),ON=Yn(),Ok=br(),Dk=gE(),Pk=32,yE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:c,chainID:f,version:d,options:g,guardian:m}){this.nonce=e||0,this.value=r?new fa.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||Tk.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=c||new ON.TransactionPayload,this.chainID=f,this.version=d?new ei.TransactionVersion(d.valueOf()):ei.TransactionVersion.withDefaultVersion(),this.options=g?new ei.TransactionOptions(g.valueOf()):ei.TransactionOptions.withDefaultOptions(),this.guardian=m||Mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=da.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}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}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 ei.TransactionVersion(e.valueOf())}getOptions(){return new ei.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new ei.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return Ok.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(),senderUsername:this.senderUsername?h.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?h.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().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 Sk.Compatibility.guardAddressIsSetAndNonZero(new Mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new fa.BigNumber(e.value).toFixed(0),receiver:Mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:Mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?Mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new ON.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new ei.TransactionVersion(e.version),options:e.options!=null?new ei.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new wh.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new wh.Signature(e.guardianSignature)),r}applySignature(e){this.signature=wh.interpretSignatureAsBuffer(e),this.hash=da.compute(this)}applyGuardianSignature(e){this.guardianSignature=wh.interpretSignatureAsBuffer(e),this.hash=da.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 Ck.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new fa.BigNumber(this.gasPrice.valueOf()),i=new fa.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new fa.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new fa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Fr.Transaction=yE;var da=class t extends xk.Hash{constructor(e){super(e)}static compute(e){let n=new Nk.ProtoSerializer().serializeTransaction(e),i=Dk(Pk).update(n).digest("hex");return new t(i)}};Fr.TransactionHash=da});var vE=A(vh=>{"use strict";l();Object.defineProperty(vh,"__esModule",{value:!0});vh.TransferTransactionsFactory=void 0;var mE=na(),Jr=xt(),Eh=Yr(),wE=Yn(),EE=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 Eh.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 mE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new wE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Eh.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 mE.ArgSerializer().valuesToString([Jr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Jr.U64Value(e.tokenTransfer.nonce),new Jr.BigUIntValue(e.tokenTransfer.valueOf()),new Jr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new wE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Eh.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 Jr.AddressValue(e.destination),new Jr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Jr.BytesValue.fromUTF8(u.tokenIdentifier),new Jr.U64Value(u.nonce),new Jr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new mE.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new wE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Eh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};vh.TransferTransactionsFactory=EE});var bE=A(Hs=>{"use strict";l();Object.defineProperty(Hs,"__esModule",{value:!0});Hs.GasEstimator=Hs.DefaultGasConfiguration=void 0;Hs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Rk=1e5,DN=8e5,AE=class{constructor(e){this.gasConfiguration=e||Hs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Rk}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+DN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+DN)*r+this.gasConfiguration.gasPerDataByte*e}};Hs.GasEstimator=AE});var ha=A(Ah=>{"use strict";l();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.Account=void 0;var Bk=pt(),IE=class{constructor(e){this.address=new Bk.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()}}};Ah.Account=IE});var pa=A(Gs=>{"use strict";l();Object.defineProperty(Gs,"__esModule",{value:!0});Gs.Logger=Gs.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=Gs.LogLevel||(Gs.LogLevel={}));var bh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=ks.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=ks.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=ks.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=ks.Error||console.error(e,r)}};Gs.Logger=bh;bh.logLevel=ks.Debug});var TE=A(_n=>{"use strict";l();var Lk=_n&&_n.__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]}),Fk=_n&&_n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mk=_n&&_n.__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)&&Lk(e,t,r);return Fk(e,t),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.AsyncTimer=void 0;var Uk=Mk(Le()),qk=Le(),_E=pa(),SE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new Uk.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,_E.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(){_E.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new qk.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(_E.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_n.AsyncTimer=SE});var Ih=A(ga=>{"use strict";l();var Mr=ga&&ga.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(ga,"__esModule",{value:!0});ga.TransactionWatcher=void 0;var CE=TE(),Li=Le(),PN=pa(),Fi=class t{constructor(e,r={}){this.fetcher=new xE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Mr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Mr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new Li.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>a.includes(c))},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>a.includes(c))!=null},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Li.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Mr(this,void 0,void 0,function*(){let n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Li.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Mr(this,void 0,void 0,function*(){let i=new CE.AsyncTimer("watcher:periodic"),s=new CE.AsyncTimer("watcher:patience"),o=new CE.AsyncTimer("watcher:timeout"),a=!1,u,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),c=e(u),c||a)break}catch(f){if(PN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Li.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Li.Err))throw f}}if(c&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!c)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}};ga.TransactionWatcher=Fi;Fi.DefaultPollingInterval=6e3;Fi.DefaultTimeout=Fi.DefaultPollingInterval*15;Fi.DefaultPatience=0;Fi.NoopOnStatusReceived=t=>{};var xE=class{constructor(e){this.fetcher=e}getTransaction(e){return Mr(this,void 0,void 0,function*(){return PN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var NE=A(_h=>{"use strict";l();Object.defineProperty(_h,"__esModule",{value:!0});_h.CodeMetadata=void 0;var Uc=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBuffer(e){if(e.length<2)throw new Error("Buffer is too short.");let r=e[0],n=e[1],i=(r&t.ByteZero.Upgradeable)!==0,s=(r&t.ByteZero.Readable)!==0,o=(n&t.ByteOne.Payable)!==0,a=(n&t.ByteOne.PayableBySc)!==0;return new t(i,s,o,a)}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|=t.ByteZero.Upgradeable),this.readable&&(e|=t.ByteZero.Readable),this.payable&&(r|=t.ByteOne.Payable),this.payableBySc&&(r|=t.ByteOne.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}};_h.CodeMetadata=Uc;Uc.ByteZero={Upgradeable:1,Reserved2:2,Readable:4};Uc.ByteOne={Reserved1:1,Payable:2,PayableBySc:4}});var qc=A(Sn=>{"use strict";l();var Vk=Sn&&Sn.__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]}),Hk=Sn&&Sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kk=Sn&&Sn.__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)&&Vk(e,t,r);return Hk(e,t),e};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ContractFunction=void 0;var Gk=kk(Le()),OE=class t{constructor(e){if(this.name=e,e==null)throw new Gk.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Sn.ContractFunction=OE});var RE=A(Ur=>{"use strict";l();var jk=Ur&&Ur.__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]}),Qk=Ur&&Ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zk=Ur&&Ur.__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)&&jk(e,t,r);return Qk(e,t),e},Wk=Ur&&Ur.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.InteractionChecker=void 0;var DE=zk(Le()),$k=Wk(Yt()),PE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new $k.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new DE.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 DE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";l();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Query=void 0;var Kk=pt(),Yk=na(),BE=class{constructor(e){this.caller=e.caller||new Kk.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new Yk.ArgSerializer().valuesToStrings(this.args)}};Sh.Query=BE});var UE=A(Th=>{"use strict";l();Object.defineProperty(Th,"__esModule",{value:!0});Th.Interaction=void 0;var RN=pt(),Jk=ah(),LE=Os(),FE=qc(),Xk=RE(),Zk=Vc(),ya=xt(),ME=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new RN.Address,this.sender=new RN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ma([],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(){Jk.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 FE.ContractFunction(LE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new FE.ContractFunction(LE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new FE.ContractFunction(LE.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 Zk.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 ma([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ma([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ma(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 Xk.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Th.Interaction=ME;var ma=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 ya.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ya.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ya.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ya.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ya.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ya.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var BN=A(Ch=>{"use strict";l();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArgumentErrorContext=void 0;var eG=Le(),qE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new eG.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)})`)}};Ch.ArgumentErrorContext=qE});var HE=A(js=>{"use strict";l();var tG=js&&js.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(js,"__esModule",{value:!0});js.NativeSerializer=void 0;var rG=tG(Yt()),nG=pt(),VE=Le(),iG=Md(),sG=BN(),_e=xt(),oG;(function(t){function e(E,S){E=E||[],r(E,S),n(S)&&(E=i(E,S));let N=S.input,_=[];for(let T=0;T0&&S[0].type.getCardinality().isComposite()&&(_=1/0,T=!0);for(let B of S){if(B.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:T}}function o(E,S,N){if(E&&E.belongsToTypesystem)return E;if(S instanceof _e.OptionType)return a(E,S,N);if(S instanceof _e.OptionalType)return u(E,S,N);if(S instanceof _e.VariadicType)return c(E,S,N);if(S instanceof _e.CompositeType)return d(E,S,N);if(S instanceof _e.TupleType)return g(E,S,N);if(S instanceof _e.StructType)return m(E,S,N);if(S instanceof _e.ListType)return f(E,S,N);if(S instanceof _e.PrimitiveType)return y(E,S,N);if(S instanceof _e.EnumType)return b(E,S,N);N.throwError(`convertToTypedValue: unhandled type ${S}`)}function a(E,S,N){if(E==null)return _e.OptionValue.newMissing();let _=o(E,S.getFirstTypeParameter(),N);return _e.OptionValue.newProvided(_)}function u(E,S,N){if(E==null)return new _e.OptionalValue(S);let _=o(E,S.getFirstTypeParameter(),N);return new _e.OptionalValue(S,_)}function c(E,S,N){if(S.isCounted)throw new VE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');E==null&&(E=[]),E.map===void 0&&N.convertError(E,"Variadic");let _=E.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new _e.VariadicValue(S,_)}function f(E,S,N){E.map===void 0&&N.convertError(E,"List");let _=E.map(function(T){return o(T,S.getFirstTypeParameter(),N)});return new _e.List(S,_)}function d(E,S,N){let _=[],T=S.getTypeParameters();N.guardSameLength(E,T);for(let B=0;B{"use strict";l();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.ContractCallPayloadBuilder=Xr.ContractUpgradePayloadBuilder=Xr.ContractDeployPayloadBuilder=Xr.ArwenVirtualMachine=void 0;var QE=Yn(),zE=br(),aG=na();Xr.ArwenVirtualMachine="0500";var kE=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(){zE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Xr.ArwenVirtualMachine}@${r}`;return n=WE(n,this.arguments),new QE.TransactionPayload(n)}};Xr.ContractDeployPayloadBuilder=kE;var GE=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(){zE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=WE(n,this.arguments),new QE.TransactionPayload(n)}};Xr.ContractUpgradePayloadBuilder=GE;var jE=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(){zE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=WE(e,this.arguments),new QE.TransactionPayload(e)}};Xr.ContractCallPayloadBuilder=jE;function WE(t,e){let{argumentsString:r,count:n}=new aG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var ti=A((Zce,KE)=>{"use strict";l();var wa=typeof Reflect=="object"?Reflect:null,LN=wa&&typeof wa.apply=="function"?wa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},xh;wa&&typeof wa.ownKeys=="function"?xh=wa.ownKeys:Object.getOwnPropertySymbols?xh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xh=function(e){return Object.getOwnPropertyNames(e)};function uG(t){console&&console.warn&&console.warn(t)}var MN=Number.isNaN||function(e){return e!==e};function We(){We.init.call(this)}KE.exports=We;KE.exports.once=dG;We.EventEmitter=We;We.prototype._events=void 0;We.prototype._eventsCount=0;We.prototype._maxListeners=void 0;var FN=10;function Nh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(We,"defaultMaxListeners",{enumerable:!0,get:function(){return FN},set:function(t){if(typeof t!="number"||t<0||MN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");FN=t}});We.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};We.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||MN(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 UN(t){return t._maxListeners===void 0?We.defaultMaxListeners:t._maxListeners}We.prototype.getMaxListeners=function(){return UN(this)};We.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")LN(u,this,r);else for(var c=u.length,f=GN(u,c),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,uG(a)}return t}We.prototype.addListener=function(e,r){return qN(this,e,r,!1)};We.prototype.on=We.prototype.addListener;We.prototype.prependListener=function(e,r){return qN(this,e,r,!0)};function cG(){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 VN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=cG.bind(n);return i.listener=r,n.wrapFn=i,i}We.prototype.once=function(e,r){return Nh(r),this.on(e,VN(this,e,r)),this};We.prototype.prependOnceListener=function(e,r){return Nh(r),this.prependListener(e,VN(this,e,r)),this};We.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Nh(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():lG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};We.prototype.off=We.prototype.removeListener;We.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 HN(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?fG(i):GN(i,i.length)}We.prototype.listeners=function(e){return HN(this,e,!0)};We.prototype.rawListeners=function(e){return HN(this,e,!1)};We.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):kN.call(t,e)};We.prototype.listenerCount=kN;function kN(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}We.prototype.eventNames=function(){return this._eventsCount>0?xh(this._events):[]};function GN(t,e){for(var r=new Array(e),n=0;n{l();QN.exports=ti().EventEmitter});var JE=A(()=>{l()});var JN=A((ole,YN)=>{"use strict";l();function zN(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 WN(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 Oh.alloc(0);for(var n=Oh.allocUnsafe(r>>>0),i=this.head,s=0;i;)AG(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=Oh.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:vG,value:function(r,n){return XE(this,WN(WN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var ev=A((ule,ZN)=>{"use strict";l();function bG(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(ZE,this,t)):p.default.nextTick(ZE,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(Dh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(XN,r,s)):p.default.nextTick(XN,r,s):e?(p.default.nextTick(Dh,r),e(s)):p.default.nextTick(Dh,r)}),this)}function XN(t,e){ZE(t,e),Dh(t)}function Dh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function IG(){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 ZE(t,e){t.emit("error",e)}function _G(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}ZN.exports={destroy:bG,undestroy:IG,errorOrDestroy:_G}});var Qs=A((lle,rO)=>{"use strict";l();function SG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var tO={};function qr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){SG(o,s);function o(a,u,c){return s.call(this,n(a,u,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,tO[t]=i}function eO(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 TG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function CG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function xG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}qr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);qr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&TG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(CG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(eO(e,"type"));else{var s=xG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(eO(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);qr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");qr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});qr("ERR_STREAM_PREMATURE_CLOSE","Premature close");qr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});qr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");qr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");qr("ERR_STREAM_WRITE_AFTER_END","write after end");qr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);qr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");rO.exports.codes=tO});var tv=A((dle,nO)=>{"use strict";l();var NG=Qs().codes.ERR_INVALID_OPT_VALUE;function OG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function DG(t,e,r,n){var i=OG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new NG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}nO.exports={getHighWaterMark:DG}});var Ea=A((ple,rv)=>{l();typeof Object.create=="function"?rv.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:rv.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 sO=A((yle,iO)=>{l();iO.exports=PG;function PG(t,e){if(nv("noDeprecation"))return t;var r=!1;function n(){if(!r){if(nv("throwDeprecation"))throw new Error(e);nv("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function nv(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var ov=A((wle,fO)=>{"use strict";l();fO.exports=gt;function aO(t){var e=this;this.next=null,this.entry=null,this.finish=function(){sj(e,t)}}var va;gt.WritableState=kc;var RG={deprecate:sO()},uO=YE(),Rh=Vs().Buffer,BG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function LG(t){return Rh.from(t)}function FG(t){return Rh.isBuffer(t)||t instanceof BG}var sv=ev(),MG=tv(),UG=MG.getHighWaterMark,Mi=Qs().codes,qG=Mi.ERR_INVALID_ARG_TYPE,VG=Mi.ERR_METHOD_NOT_IMPLEMENTED,HG=Mi.ERR_MULTIPLE_CALLBACK,kG=Mi.ERR_STREAM_CANNOT_PIPE,GG=Mi.ERR_STREAM_DESTROYED,jG=Mi.ERR_STREAM_NULL_VALUES,QG=Mi.ERR_STREAM_WRITE_AFTER_END,zG=Mi.ERR_UNKNOWN_ENCODING,Aa=sv.errorOrDestroy;Ea()(gt,uO);function WG(){}function kc(t,e,r){va=va||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof va),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=UG(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){ej(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 aO(this)}kc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(kc.prototype,"buffer",{get:RG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Ph;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ph=Function.prototype[Symbol.hasInstance],Object.defineProperty(gt,Symbol.hasInstance,{value:function(e){return Ph.call(this,e)?!0:this!==gt?!1:e&&e._writableState instanceof kc}})):Ph=function(e){return e instanceof this};function gt(t){va=va||zs();var e=this instanceof va;if(!e&&!Ph.call(gt,this))return new gt(t);this._writableState=new kc(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)),uO.call(this)}gt.prototype.pipe=function(){Aa(this,new kG)};function $G(t,e){var r=new QG;Aa(t,r),p.default.nextTick(e,r)}function KG(t,e,r,n){var i;return r===null?i=new jG:typeof r!="string"&&!e.objectMode&&(i=new qG("chunk",["string","Buffer"],r)),i?(Aa(t,i),p.default.nextTick(n,i),!1):!0}gt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&FG(t);return s&&!Rh.isBuffer(t)&&(t=LG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=WG),n.ending?$G(this,r):(s||KG(this,n,t,r))&&(n.pendingcb++,i=JG(this,n,s,t,e,r)),i};gt.prototype.cork=function(){this._writableState.corked++};gt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&cO(this,t))};gt.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 zG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function YG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Rh.from(e,r)),e}Object.defineProperty(gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function JG(t,e,r,n,i,s){if(!r){var o=YG(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";l();var oj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};hO.exports=Tn;var dO=cv(),uv=ov();Ea()(Tn,dO);for(av=oj(uv.prototype),Bh=0;Bh{l();var Fh=Vs(),Cn=Fh.Buffer;function pO(t,e){for(var r in t)e[r]=t[r]}Cn.from&&Cn.alloc&&Cn.allocUnsafe&&Cn.allocUnsafeSlow?gO.exports=Fh:(pO(Fh,lv),lv.Buffer=Ws);function Ws(t,e,r){return Cn(t,e,r)}Ws.prototype=Object.create(Cn.prototype);pO(Cn,Ws);Ws.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Cn(t,e,r)};Ws.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Cn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ws.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Cn(t)};Ws.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Fh.SlowBuffer(t)}});var hv=A(wO=>{"use strict";l();var dv=yO().Buffer,mO=dv.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 cj(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 lj(t){var e=cj(t);if(typeof e!="string"&&(dv.isEncoding===mO||!mO(t)))throw new Error("Unknown encoding: "+t);return e||t}wO.StringDecoder=Gc;function Gc(t){this.encoding=lj(t);var e;switch(this.encoding){case"utf16le":this.text=yj,this.end=mj,e=4;break;case"utf8":this.fillLast=hj,e=4;break;case"base64":this.text=wj,this.end=Ej,e=3;break;default:this.write=vj,this.end=Aj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=dv.allocUnsafe(e)}Gc.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 fj(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 dj(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 hj(t){var e=this.lastTotal-this.lastNeed,r=dj(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 pj(t,e){var r=fj(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 gj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function yj(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 mj(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 wj(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 Ej(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function vj(t){return t.toString(this.encoding)}function Aj(t){return t&&t.length?this.write(t):""}});var Mh=A((Sle,AO)=>{"use strict";l();var EO=Qs().codes.ERR_STREAM_PREMATURE_CLOSE;function bj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";l();var Uh;function Ui(t,e,r){return e=Sj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sj(t){var e=Tj(t,"string");return typeof e=="symbol"?e:String(e)}function Tj(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 Cj=Mh(),qi=Symbol("lastResolve"),$s=Symbol("lastReject"),jc=Symbol("error"),qh=Symbol("ended"),Ks=Symbol("lastPromise"),pv=Symbol("handlePromise"),Ys=Symbol("stream");function Vi(t,e){return{value:t,done:e}}function xj(t){var e=t[qi];if(e!==null){var r=t[Ys].read();r!==null&&(t[Ks]=null,t[qi]=null,t[$s]=null,e(Vi(r,!1)))}}function Nj(t){p.default.nextTick(xj,t)}function Oj(t,e){return function(r,n){t.then(function(){if(e[qh]){r(Vi(void 0,!0));return}e[pv](r,n)},n)}}var Dj=Object.getPrototypeOf(function(){}),Pj=Object.setPrototypeOf((Uh={get stream(){return this[Ys]},next:function(){var e=this,r=this[jc];if(r!==null)return Promise.reject(r);if(this[qh])return Promise.resolve(Vi(void 0,!0));if(this[Ys].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[jc]?a(e[jc]):o(Vi(void 0,!0))})});var n=this[Ks],i;if(n)i=new Promise(Oj(n,this));else{var s=this[Ys].read();if(s!==null)return Promise.resolve(Vi(s,!1));i=new Promise(this[pv])}return this[Ks]=i,i}},Ui(Uh,Symbol.asyncIterator,function(){return this}),Ui(Uh,"return",function(){var e=this;return new Promise(function(r,n){e[Ys].destroy(null,function(i){if(i){n(i);return}r(Vi(void 0,!0))})})}),Uh),Dj),Rj=function(e){var r,n=Object.create(Pj,(r={},Ui(r,Ys,{value:e,writable:!0}),Ui(r,qi,{value:null,writable:!0}),Ui(r,$s,{value:null,writable:!0}),Ui(r,jc,{value:null,writable:!0}),Ui(r,qh,{value:e._readableState.endEmitted,writable:!0}),Ui(r,pv,{value:function(s,o){var a=n[Ys].read();a?(n[Ks]=null,n[qi]=null,n[$s]=null,s(Vi(a,!1))):(n[qi]=s,n[$s]=o)},writable:!0}),r));return n[Ks]=null,Cj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[$s];s!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,s(i)),n[jc]=i;return}var o=n[qi];o!==null&&(n[Ks]=null,n[qi]=null,n[$s]=null,o(Vi(void 0,!0))),n[qh]=!0}),e.on("readable",Nj.bind(null,n)),n};bO.exports=Rj});var SO=A((Nle,_O)=>{l();_O.exports=function(){throw new Error("Readable.from is not available in the browser")}});var cv=A((Ple,LO)=>{"use strict";l();LO.exports=qe;var ba;qe.ReadableState=NO;var Dle=ti().EventEmitter,xO=function(e,r){return e.listeners(r).length},zc=YE(),Vh=Vs().Buffer,Bj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Lj(t){return Vh.from(t)}function Fj(t){return Vh.isBuffer(t)||t instanceof Bj}var gv=JE(),Ne;gv&&gv.debuglog?Ne=gv.debuglog("stream"):Ne=function(){};var Mj=JN(),bv=ev(),Uj=tv(),qj=Uj.getHighWaterMark,Hh=Qs().codes,Vj=Hh.ERR_INVALID_ARG_TYPE,Hj=Hh.ERR_STREAM_PUSH_AFTER_EOF,kj=Hh.ERR_METHOD_NOT_IMPLEMENTED,Gj=Hh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ia,yv,mv;Ea()(qe,zc);var Qc=bv.errorOrDestroy,wv=["error","close","destroy","pause","resume"];function jj(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 NO(t,e,r){ba=ba||zs(),t=t||{},typeof r!="boolean"&&(r=e instanceof ba),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=qj(this,t,"readableHighWaterMark",r),this.buffer=new Mj,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&&(Ia||(Ia=hv().StringDecoder),this.decoder=new Ia(t.encoding),this.encoding=t.encoding)}function qe(t){if(ba=ba||zs(),!(this instanceof qe))return new qe(t);var e=this instanceof ba;this._readableState=new NO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),zc.call(this)}Object.defineProperty(qe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});qe.prototype.destroy=bv.destroy;qe.prototype._undestroy=bv.undestroy;qe.prototype._destroy=function(t,e){e(t)};qe.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=Vh.from(t,e),e=""),n=!0),OO(this,t,e,!1,n)};qe.prototype.unshift=function(t){return OO(this,t,null,!0,!1)};function OO(t,e,r,n,i){Ne("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Wj(t,s);else{var o;if(i||(o=Qj(s,e)),o)Qc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Vh.prototype&&(e=Lj(e)),n)s.endEmitted?Qc(t,new Gj):Ev(t,s,e,!0);else if(s.ended)Qc(t,new Hj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?Ev(t,s,e,!1):Av(t,s)):Ev(t,s,e,!1)}else n||(s.reading=!1,Av(t,s))}return!s.ended&&(s.length=TO?t=TO:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function CO(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=zj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}qe.prototype.read=function(t){Ne("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 Ne("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?vv(this):kh(this),null;if(t=CO(t,e),t===0&&e.ended)return e.length===0&&vv(this),null;var n=e.needReadable;Ne("need readable",n),(e.length===0||e.length-t0?i=RO(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&&vv(this)),i!==null&&this.emit("data",i),i};function Wj(t,e){if(Ne("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?kh(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,DO(t)))}}function kh(t){var e=t._readableState;Ne("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ne("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(DO,t))}function DO(t){var e=t._readableState;Ne("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,Iv(t)}function Av(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick($j,t,e))}function $j(t,e){for(;!e.reading&&!e.ended&&(e.length1&&BO(n.pipes,t)!==-1)&&!c&&(Ne("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){Ne("onerror",O),b(),t.removeListener("error",g),xO(t,"error")===0&&Qc(t,O)}jj(t,"error",g);function m(){t.removeListener("finish",y),b()}t.once("close",m);function y(){Ne("onfinish"),t.removeListener("close",m),b()}t.once("finish",y);function b(){Ne("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ne("pipe resume"),r.resume()),t};function Kj(t){return function(){var r=t._readableState;Ne("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&xO(t,"data")&&(r.flowing=!0,Iv(t))}}qe.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,Ne("on readable",n.length,n.reading),n.length?kh(this):n.reading||p.default.nextTick(Yj,this)),r};qe.prototype.addListener=qe.prototype.on;qe.prototype.removeListener=function(t,e){var r=zc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(PO,this),r};qe.prototype.removeAllListeners=function(t){var e=zc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(PO,this),e};function PO(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 Yj(t){Ne("readable nexttick read 0"),t.read(0)}qe.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ne("resume"),t.flowing=!t.readableListening,Jj(this,t)),t.paused=!1,this};function Jj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(Xj,t,e))}function Xj(t,e){Ne("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Iv(t),e.flowing&&!e.reading&&t.read(0)}qe.prototype.pause=function(){return Ne("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ne("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Iv(t){var e=t._readableState;for(Ne("flow",e.flowing);e.flowing&&t.read()!==null;);}qe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ne("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(Ne("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 vv(t){var e=t._readableState;Ne("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Zj,e,t))}function Zj(t,e){if(Ne("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"&&(qe.from=function(t,e){return mv===void 0&&(mv=SO()),mv(qe,t,e)});function BO(t,e){for(var r=0,n=t.length;r{"use strict";l();MO.exports=ri;var Gh=Qs().codes,eQ=Gh.ERR_METHOD_NOT_IMPLEMENTED,tQ=Gh.ERR_MULTIPLE_CALLBACK,rQ=Gh.ERR_TRANSFORM_ALREADY_TRANSFORMING,nQ=Gh.ERR_TRANSFORM_WITH_LENGTH_0,jh=zs();Ea()(ri,jh);function iQ(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new tQ);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";l();qO.exports=Wc;var UO=_v();Ea()(Wc,UO);function Wc(t){if(!(this instanceof Wc))return new Wc(t);UO.call(this,t)}Wc.prototype._transform=function(t,e,r){r(null,t)}});var QO=A((Ule,jO)=>{"use strict";l();var Sv;function oQ(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var GO=Qs().codes,aQ=GO.ERR_MISSING_ARGS,uQ=GO.ERR_STREAM_DESTROYED;function HO(t){if(t)throw t}function cQ(t){return t.setHeader&&typeof t.abort=="function"}function lQ(t,e,r,n){n=oQ(n);var i=!1;t.on("close",function(){i=!0}),Sv===void 0&&(Sv=Mh()),Sv(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,cQ(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new uQ("pipe"))}}}function kO(t){t()}function fQ(t,e){return t.pipe(e)}function dQ(t){return!t.length||typeof t[t.length-1]!="function"?HO:t.pop()}function hQ(){for(var t=arguments.length,e=new Array(t),r=0;r0;return lQ(o,u,c,function(f){i||(i=f),f&&s.forEach(kO),!u&&(s.forEach(kO),n(i))})});return e.reduce(fQ)}jO.exports=hQ});var Tv=A((Vr,zO)=>{l();Vr=zO.exports=cv();Vr.Stream=Vr;Vr.Readable=Vr;Vr.Writable=ov();Vr.Duplex=zs();Vr.Transform=_v();Vr.PassThrough=VO();Vr.finished=Mh();Vr.pipeline=QO()});var KO=A((Hle,$O)=>{l();var{Transform:pQ}=Tv();$O.exports=t=>class WO extends pQ{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 WO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var XO=A((Gle,JO)=>{l();var{Transform:gQ}=Tv();JO.exports=t=>class YO extends gQ{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 YO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var e2=A((Qle,ZO)=>{l();var yQ=KO(),mQ=XO();ZO.exports=function(t){let e=yQ(t),r=mQ(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 n2=A(r2=>{l();var t2=[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];r2.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],c=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],g=f^(i<<1|s>>>31),m=d^(s<<1|i>>>31),y=t[0]^g,b=t[1]^m,O=t[10]^g,R=t[11]^m,z=t[20]^g,M=t[21]^m,E=t[30]^g,S=t[31]^m,N=t[40]^g,_=t[41]^m;g=r^(o<<1|a>>>31),m=n^(a<<1|o>>>31);let T=t[2]^g,B=t[3]^m,X=t[12]^g,Q=t[13]^m,H=t[22]^g,j=t[23]^m,K=t[32]^g,me=t[33]^m,ce=t[42]^g,ie=t[43]^m;g=i^(u<<1|c>>>31),m=s^(c<<1|u>>>31);let J=t[4]^g,oe=t[5]^m,re=t[14]^g,se=t[15]^m,U=t[24]^g,fe=t[25]^m,ue=t[34]^g,de=t[35]^m,ae=t[44]^g,le=t[45]^m;g=o^(f<<1|d>>>31),m=a^(d<<1|f>>>31);let w=t[6]^g,v=t[7]^m,I=t[16]^g,P=t[17]^m,C=t[26]^g,D=t[27]^m,L=t[36]^g,x=t[37]^m,F=t[46]^g,k=t[47]^m;g=u^(r<<1|n>>>31),m=c^(n<<1|r>>>31);let q=t[8]^g,ee=t[9]^m,Ae=t[18]^g,Se=t[19]^m,Be=t[28]^g,it=t[29]^m,dt=t[38]^g,De=t[39]^m,Ve=t[48]^g,Lt=t[49]^m,Ei=y,Ss=b,Ts=R<<4|O>>>28,cr=O<<4|R>>>28,Qn=z<<3|M>>>29,Kt=M<<3|z>>>29,Ft=S<<9|E>>>23,Je=E<<9|S>>>23,s0=N<<18|_>>>14,o0=_<<18|N>>>14,a0=T<<1|B>>>31,u0=B<<1|T>>>31,c0=Q<<12|X>>>20,l0=X<<12|Q>>>20,f0=H<<10|j>>>22,d0=j<<10|H>>>22,h0=me<<13|K>>>19,p0=K<<13|me>>>19,g0=ce<<2|ie>>>30,y0=ie<<2|ce>>>30,m0=oe<<30|J>>>2,w0=J<<30|oe>>>2,E0=re<<6|se>>>26,v0=se<<6|re>>>26,A0=fe<<11|U>>>21,b0=U<<11|fe>>>21,I0=ue<<15|de>>>17,_0=de<<15|ue>>>17,S0=le<<29|ae>>>3,T0=ae<<29|le>>>3,C0=w<<28|v>>>4,x0=v<<28|w>>>4,N0=P<<23|I>>>9,O0=I<<23|P>>>9,D0=C<<25|D>>>7,P0=D<<25|C>>>7,R0=L<<21|x>>>11,B0=x<<21|L>>>11,L0=k<<24|F>>>8,F0=F<<24|k>>>8,M0=q<<27|ee>>>5,U0=ee<<27|q>>>5,q0=Ae<<20|Se>>>12,V0=Se<<20|Ae>>>12,H0=it<<7|Be>>>25,k0=Be<<7|it>>>25,G0=dt<<8|De>>>24,j0=De<<8|dt>>>24,Q0=Ve<<14|Lt>>>18,z0=Lt<<14|Ve>>>18;t[0]=Ei^~c0&A0,t[1]=Ss^~l0&b0,t[10]=C0^~q0&Qn,t[11]=x0^~V0&Kt,t[20]=a0^~E0&D0,t[21]=u0^~v0&P0,t[30]=M0^~Ts&f0,t[31]=U0^~cr&d0,t[40]=m0^~N0&H0,t[41]=w0^~O0&k0,t[2]=c0^~A0&R0,t[3]=l0^~b0&B0,t[12]=q0^~Qn&h0,t[13]=V0^~Kt&p0,t[22]=E0^~D0&G0,t[23]=v0^~P0&j0,t[32]=Ts^~f0&I0,t[33]=cr^~d0&_0,t[42]=N0^~H0&Ft,t[43]=O0^~k0&Je,t[4]=A0^~R0&Q0,t[5]=b0^~B0&z0,t[14]=Qn^~h0&S0,t[15]=Kt^~p0&T0,t[24]=D0^~G0&s0,t[25]=P0^~j0&o0,t[34]=f0^~I0&L0,t[35]=d0^~_0&F0,t[44]=H0^~Ft&g0,t[45]=k0^~Je&y0,t[6]=R0^~Q0&Ei,t[7]=B0^~z0&Ss,t[16]=h0^~S0&C0,t[17]=p0^~T0&x0,t[26]=G0^~s0&a0,t[27]=j0^~o0&u0,t[36]=I0^~L0&M0,t[37]=_0^~F0&U0,t[46]=Ft^~g0&m0,t[47]=Je^~y0&w0,t[8]=Q0^~Ei&c0,t[9]=z0^~Ss&l0,t[18]=S0^~C0&q0,t[19]=T0^~x0&V0,t[28]=s0^~a0&E0,t[29]=o0^~u0&v0,t[38]=L0^~M0&Ts,t[39]=F0^~U0&cr,t[48]=g0^~m0&N0,t[49]=y0^~w0&O0,t[0]^=t2[e*2],t[1]^=t2[e*2+1]}}});var s2=A((Kle,i2)=>{l();var Qh=n2();function _a(){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}_a.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};_a.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Qh.p1600(this.state),this.count=0);return e};_a.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};i2.exports=_a});var Cv=A((Jle,o2)=>{l();o2.exports=e2()(s2())});var Dv=A(Sa=>{"use strict";l();var wQ=Sa&&Sa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sa,"__esModule",{value:!0});Sa.SmartContract=void 0;var EQ=wQ(Yt()),$c=pt(),xv=ah(),vQ=Le(),Nv=Yr(),AQ=br(),bQ=Tc(),a2=NE(),u2=qc(),c2=UE(),IQ=HE(),_Q=Vc(),zh=$E(),SQ=Cv(),Ov=class{constructor(e={}){this.address=new $c.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new $c.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 u2.ContractFunction(i);return new c2.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new u2.ContractFunction(i),a=IQ.NativeSerializer.nativeToTypedValues(s||[],n);return new c2.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return AQ.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}){xv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new a2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Nv.Transaction({receiver:$c.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){xv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new a2.CodeMetadata,i=i||[],s=s||0;let c=new zh.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Nv.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){xv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let c=new zh.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new Nv.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:c,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new _Q.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new vQ.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new $c.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new EQ.default(r.valueOf().toString(10)),u=bQ.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let c=h.Buffer.concat([i,o]),f=SQ("keccak256").update(c).digest(),d=h.Buffer.from(zh.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new $c.Address(g)}};Sa.SmartContract=Ov});var Wh=A(Js=>{"use strict";l();Object.defineProperty(Js,"__esModule",{value:!0});Js.SignableMessage=Js.MESSAGE_PREFIX=void 0;var TQ=pt(),CQ=Rc(),xQ=Cv();Js.MESSAGE_PREFIX=`Elrond Signed Message: +`;var Pv=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new TQ.Address,Object.assign(this,e)}serializeForSigning(){let e=h.Buffer.from(this.message.length.toString()),r=h.Buffer.concat([e,this.message]),n=h.Buffer.concat([h.Buffer.from(Js.MESSAGE_PREFIX),r]);return xQ("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=CQ.interpretSignatureAsBuffer(e)}getMessageSize(){let e=h.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};Js.SignableMessage=Pv});var Rv=A(l2=>{"use strict";l();Object.defineProperty(l2,"__esModule",{value:!0})});var Ta=A(Ht=>{"use strict";l();var NQ=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]}),OQ=Ht&&Ht.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DQ=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)&&NQ(e,t,r);return OQ(e,t),e};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.zeroPadStringIfOddLength=Ht.isPaddedHex=Ht.numberToPaddedHex=Ht.Nonce=Ht.Address=void 0;var f2=DQ(tw()),PQ="erd",Bv=class t{constructor(e){this.value=e}static fromPubkey(e){let r=f2.toWords(e),n=f2.encode(PQ,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Ht.Address=Bv;var Lv=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return d2(this.value)}};Ht.Nonce=Lv;function d2(t){let e=t.toString(16);return h2(e)}Ht.numberToPaddedHex=d2;function RQ(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ht.isPaddedHex=RQ;function h2(t){return t=t||"",t.length%2==1?"0"+t:t}Ht.zeroPadStringIfOddLength=h2});var p2=A(Hi=>{"use strict";l();var BQ=Hi&&Hi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hi,"__esModule",{value:!0});Hi.EsdtContractAddress=Hi.MaxUint64AsBigNumber=void 0;var LQ=BQ(Yt()),FQ=Ta();Hi.MaxUint64AsBigNumber=new LQ.default("18446744073709551615");Hi.EsdtContractAddress=new FQ.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var Mv=A(Ca=>{"use strict";l();var MQ=Ca&&Ca.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ContractQueryResponse=void 0;var UQ=MQ(Yt()),qQ=p2(),Fv=class t{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 UQ.default(e.gasRemaining||e.GasRemaining||0),o=qQ.MaxUint64AsBigNumber.minus(s).toNumber();return new t({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()}}};Ca.ContractQueryResponse=Fv});var g2=A(ki=>{"use strict";l();Object.defineProperty(ki,"__esModule",{value:!0});ki.ErrAccountNotConnected=ki.ErrCannotSignSingleTransaction=ki.Err=void 0;var Kc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};ki.Err=Kc;var Uv=class extends Kc{constructor(){super("Cannot sign single transaction.")}};ki.ErrCannotSignSingleTransaction=Uv;var qv=class extends Kc{constructor(){super("Account is not connected.")}};ki.ErrAccountNotConnected=qv});var y2=A(Yc=>{"use strict";l();Object.defineProperty(Yc,"__esModule",{value:!0});Yc.Operation=void 0;var VQ;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(VQ=Yc.Operation||(Yc.Operation={}))});var Vv=A(xa=>{"use strict";l();var Gi=xa&&xa.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(xa,"__esModule",{value:!0});xa.ExtensionProvider=void 0;var HQ=Yr(),m2=g2(),Jc=y2(),Xc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Gi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Gi(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(Jc.Operation.Connect,n),this.account.address})}logout(){return Gi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Jc.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 Gi(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 Gi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Gi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new m2.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new m2.ErrAccountNotConnected}signTransactions(e){return Gi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Jc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>HQ.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Gi(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Jc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Jc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(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)})}};xa.ExtensionProvider=Xc;Xc._instance=new Xc});function QQ(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){zQ(t);return}return e}function zQ(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zc(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!jQ.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(kQ.test(t)||GQ.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,QQ)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var kQ,GQ,jQ,b2=he(()=>{l();kQ=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,GQ=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,jQ=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function WQ(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mt(t,...e){try{return WQ(t(...e))}catch(r){return Promise.reject(r)}}function $Q(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function KQ(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function el(t){if($Q(t))return String(t);if(KQ(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return el(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function I2(){if(typeof h.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function _2(t){if(typeof t=="string")return t;I2();let e=h.Buffer.from(t).toString("base64");return Hv+e}function S2(t){return typeof t!="string"||!t.startsWith(Hv)?t:(I2(),h.Buffer.from(t.slice(Hv.length),"base64"))}function ir(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function T2(...t){return ir(t.join(":"))}function tl(t){return t=ir(t),t?t+":":""}var Hv,C2=he(()=>{l();Hv="base64:"});function O2(t={}){let e={mounts:{"":t.driver||JQ()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(d=>d.startsWith(c)||f&&c.startsWith(d)).map(d=>({relativeBase:c.length>d.length?c.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),i=(c,f)=>{if(e.watching){f=ir(f);for(let d of e.watchListeners)d(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await x2(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},a=(c,f,d)=>{let g=new Map,m=y=>{let b=g.get(y.base);return b||(b={driver:y.driver,base:y.base,items:[]},g.set(y.base,b)),b};for(let y of c){let b=typeof y=="string",O=ir(b?y:y.key),R=b?void 0:y.value,z=b||!y.options?f:{...f,...y.options},M=r(O);m(M).items.push({key:O,value:R,relativeKey:M.relativeKey,options:z})}return Promise.all([...g.values()].map(y=>d(y))).then(y=>y.flat())},u={hasItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.hasItem,d,f)},getItem(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return Mt(g.getItem,d,f).then(m=>Zc(m))},getItems(c,f){return a(c,f,d=>d.driver.getItems?Mt(d.driver.getItems,d.items.map(g=>({key:g.relativeKey,options:g.options})),f).then(g=>g.map(m=>({key:T2(d.base,m.key),value:Zc(m.value)}))):Promise.all(d.items.map(g=>Mt(d.driver.getItem,g.relativeKey,g.options).then(m=>({key:g.key,value:Zc(m)})))))},getItemRaw(c,f={}){c=ir(c);let{relativeKey:d,driver:g}=r(c);return g.getItemRaw?Mt(g.getItemRaw,d,f):Mt(g.getItem,d,f).then(m=>S2(m))},async setItem(c,f,d={}){if(f===void 0)return u.removeItem(c);c=ir(c);let{relativeKey:g,driver:m}=r(c);m.setItem&&(await Mt(m.setItem,g,el(f),d),m.watch||i("update",c))},async setItems(c,f){await a(c,f,async d=>{d.driver.setItems&&await Mt(d.driver.setItems,d.items.map(g=>({key:g.relativeKey,value:el(g.value),options:g.options})),f),d.driver.setItem&&await Promise.all(d.items.map(g=>Mt(d.driver.setItem,g.relativeKey,el(g.value),g.options)))})},async setItemRaw(c,f,d={}){if(f===void 0)return u.removeItem(c,d);c=ir(c);let{relativeKey:g,driver:m}=r(c);if(m.setItemRaw)await Mt(m.setItemRaw,g,f,d);else if(m.setItem)await Mt(m.setItem,g,_2(f),d);else return;m.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c);g.removeItem&&(await Mt(g.removeItem,d,f),(f.removeMeta||f.removeMata)&&await Mt(g.removeItem,d+"$",f),g.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=ir(c);let{relativeKey:d,driver:g}=r(c),m=Object.create(null);if(g.getMeta&&Object.assign(m,await Mt(g.getMeta,d,f)),!f.nativeOnly){let y=await Mt(g.getItem,d+"$",f).then(b=>Zc(b));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(m,y))}return m},setMeta(c,f,d={}){return this.setItem(c+"$",f,d)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=tl(c);let d=n(c,!0),g=[],m=[];for(let y of d){let O=(await Mt(y.driver.getKeys,y.relativeBase,f)).map(R=>y.mountpoint+ir(R)).filter(R=>!g.some(z=>R.startsWith(z)));m.push(...O),g=[y.mountpoint,...g.filter(R=>!R.startsWith(y.mountpoint))]}return c?m.filter(y=>y.startsWith(c)&&!y.endsWith("$")):m.filter(y=>!y.endsWith("$"))},async clear(c,f={}){c=tl(c),await Promise.all(n(c,!1).map(async d=>{if(d.driver.clear)return Mt(d.driver.clear,d.relativeBase,f);if(d.driver.removeItem){let g=await d.driver.getKeys(d.relativeBase||"",f);return Promise.all(g.map(m=>d.driver.removeItem(m,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>N2(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=tl(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((d,g)=>g.length-d.length)),e.mounts[c]=f,e.watching&&Promise.resolve(x2(f,i,c)).then(d=>{e.unwatch[c]=d}).catch(console.error),u},async unmount(c,f=!0){c=tl(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await N2(e.mounts[c]),e.mountpoints=e.mountpoints.filter(d=>d!==c),delete e.mounts[c])},getMount(c=""){c=ir(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=ir(c),n(c,f.parents).map(g=>({driver:g.driver,base:g.mountpoint}))}};return u}function x2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function N2(t){typeof t.dispose=="function"&&await Mt(t.dispose)}var YQ,JQ,D2=he(()=>{l();b2();C2();YQ="memory",JQ=()=>{let t=new Map;return{name:YQ,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function Xs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Gv(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Xs(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function rl(){return kv||(kv=Gv("keyval-store","keyval")),kv}function jv(t,e=rl()){return e("readonly",r=>Xs(r.get(t)))}function P2(t,e,r=rl()){return r("readwrite",n=>(n.put(e,t),Xs(n.transaction)))}function R2(t,e=rl()){return e("readwrite",r=>(r.delete(t),Xs(r.transaction)))}function B2(t=rl()){return t("readwrite",e=>(e.clear(),Xs(e.transaction)))}function XQ(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xs(t.transaction)}function L2(t=rl()){return t("readonly",e=>{if(e.getAllKeys)return Xs(e.getAllKeys());let r=[];return XQ(e,n=>r.push(n.key)).then(()=>r)})}var kv,F2=he(()=>{l()});var M2={};ft(M2,{safeJsonParse:()=>Qi,safeJsonStringify:()=>zi});function Qi(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return e7(t)}catch{return t}}function zi(t){return typeof t=="string"?t:ZQ(t)||""}var ZQ,e7,nl=he(()=>{l();ZQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),e7=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 q2={};ft(q2,{KeyValueStorage:()=>$v,default:()=>$v});function s7(t){var e;return[t[0],Qi((e=t[1])!=null?e:"")]}var t7,r7,n7,i7,zv,Qv,Jh,Wv,o7,U2,a7,u7,$v,V2=he(()=>{l();D2();F2();nl();t7="idb-keyval",r7=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=Gv(t.dbName,t.storeName)),{name:t7,options:t,async hasItem(i){return!(typeof await jv(r(i),n)>"u")},async getItem(i){return await jv(r(i),n)??null},setItem(i,s){return P2(r(i),s,n)},removeItem(i){return R2(r(i),n)},getKeys(){return L2(n)},clear(){return B2(n)}}},n7="WALLET_CONNECT_V2_INDEXED_DB",i7="keyvaluestorage",zv=class{constructor(){this.indexedDb=O2({driver:r7({dbName:n7,storeName:i7})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,zi(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},Qv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Jh={exports:{}};(function(){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 Qv<"u"&&Qv.localStorage?Jh.exports=Qv.localStorage:typeof window<"u"&&window.localStorage?Jh.exports=window.localStorage:Jh.exports=new e})();Wv=class{constructor(){this.localStorage=Jh.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(s7)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Qi(r)}async setItem(e,r){this.localStorage.setItem(e,zi(r))}async removeItem(e){this.localStorage.removeItem(e)}},o7="wc_storage_version",U2=1,a7=async(t,e,r)=>{let n=o7,i=await e.getItem(n);if(i&&i>=U2){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let a=s.shift();if(!a)continue;let u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){let c=await t.getItem(a);await e.setItem(a,c),o.push(a)}}await e.setItem(n,U2),r(e),u7(t,o)},u7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},$v=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new Wv;this.storage=e;try{let r=new zv;a7(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var Zr={};ft(Zr,{__assign:()=>Yv,__asyncDelegator:()=>A7,__asyncGenerator:()=>v7,__asyncValues:()=>b7,__await:()=>il,__awaiter:()=>p7,__classPrivateFieldGet:()=>T7,__classPrivateFieldSet:()=>C7,__createBinding:()=>y7,__decorate:()=>f7,__exportStar:()=>m7,__extends:()=>c7,__generator:()=>g7,__importDefault:()=>S7,__importStar:()=>_7,__makeTemplateObject:()=>I7,__metadata:()=>h7,__param:()=>d7,__read:()=>H2,__rest:()=>l7,__spread:()=>w7,__spreadArrays:()=>E7,__values:()=>Jv});function c7(t,e){Kv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function l7(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 d7(t,e){return function(r,n){e(r,n,t)}}function h7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function p7(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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function g7(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(c){return function(f){return u([c,f])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[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 H2(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 w7(){for(var t=[],e=0;e1||a(g,m)})})}function a(g,m){try{u(n[g](m))}catch(y){d(s[0][3],y)}}function u(g){g.value instanceof il?Promise.resolve(g.value.v).then(c,f):d(s[0][2],g)}function c(g){a("next",g)}function f(g){a("throw",g)}function d(g,m){g(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function A7(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:il(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function b7(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 Jv=="function"?Jv(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(c){s({value:c,done:a})},o)}}function I7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function _7(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 S7(t){return t&&t.__esModule?t:{default:t}}function T7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function C7(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 Kv,Yv,en=he(()=>{l();Kv=function(t,e){return Kv=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])},Kv(t,e)};Yv=function(){return Yv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";l();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.delay=void 0;function x7(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Xh.delay=x7});var G2=A(Na=>{"use strict";l();Object.defineProperty(Na,"__esModule",{value:!0});Na.ONE_THOUSAND=Na.ONE_HUNDRED=void 0;Na.ONE_HUNDRED=100;Na.ONE_THOUSAND=1e3});var j2=A(ge=>{"use strict";l();Object.defineProperty(ge,"__esModule",{value:!0});ge.ONE_YEAR=ge.FOUR_WEEKS=ge.THREE_WEEKS=ge.TWO_WEEKS=ge.ONE_WEEK=ge.THIRTY_DAYS=ge.SEVEN_DAYS=ge.FIVE_DAYS=ge.THREE_DAYS=ge.ONE_DAY=ge.TWENTY_FOUR_HOURS=ge.TWELVE_HOURS=ge.SIX_HOURS=ge.THREE_HOURS=ge.ONE_HOUR=ge.SIXTY_MINUTES=ge.THIRTY_MINUTES=ge.TEN_MINUTES=ge.FIVE_MINUTES=ge.ONE_MINUTE=ge.SIXTY_SECONDS=ge.THIRTY_SECONDS=ge.TEN_SECONDS=ge.FIVE_SECONDS=ge.ONE_SECOND=void 0;ge.ONE_SECOND=1;ge.FIVE_SECONDS=5;ge.TEN_SECONDS=10;ge.THIRTY_SECONDS=30;ge.SIXTY_SECONDS=60;ge.ONE_MINUTE=ge.SIXTY_SECONDS;ge.FIVE_MINUTES=ge.ONE_MINUTE*5;ge.TEN_MINUTES=ge.ONE_MINUTE*10;ge.THIRTY_MINUTES=ge.ONE_MINUTE*30;ge.SIXTY_MINUTES=ge.ONE_MINUTE*60;ge.ONE_HOUR=ge.SIXTY_MINUTES;ge.THREE_HOURS=ge.ONE_HOUR*3;ge.SIX_HOURS=ge.ONE_HOUR*6;ge.TWELVE_HOURS=ge.ONE_HOUR*12;ge.TWENTY_FOUR_HOURS=ge.ONE_HOUR*24;ge.ONE_DAY=ge.TWENTY_FOUR_HOURS;ge.THREE_DAYS=ge.ONE_DAY*3;ge.FIVE_DAYS=ge.ONE_DAY*5;ge.SEVEN_DAYS=ge.ONE_DAY*7;ge.THIRTY_DAYS=ge.ONE_DAY*30;ge.ONE_WEEK=ge.SEVEN_DAYS;ge.TWO_WEEKS=ge.ONE_WEEK*2;ge.THREE_WEEKS=ge.ONE_WEEK*3;ge.FOUR_WEEKS=ge.ONE_WEEK*4;ge.ONE_YEAR=ge.ONE_DAY*365});var Xv=A(Zh=>{"use strict";l();Object.defineProperty(Zh,"__esModule",{value:!0});var Q2=(en(),ht(Zr));Q2.__exportStar(G2(),Zh);Q2.__exportStar(j2(),Zh)});var W2=A(Oa=>{"use strict";l();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.fromMiliseconds=Oa.toMiliseconds=void 0;var z2=Xv();function N7(t){return t*z2.ONE_THOUSAND}Oa.toMiliseconds=N7;function O7(t){return Math.floor(t/z2.ONE_THOUSAND)}Oa.fromMiliseconds=O7});var K2=A(ep=>{"use strict";l();Object.defineProperty(ep,"__esModule",{value:!0});var $2=(en(),ht(Zr));$2.__exportStar(k2(),ep);$2.__exportStar(W2(),ep)});var Y2=A(sl=>{"use strict";l();Object.defineProperty(sl,"__esModule",{value:!0});sl.Watch=void 0;var tp=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}};sl.Watch=tp;sl.default=tp});var J2=A(rp=>{"use strict";l();Object.defineProperty(rp,"__esModule",{value:!0});rp.IWatch=void 0;var Zv=class{};rp.IWatch=Zv});var X2=A(e1=>{"use strict";l();Object.defineProperty(e1,"__esModule",{value:!0});var D7=(en(),ht(Zr));D7.__exportStar(J2(),e1)});var Zs=A(Da=>{"use strict";l();Object.defineProperty(Da,"__esModule",{value:!0});var np=(en(),ht(Zr));np.__exportStar(K2(),Da);np.__exportStar(Y2(),Da);np.__exportStar(X2(),Da);np.__exportStar(Xv(),Da)});var t1,Z2=he(()=>{l();t1=class{}});var r1={};ft(r1,{IEvents:()=>t1});var n1=he(()=>{l();Z2()});var eD=A(ip=>{"use strict";l();Object.defineProperty(ip,"__esModule",{value:!0});ip.IHeartBeat=void 0;var P7=(n1(),ht(r1)),i1=class extends P7.IEvents{constructor(e){super()}};ip.IHeartBeat=i1});var o1=A(s1=>{"use strict";l();Object.defineProperty(s1,"__esModule",{value:!0});var R7=(en(),ht(Zr));R7.__exportStar(eD(),s1)});var tD=A(Pa=>{"use strict";l();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HEARTBEAT_EVENTS=Pa.HEARTBEAT_INTERVAL=void 0;var B7=Zs();Pa.HEARTBEAT_INTERVAL=B7.FIVE_SECONDS;Pa.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var u1=A(a1=>{"use strict";l();Object.defineProperty(a1,"__esModule",{value:!0});var L7=(en(),ht(Zr));L7.__exportStar(tD(),a1)});var rD=A(sp=>{"use strict";l();Object.defineProperty(sp,"__esModule",{value:!0});sp.HeartBeat=void 0;var c1=(en(),ht(Zr)),F7=ti(),M7=Zs(),U7=o1(),l1=u1(),f1=class t extends U7.IHeartBeat{constructor(e){super(e),this.events=new F7.EventEmitter,this.interval=l1.HEARTBEAT_INTERVAL,this.interval=e?.interval||l1.HEARTBEAT_INTERVAL}static init(e){return c1.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return c1.__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 c1.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),M7.toMiliseconds(this.interval))})}pulse(){this.events.emit(l1.HEARTBEAT_EVENTS.pulse)}};sp.HeartBeat=f1});var nD=A(ol=>{"use strict";l();Object.defineProperty(ol,"__esModule",{value:!0});var d1=(en(),ht(Zr));d1.__exportStar(rD(),ol);d1.__exportStar(o1(),ol);d1.__exportStar(u1(),ol)});var sD=A((Ide,iD)=>{"use strict";l();function q7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}iD.exports=V7;function V7(t,e,r){var n=r&&r.stringify||q7,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(m+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=m+2,m++;break}c+=n(e[f]),d=m+2,m++;break;case 115:if(f>=u)break;d{"use strict";l();var oD=sD();cD.exports=xn;var al=Y7().console||{},H7={mapHttpRequest:op,mapHttpResponse:op,wrapRequestSerializer:h1,wrapResponseSerializer:h1,wrapErrorSerializer:h1,req:op,res:op,err:z7};function k7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function xn(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||al;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=k7(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=ul),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:W7(t)};u.levels=xn.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=ul,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=m,e&&(u._logEvent=p1());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,Ra(c,u,"error","log"),Ra(c,u,"fatal","error"),Ra(c,u,"warn","error"),Ra(c,u,"info","log"),Ra(c,u,"debug","log"),Ra(c,u,"trace","log")}function m(y,b){if(!y)throw new Error("missing bindings for child Pino");b=b||{},i&&y.serializers&&(b.serializers=y.serializers);let O=b.serializers;if(i&&O){var R=Object.assign({},n,O),z=t.browser.serialize===!0?Object.keys(R):i;delete y.serializers,ap([y],z,R,this._stdErrSerialize)}function M(E){this._childLevel=(E._childLevel|0)+1,this.error=Ba(E,y,"error"),this.fatal=Ba(E,y,"fatal"),this.warn=Ba(E,y,"warn"),this.info=Ba(E,y,"info"),this.debug=Ba(E,y,"debug"),this.trace=Ba(E,y,"trace"),R&&(this.serializers=R,this._serialize=z),e&&(this._logEvent=p1([].concat(E._logEvent.bindings,y)))}return M.prototype=this,new M(this)}return u}xn.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"}};xn.stdSerializers=H7;xn.stdTimeFunctions=Object.assign({},{nullTime:aD,epochTime:uD,unixTime:$7,isoTime:K7});function Ra(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?ul:i[r]?i[r]:al[r]||al[n]||ul,G7(t,e,r)}function G7(t,e,r){!t.transmit&&e[r]===ul||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===al?al:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Ba(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";l();Object.defineProperty(La,"__esModule",{value:!0});La.PINO_CUSTOM_CONTEXT_KEY=La.PINO_LOGGER_DEFAULTS=void 0;La.PINO_LOGGER_DEFAULTS={level:"info"};La.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var gD=A(mr=>{"use strict";l();Object.defineProperty(mr,"__esModule",{value:!0});mr.generateChildLogger=mr.formatChildLoggerContext=mr.getLoggerContext=mr.setBrowserLoggerContext=mr.getBrowserLoggerContext=mr.getDefaultLoggerOptions=void 0;var Fa=g1();function J7(t){return Object.assign(Object.assign({},t),{level:t?.level||Fa.PINO_LOGGER_DEFAULTS.level})}mr.getDefaultLoggerOptions=J7;function fD(t,e=Fa.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}mr.getBrowserLoggerContext=fD;function dD(t,e,r=Fa.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}mr.setBrowserLoggerContext=dD;function hD(t,e=Fa.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=fD(t,e):r=t.bindings().context||"",r}mr.getLoggerContext=hD;function pD(t,e,r=Fa.PINO_CUSTOM_CONTEXT_KEY){let n=hD(t,r);return n.trim()?`${n}/${e}`:e}mr.formatChildLoggerContext=pD;function X7(t,e,r=Fa.PINO_CUSTOM_CONTEXT_KEY){let n=pD(t,e,r),i=t.child({context:n});return dD(i,n,r)}mr.generateChildLogger=X7});var m1=A(Ma=>{"use strict";l();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.pino=void 0;var y1=(en(),ht(Zr)),Z7=y1.__importDefault(lD());Object.defineProperty(Ma,"pino",{enumerable:!0,get:function(){return Z7.default}});y1.__exportStar(g1(),Ma);y1.__exportStar(gD(),Ma)});var F1=A(Ot=>{"use strict";l();Object.defineProperty(Ot,"__esModule",{value:!0});var Ua=(n1(),ht(r1)),yD=ti();function e9(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var t9=e9(yD),w1=class extends Ua.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},E1=class{constructor(e,r,n){this.core=e,this.logger=r}},v1=class extends Ua.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},A1=class{constructor(e,r){this.logger=e,this.core=r}},b1=class extends Ua.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},I1=class extends Ua.IEvents{constructor(e){super()}},_1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},S1=class{constructor(){this.map=new Map}},T1=class extends Ua.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},C1=class{constructor(e,r){this.core=e,this.logger=r}},x1=class extends Ua.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},N1=class{constructor(e,r){this.logger=e,this.core=r}},O1=class{constructor(e,r){this.projectId=e,this.logger=r}},D1=class{constructor(e,r){this.projectId=e,this.logger=r}},P1=class extends t9.default{constructor(){super()}},R1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},B1=class extends yD.EventEmitter{constructor(){super()}},L1=class{constructor(e){this.client=e}};Ot.ICore=w1,Ot.ICrypto=E1,Ot.IEchoClient=D1,Ot.IEngine=L1,Ot.IEngineEvents=B1,Ot.IExpirer=x1,Ot.IJsonRpcHistory=v1,Ot.IKeyChain=C1,Ot.IMessageTracker=A1,Ot.IPairing=N1,Ot.IPublisher=b1,Ot.IRelayer=I1,Ot.ISignClient=R1,Ot.ISignClientEvents=P1,Ot.IStore=_1,Ot.ISubscriber=T1,Ot.ISubscriberTopicMap=S1,Ot.IVerify=O1});var wD=A(up=>{"use strict";l();Object.defineProperty(up,"__esModule",{value:!0});up.BrowserRandomSource=void 0;var mD=65536,M1=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";l();Object.defineProperty(U1,"__esModule",{value:!0});function r9(t){for(var e=0;e{l()});var vD=A(cp=>{"use strict";l();Object.defineProperty(cp,"__esModule",{value:!0});cp.NodeRandomSource=void 0;var n9=Hr(),q1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof TS<"u"){let e=ED();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";l();Object.defineProperty(lp,"__esModule",{value:!0});lp.SystemRandomSource=void 0;var i9=wD(),s9=vD(),V1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new i9.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new s9.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)}};lp.SystemRandomSource=V1});var bD=A(Ir=>{"use strict";l();Object.defineProperty(Ir,"__esModule",{value:!0});function o9(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}Ir.mul=Math.imul||o9;function a9(t,e){return t+e|0}Ir.add=a9;function u9(t,e){return t-e|0}Ir.sub=u9;function c9(t,e){return t<>>32-e}Ir.rotl=c9;function l9(t,e){return t<<32-e|t>>>e}Ir.rotr=l9;function f9(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ir.isInteger=Number.isInteger||f9;Ir.MAX_SAFE_INTEGER=9007199254740991;Ir.isSafeInteger=function(t){return Ir.isInteger(t)&&t>=-Ir.MAX_SAFE_INTEGER&&t<=Ir.MAX_SAFE_INTEGER}});var qa=A(Oe=>{"use strict";l();Object.defineProperty(Oe,"__esModule",{value:!0});var ID=bD();function d9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Oe.readInt16BE=d9;function h9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Oe.readUint16BE=h9;function p9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Oe.readInt16LE=p9;function g9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Oe.readUint16LE=g9;function _D(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}Oe.writeUint16BE=_D;Oe.writeInt16BE=_D;function SD(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}Oe.writeUint16LE=SD;Oe.writeInt16LE=SD;function H1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Oe.readInt32BE=H1;function k1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Oe.readUint32BE=k1;function G1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Oe.readInt32LE=G1;function j1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Oe.readUint32LE=j1;function fp(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}Oe.writeUint32BE=fp;Oe.writeInt32BE=fp;function dp(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}Oe.writeUint32LE=dp;Oe.writeInt32LE=dp;function y9(t,e){e===void 0&&(e=0);var r=H1(t,e),n=H1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Oe.readInt64BE=y9;function m9(t,e){e===void 0&&(e=0);var r=k1(t,e),n=k1(t,e+4);return r*4294967296+n}Oe.readUint64BE=m9;function w9(t,e){e===void 0&&(e=0);var r=G1(t,e),n=G1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Oe.readInt64LE=w9;function E9(t,e){e===void 0&&(e=0);var r=j1(t,e),n=j1(t,e+4);return n*4294967296+r}Oe.readUint64LE=E9;function TD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fp(t/4294967296>>>0,e,r),fp(t>>>0,e,r+4),e}Oe.writeUint64BE=TD;Oe.writeInt64BE=TD;function CD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),dp(t>>>0,e,r),dp(t/4294967296>>>0,e,r+4),e}Oe.writeUint64LE=CD;Oe.writeInt64LE=CD;function v9(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}Oe.readUintBE=v9;function A9(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}Oe.writeUintBE=b9;function I9(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(!ID.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";l();Object.defineProperty(er,"__esModule",{value:!0});er.randomStringForEntropy=er.randomString=er.randomUint32=er.randomBytes=er.defaultRandomSource=void 0;var P9=AD(),R9=qa(),xD=Hr();er.defaultRandomSource=new P9.SystemRandomSource;function Q1(t,e=er.defaultRandomSource){return e.randomBytes(t)}er.randomBytes=Q1;function B9(t=er.defaultRandomSource){let e=Q1(4,t),r=(0,R9.readUint32LE)(e);return(0,xD.wipe)(e),r}er.randomUint32=B9;var ND="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function OD(t,e=ND,r=er.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=Q1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(ni,"__esModule",{value:!0});var Ha=qa(),Va=Hr();ni.DIGEST_LENGTH=64;ni.BLOCK_SIZE=128;var PD=function(){function t(){this.digestLength=ni.DIGEST_LENGTH,this.blockSize=ni.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(){Va.wipe(this._buffer),Va.wipe(this._tempHi),Va.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&&(z1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=z1(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){Va.wipe(e.stateHi),Va.wipe(e.stateLo),e.buffer&&Va.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();ni.SHA512=PD;var DD=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 z1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],c=r[2],f=r[3],d=r[4],g=r[5],m=r[6],y=r[7],b=n[0],O=n[1],R=n[2],z=n[3],M=n[4],E=n[5],S=n[6],N=n[7],_,T,B,X,Q,H,j,K;o>=128;){for(var me=0;me<16;me++){var ce=8*me+s;t[me]=Ha.readUint32BE(i,ce),e[me]=Ha.readUint32BE(i,ce+4)}for(var me=0;me<80;me++){var ie=a,J=u,oe=c,re=f,se=d,U=g,fe=m,ue=y,de=b,ae=O,le=R,w=z,v=M,I=E,P=S,C=N;if(_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(d>>>14|M<<18)^(d>>>18|M<<14)^(M>>>9|d<<23),T=(M>>>14|d<<18)^(M>>>18|d<<14)^(d>>>9|M<<23),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=d&g^~d&m,T=M&E^~M&S,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=DD[me*2],T=DD[me*2+1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=t[me%16],T=e[me%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,B=j&65535|K<<16,X=Q&65535|H<<16,_=B,T=X,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=(a>>>28|b<<4)^(b>>>2|a<<30)^(b>>>7|a<<25),T=(b>>>28|a<<4)^(a>>>2|b<<30)^(a>>>7|b<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,_=a&u^a&c^u&c,T=b&O^b&R^O&R,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,ue=j&65535|K<<16,C=Q&65535|H<<16,_=re,T=w,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=B,T=X,Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,re=j&65535|K<<16,w=Q&65535|H<<16,u=ie,c=J,f=oe,d=re,g=se,m=U,y=fe,a=ue,O=de,R=ae,z=le,M=w,E=v,S=I,N=P,b=C,me%16===15)for(var ce=0;ce<16;ce++)_=t[ce],T=e[ce],Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=t[(ce+9)%16],T=e[(ce+9)%16],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+1)%16],X=e[(ce+1)%16],_=(B>>>1|X<<31)^(B>>>8|X<<24)^B>>>7,T=(X>>>1|B<<31)^(X>>>8|B<<24)^(X>>>7|B<<25),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,B=t[(ce+14)%16],X=e[(ce+14)%16],_=(B>>>19|X<<13)^(X>>>29|B<<3)^B>>>6,T=(X>>>19|B<<13)^(B>>>29|X<<3)^(X>>>6|B<<26),Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,t[ce]=j&65535|K<<16,e[ce]=Q&65535|H<<16}_=a,T=b,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[0],T=n[0],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[0]=a=j&65535|K<<16,n[0]=b=Q&65535|H<<16,_=u,T=O,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[1],T=n[1],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[1]=u=j&65535|K<<16,n[1]=O=Q&65535|H<<16,_=c,T=R,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[2],T=n[2],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[2]=c=j&65535|K<<16,n[2]=R=Q&65535|H<<16,_=f,T=z,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[3],T=n[3],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[3]=f=j&65535|K<<16,n[3]=z=Q&65535|H<<16,_=d,T=M,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[4],T=n[4],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[4]=d=j&65535|K<<16,n[4]=M=Q&65535|H<<16,_=g,T=E,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[5],T=n[5],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[5]=g=j&65535|K<<16,n[5]=E=Q&65535|H<<16,_=m,T=S,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[6],T=n[6],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[6]=m=j&65535|K<<16,n[6]=S=Q&65535|H<<16,_=y,T=N,Q=T&65535,H=T>>>16,j=_&65535,K=_>>>16,_=r[7],T=n[7],Q+=T&65535,H+=T>>>16,j+=_&65535,K+=_>>>16,H+=Q>>>16,j+=H>>>16,K+=j>>>16,r[7]=y=j&65535|K<<16,n[7]=N=Q&65535|H<<16,s+=128,o-=128}return s}function F9(t){var e=new PD;e.update(t);var r=e.digest();return e.clean(),r}ni.hash=F9});var WD=A(ke=>{"use strict";l();Object.defineProperty(ke,"__esModule",{value:!0});ke.convertSecretKeyToX25519=ke.convertPublicKeyToX25519=ke.verify=ke.sign=ke.extractPublicKeyFromSecretKey=ke.generateKeyPair=ke.generateKeyPairFromSeed=ke.SEED_LENGTH=ke.SECRET_KEY_LENGTH=ke.PUBLIC_KEY_LENGTH=ke.SIGNATURE_LENGTH=void 0;var M9=cl(),ll=RD(),UD=Hr();ke.SIGNATURE_LENGTH=64;ke.PUBLIC_KEY_LENGTH=32;ke.SECRET_KEY_LENGTH=64;ke.SEED_LENGTH=32;function Te(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,qD(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 VD(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function FD(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return fl(r,t),fl(n,e),VD(r,n)}function HD(t){let e=new Uint8Array(32);return fl(e,t),e[0]&1}function k9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function eo(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ro(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $e(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,b=0,O=0,R=0,z=0,M=0,E=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],v=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*v,b+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,E+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,b+=n*v,O+=n*I,R+=n*P,z+=n*C,M+=n*D,E+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,b+=n*w,O+=n*v,R+=n*I,z+=n*P,M+=n*C,E+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,b+=n*le,O+=n*w,R+=n*v,z+=n*I,M+=n*P,E+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,b+=n*ae,O+=n*le,R+=n*w,z+=n*v,M+=n*I,E+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,b+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*v,E+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,b+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,E+=n*v,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,b+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,E+=n*w,S+=n*v,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,b+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,E+=n*le,S+=n*w,N+=n*v,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,b+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,E+=n*ae,S+=n*le,N+=n*w,_+=n*v,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],b+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,E+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*v,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,E+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*v,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,E+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*v,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,E+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*v,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,E+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*v,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],E+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*v,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,b+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=b,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=E}function to(t,e){$e(t,e,e)}function kD(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)to(r,r),n!==2&&n!==4&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function G9(t,e){let r=Te(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)to(r,r),n!==1&&$e(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function Y1(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te(),c=Te(),f=Te();ro(r,t[1],t[0]),ro(f,e[1],e[0]),$e(r,r,f),eo(n,t[0],t[1]),eo(f,e[0],e[1]),$e(n,n,f),$e(i,t[3],e[3]),$e(i,i,V9),$e(s,t[2],e[2]),eo(s,s,s),ro(o,n,r),ro(a,s,i),eo(u,s,i),eo(c,n,r),$e(t[0],o,a),$e(t[1],c,u),$e(t[2],u,a),$e(t[3],o,c)}function MD(t,e,r){for(let n=0;n<4;n++)qD(t[n],e[n],r)}function X1(t,e){let r=Te(),n=Te(),i=Te();kD(i,e[2]),$e(r,e[0],i),$e(n,e[1],i),fl(t,n),t[31]^=HD(r)<<7}function GD(t,e,r){Wi(t[0],K1),Wi(t[1],ka),Wi(t[2],ka),Wi(t[3],K1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;MD(t,e,i),Y1(e,t),Y1(t,t),MD(t,e,i)}}function Z1(t,e){let r=[Te(),Te(),Te(),Te()];Wi(r[0],BD),Wi(r[1],LD),Wi(r[2],ka),$e(r[3],BD,LD),GD(t,r,e)}function jD(t){if(t.length!==ke.SEED_LENGTH)throw new Error(`ed25519: seed must be ${ke.SEED_LENGTH} bytes`);let e=(0,ll.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Te(),Te(),Te(),Te()];Z1(n,e),X1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}ke.generateKeyPairFromSeed=jD;function j9(t){let e=(0,M9.randomBytes)(32,t),r=jD(e);return(0,UD.wipe)(e),r}ke.generateKeyPair=j9;function Q9(t){if(t.length!==ke.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${ke.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}ke.extractPublicKeyFromSecretKey=Q9;var $1=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 QD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*$1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*$1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function J1(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;QD(t,e)}function z9(t,e){let r=new Float64Array(64),n=[Te(),Te(),Te(),Te()],i=(0,ll.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 ll.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),J1(a),Z1(n,a),X1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();J1(u);for(let c=0;c<32;c++)r[c]=a[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=u[c]*i[f];return QD(s.subarray(32),r),s}ke.sign=z9;function zD(t,e){let r=Te(),n=Te(),i=Te(),s=Te(),o=Te(),a=Te(),u=Te();return Wi(t[2],ka),k9(t[1],e),to(i,t[1]),$e(s,i,q9),ro(i,i,t[2]),eo(s,t[2],s),to(o,s),to(a,o),$e(u,a,o),$e(r,u,i),$e(r,r,s),G9(r,r),$e(r,r,i),$e(r,r,s),$e(r,r,s),$e(t[0],r,s),to(n,t[0]),$e(n,n,s),FD(n,i)&&$e(t[0],t[0],H9),to(n,t[0]),$e(n,n,s),FD(n,i)?-1:(HD(t[0])===e[31]>>7&&ro(t[0],K1,t[0]),$e(t[3],t[0],t[1]),0)}function W9(t,e,r){let n=new Uint8Array(32),i=[Te(),Te(),Te(),Te()],s=[Te(),Te(),Te(),Te()];if(r.length!==ke.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${ke.SIGNATURE_LENGTH} bytes`);if(zD(s,t))return!1;let o=new ll.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return J1(a),GD(i,s,a),Z1(s,r.subarray(32)),Y1(i,s),X1(n,i),!VD(r,n)}ke.verify=W9;function $9(t){let e=[Te(),Te(),Te(),Te()];if(zD(e,t))throw new Error("Ed25519: invalid public key");let r=Te(),n=Te(),i=e[1];eo(r,ka,i),ro(n,ka,i),kD(n,n),$e(r,r,n);let s=new Uint8Array(32);return fl(s,r),s}ke.convertPublicKeyToX25519=$9;function K9(t){let e=(0,ll.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,UD.wipe)(e),r}ke.convertSecretKeyToX25519=K9});var hp,pp,no,Ga,gp,dl,yp,mp,wp,ja,Ep,vp,$D,KD,Ap=he(()=>{l();hp="EdDSA",pp="JWT",no=".",Ga="base64url",gp="utf8",dl="utf8",yp=":",mp="did",wp="key",ja="base58btc",Ep="z",vp="K36",$D=32,KD=32});function $i(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var hl=he(()=>{l()});function Qa(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?$i(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var bp=he(()=>{l();hl()});function Ip(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Qa(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return $i(r)}var eA=he(()=>{l();bp();hl()});function Y9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,E=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,E[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&E[T]===0;)T++;for(var B=u.repeat(b);T>>0,M=new Uint8Array(z);y[b];){var E=r[y.charCodeAt(b)];if(E===255)return;for(var S=0,N=z-1;(E!==0||S>>0,M[N]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");R=S,b++}if(y[b]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var b=g(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var J9,X9,YD,JD=he(()=>{l();J9=Y9,X9=J9,YD=X9});var yhe,XD,ii,ZD,eP,Ki=he(()=>{l();yhe=new Uint8Array(0),XD=(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")},ZD=t=>new TextEncoder().encode(t),eP=t=>new TextDecoder().decode(t)});var tA,rA,nA,rP,iA,za,Yi,Z9,ez,yt,tn=he(()=>{l();JD();Ki();tA=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")}},rA=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 rP(this,e)}},nA=class{constructor(e){this.decoders=e}or(e){return rP(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`)}},rP=(t,e)=>new nA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),iA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new tA(e,r,n),this.decoder=new rA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},za=({name:t,prefix:e,encode:r,decode:n})=>new iA(t,e,r,n),Yi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=YD(r,e);return za({prefix:t,name:e,encode:n,decode:s=>ii(i(s))})},Z9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},ez=(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<za({prefix:e,name:t,encode(i){return ez(i,n,r)},decode(i){return Z9(i,n,r,t)}})});var sA={};ft(sA,{identity:()=>tz});var tz,nP=he(()=>{l();tn();Ki();tz=za({prefix:"\0",name:"identity",encode:t=>eP(t),decode:t=>ZD(t)})});var oA={};ft(oA,{base2:()=>rz});var rz,iP=he(()=>{l();tn();rz=yt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var aA={};ft(aA,{base8:()=>nz});var nz,sP=he(()=>{l();tn();nz=yt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var uA={};ft(uA,{base10:()=>iz});var iz,oP=he(()=>{l();tn();iz=Yi({prefix:"9",name:"base10",alphabet:"0123456789"})});var cA={};ft(cA,{base16:()=>sz,base16upper:()=>oz});var sz,oz,aP=he(()=>{l();tn();sz=yt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),oz=yt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var lA={};ft(lA,{base32:()=>Wa,base32hex:()=>lz,base32hexpad:()=>dz,base32hexpadupper:()=>hz,base32hexupper:()=>fz,base32pad:()=>uz,base32padupper:()=>cz,base32upper:()=>az,base32z:()=>pz});var Wa,az,uz,cz,lz,fz,dz,hz,pz,fA=he(()=>{l();tn();Wa=yt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),az=yt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uz=yt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cz=yt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lz=yt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fz=yt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),dz=yt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),hz=yt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),pz=yt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var dA={};ft(dA,{base36:()=>gz,base36upper:()=>yz});var gz,yz,uP=he(()=>{l();tn();gz=Yi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),yz=Yi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var hA={};ft(hA,{base58btc:()=>Nn,base58flickr:()=>mz});var Nn,mz,pA=he(()=>{l();tn();Nn=Yi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mz=Yi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var gA={};ft(gA,{base64:()=>wz,base64pad:()=>Ez,base64url:()=>vz,base64urlpad:()=>Az});var wz,Ez,vz,Az,cP=he(()=>{l();tn();wz=yt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ez=yt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vz=yt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Az=yt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var yA={};ft(yA,{base256emoji:()=>Tz});function _z(t){return t.reduce((e,r)=>(e+=bz[r],e),"")}function Sz(t){let e=[];for(let r of t){let n=Iz[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var lP,bz,Iz,Tz,fP=he(()=>{l();tn();lP=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}"),bz=lP.reduce((t,e,r)=>(t[r]=e,t),[]),Iz=lP.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);Tz=za({prefix:"\u{1F680}",name:"base256emoji",encode:_z,decode:Sz})});function pP(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Oz;)e[r++]=t&255|dP,t/=128;for(;t&Nz;)e[r++]=t&255|dP,t>>>=7;return e[r]=t|0,pP.bytes=r-n+1,e}function mA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw mA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&hP)<=Pz);return mA.bytes=s-n,r}var Cz,dP,xz,Nz,Oz,Dz,Pz,hP,Rz,Bz,Lz,Fz,Mz,Uz,qz,Vz,Hz,kz,Gz,jz,pl,gP=he(()=>{l();Cz=pP,dP=128,xz=127,Nz=~xz,Oz=Math.pow(2,31);Dz=mA,Pz=128,hP=127;Rz=Math.pow(2,7),Bz=Math.pow(2,14),Lz=Math.pow(2,21),Fz=Math.pow(2,28),Mz=Math.pow(2,35),Uz=Math.pow(2,42),qz=Math.pow(2,49),Vz=Math.pow(2,56),Hz=Math.pow(2,63),kz=function(t){return t{l();gP();gl=(t,e=0)=>[pl.decode(t,e),pl.decode.bytes],$a=(t,e,r=0)=>(pl.encode(t,e,r),e),Ka=t=>pl.encodingLength(t)});var io,yP,mP,Ya,ml=he(()=>{l();Ki();Sp();io=(t,e)=>{let r=e.byteLength,n=Ka(t),i=n+Ka(r),s=new Uint8Array(i+r);return $a(t,s,0),$a(r,s,n),s.set(e,i),new Ya(t,r,e,s)},yP=t=>{let e=ii(t),[r,n]=gl(e),[i,s]=gl(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ya(r,i,o,e)},mP=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&XD(t.bytes,e.bytes),Ya=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var EA,wA,vA=he(()=>{l();ml();EA=({name:t,code:e,encode:r})=>new wA(t,e,r),wA=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?io(this.code,r):r.then(n=>io(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var AA={};ft(AA,{sha256:()=>Qz,sha512:()=>zz});var EP,Qz,zz,vP=he(()=>{l();vA();EP=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Qz=EA({name:"sha2-256",code:18,encode:EP("SHA-256")}),zz=EA({name:"sha2-512",code:19,encode:EP("SHA-512")})});var bA={};ft(bA,{identity:()=>Kz});var AP,Wz,bP,$z,Kz,IP=he(()=>{l();Ki();ml();AP=0,Wz="identity",bP=ii,$z=t=>io(AP,bP(t)),Kz={code:AP,name:Wz,encode:bP,digest:$z}});var _P=he(()=>{l();Ki()});var rpe,npe,SP=he(()=>{l();rpe=new TextEncoder,npe=new TextDecoder});var xp,Xz,Zz,eW,wl,tW,TP,CP,Tp,Cp,rW,nW,iW,xP=he(()=>{l();Sp();ml();pA();fA();Ki();xp=class t{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:Cp,byteLength:Cp,code:Tp,version:Tp,multihash:Tp,bytes:Tp,_baseCache:Cp,asCID:Cp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==wl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==tW)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=io(e,r);return t.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&&mP(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return Zz(r,i,e||Nn.encoder);default:return eW(r,i,e||Wa.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 nW(/^0\.0/,iW),!!(e&&(e[CP]||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 t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||TP(r,n,i.bytes))}else if(e!=null&&e[CP]===!0){let{version:r,multihash:n,code:i}=e,s=yP(n);return t.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!==wl)throw new Error(`Version 0 CID must use dag-pb (code: ${wl}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=TP(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,wl,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=ii(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 Ya(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,g]=gl(e.subarray(r));return r+=g,d},i=n(),s=wl;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(),c=r+u,f=c-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=Xz(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Xz=(t,e)=>{switch(t[0]){case"Q":{let r=e||Nn;return[Nn.prefix,r.decode(`${Nn.prefix}${t}`)]}case Nn.prefix:{let r=e||Nn;return[Nn.prefix,r.decode(t)]}case Wa.prefix:{let r=e||Wa;return[Wa.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)]}}},Zz=(t,e,r)=>{let{prefix:n}=r;if(n!==Nn.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},eW=(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},wl=112,tW=18,TP=(t,e,r)=>{let n=Ka(t),i=n+Ka(e),s=new Uint8Array(i+r.byteLength);return $a(t,s,0),$a(e,s,n),s.set(r,i),s},CP=Symbol.for("@ipld/js-cid/CID"),Tp={writable:!1,configurable:!1,enumerable:!0},Cp={writable:!1,enumerable:!1,configurable:!1},rW="0.0.0-dev",nW=(t,e)=>{if(t.test(rW))console.warn(e);else throw new Error(e)},iW=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -18,35 +18,35 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var bP=he(()=>{l();AP();Sp();$i();yA();ml()});var EA,tpe,IP=he(()=>{l();YD();JD();XD();ZD();eP();aA();tP();lA();rP();iP();hP();yP();mP();wP();bP();EA={...tA,...rA,...nA,...iA,...sA,...oA,...uA,...cA,...fA,...dA},tpe={...mA,...wA}});function SP(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var _P,vA,Wz,Np,AA=he(()=>{l();IP();bp();_P=SP("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),vA=SP("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ga(t.length);for(let r=0;r{l();AA()});function On(t,e="utf8"){let r=Np[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var IA=he(()=>{l();AA();hl()});function El(t){return ji(si(On(t,Ha),gp))}function vl(t){return si(On(Qi(t),gp),Ha)}function _A(t){let e=On(vp,ka),r=Ep+si(Ip([e,t]),ka);return[mp,wp,r].join(yp)}function SA(t){let[e,r,n]=t.split(yp);if(e!==mp||r!==wp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==Ep)throw new Error("Issuer must be a key in mulicodec format");let s=On(n.slice(1),ka);if(si(s.slice(0,2),ka)!==vp)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 TP(t){return si(t,Ha)}function CP(t){return On(t,Ha)}function TA(t){return On([vl(t.header),vl(t.payload)].join(no),dl)}function $z(t){let e=si(t,dl).split(no),r=El(e[0]),n=El(e[1]);return{header:r,payload:n}}function CA(t){return[vl(t.header),vl(t.payload),TP(t.signature)].join(no)}function xA(t){let e=t.split(no),r=El(e[0]),n=El(e[1]),i=CP(e[2]),s=On(e.slice(0,2).join(no),dl);return{header:r,payload:n,signature:i,data:s}}var NA=he(()=>{l();Y1();bA();IA();nl();Ap()});function Kz(t=(0,xP.randomBytes)(32)){return Ka.generateKeyPairFromSeed(t)}async function Yz(t,e,r,n,i=(0,NP.fromMiliseconds)(Date.now())){let s={alg:hp,typ:pp},o=_A(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},c=TA({header:s,payload:u}),f=Ka.sign(n.secretKey,c);return CA({header:s,payload:u,signature:f})}async function Jz(t){let{header:e,payload:r,data:n,signature:i}=xA(t);if(e.alg!==hp||e.typ!==pp)throw new Error("JWT must use EdDSA algorithm");let s=SA(r.iss);return Ka.verify(s,n,i)}var Ka,xP,NP,OP=he(()=>{l();Ka=Se(VD()),xP=Se(cl()),NP=Se(Zs());Ap();NA()});var DP=he(()=>{l()});var PP={};ft(PP,{DATA_ENCODING:()=>dl,DID_DELIMITER:()=>yp,DID_METHOD:()=>wp,DID_PREFIX:()=>mp,JSON_ENCODING:()=>gp,JWT_DELIMITER:()=>no,JWT_ENCODING:()=>Ha,JWT_IRIDIUM_ALG:()=>hp,JWT_IRIDIUM_TYP:()=>pp,KEY_PAIR_SEED_LENGTH:()=>kD,MULTICODEC_ED25519_BASE:()=>Ep,MULTICODEC_ED25519_ENCODING:()=>ka,MULTICODEC_ED25519_HEADER:()=>vp,MULTICODEC_ED25519_LENGTH:()=>HD,decodeData:()=>$z,decodeIss:()=>SA,decodeJSON:()=>El,decodeJWT:()=>xA,decodeSig:()=>CP,encodeData:()=>TA,encodeIss:()=>_A,encodeJSON:()=>vl,encodeJWT:()=>CA,encodeSig:()=>TP,generateKeyPair:()=>Kz,signJWT:()=>Yz,verifyJWT:()=>Jz});var RP=he(()=>{l();OP();Ap();DP();NA()});var LP=v(Op=>{"use strict";l();Object.defineProperty(Op,"__esModule",{value:!0});var tr=Ma(),OA=Hr(),Xz=20;function Zz(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],c=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],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],A=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],R=e[11]<<24|e[10]<<16|e[9]<<8|e[8],z=e[15]<<24|e[14]<<16|e[13]<<8|e[12],M=n,b=i,S=s,N=o,_=a,T=u,B=c,X=f,Q=d,H=g,j=m,K=y,me=A,ce=O,ie=R,J=z,oe=0;oe>>16|me<<16,Q=Q+me|0,_^=Q,_=_>>>20|_<<12,b=b+T|0,ce^=b,ce=ce>>>16|ce<<16,H=H+ce|0,T^=H,T=T>>>20|T<<12,S=S+B|0,ie^=S,ie=ie>>>16|ie<<16,j=j+ie|0,B^=j,B=B>>>20|B<<12,N=N+X|0,J^=N,J=J>>>16|J<<16,K=K+J|0,X^=K,X=X>>>20|X<<12,S=S+B|0,ie^=S,ie=ie>>>24|ie<<8,j=j+ie|0,B^=j,B=B>>>25|B<<7,N=N+X|0,J^=N,J=J>>>24|J<<8,K=K+J|0,X^=K,X=X>>>25|X<<7,b=b+T|0,ce^=b,ce=ce>>>24|ce<<8,H=H+ce|0,T^=H,T=T>>>25|T<<7,M=M+_|0,me^=M,me=me>>>24|me<<8,Q=Q+me|0,_^=Q,_=_>>>25|_<<7,M=M+T|0,J^=M,J=J>>>16|J<<16,j=j+J|0,T^=j,T=T>>>20|T<<12,b=b+B|0,me^=b,me=me>>>16|me<<16,K=K+me|0,B^=K,B=B>>>20|B<<12,S=S+X|0,ce^=S,ce=ce>>>16|ce<<16,Q=Q+ce|0,X^=Q,X=X>>>20|X<<12,N=N+_|0,ie^=N,ie=ie>>>16|ie<<16,H=H+ie|0,_^=H,_=_>>>20|_<<12,S=S+X|0,ce^=S,ce=ce>>>24|ce<<8,Q=Q+ce|0,X^=Q,X=X>>>25|X<<7,N=N+_|0,ie^=N,ie=ie>>>24|ie<<8,H=H+ie|0,_^=H,_=_>>>25|_<<7,b=b+B|0,me^=b,me=me>>>24|me<<8,K=K+me|0,B^=K,B=B>>>25|B<<7,M=M+T|0,J^=M,J=J>>>24|J<<8,j=j+J|0,T^=j,T=T>>>25|T<<7;tr.writeUint32LE(M+n|0,t,0),tr.writeUint32LE(b+i|0,t,4),tr.writeUint32LE(S+s|0,t,8),tr.writeUint32LE(N+o|0,t,12),tr.writeUint32LE(_+a|0,t,16),tr.writeUint32LE(T+u|0,t,20),tr.writeUint32LE(B+c|0,t,24),tr.writeUint32LE(X+f|0,t,28),tr.writeUint32LE(Q+d|0,t,32),tr.writeUint32LE(H+g|0,t,36),tr.writeUint32LE(j+m|0,t,40),tr.writeUint32LE(K+y|0,t,44),tr.writeUint32LE(me+A|0,t,48),tr.writeUint32LE(ce+O|0,t,52),tr.writeUint32LE(ie+R|0,t,56),tr.writeUint32LE(J+z|0,t,60)}function BP(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 Dp=v(Ya=>{"use strict";l();Object.defineProperty(Ya,"__esModule",{value:!0});function rW(t,e,r){return~(t-1)&e|t-1&r}Ya.select=rW;function nW(t,e){return(t|0)-(e|0)-1>>>31&1}Ya.lessOrEqual=nW;function FP(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Ya.compare=FP;function iW(t,e){return t.length===0||e.length===0?!1:FP(t,e)!==0}Ya.equal=iW});var UP=v(oi=>{"use strict";l();Object.defineProperty(oi,"__esModule",{value:!0});var sW=Dp(),Pp=Hr();oi.DIGEST_LENGTH=16;var MP=function(){function t(e){this.digestLength=oi.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 c=e[14]|e[15]<<8;this._r[8]=(u>>>8|c<<8)&8191,this._r[9]=c>>>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],c=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],m=this._h[8],y=this._h[9],A=this._r[0],O=this._r[1],R=this._r[2],z=this._r[3],M=this._r[4],b=this._r[5],S=this._r[6],N=this._r[7],_=this._r[8],T=this._r[9];n>=16;){var B=e[r+0]|e[r+1]<<8;s+=B&8191;var X=e[r+2]|e[r+3]<<8;o+=(B>>>13|X<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(X>>>10|Q<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(Q>>>7|H<<9)&8191;var j=e[r+8]|e[r+9]<<8;c+=(H>>>4|j<<12)&8191,f+=j>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(j>>>14|K<<2)&8191;var me=e[r+12]|e[r+13]<<8;g+=(K>>>11|me<<5)&8191;var ce=e[r+14]|e[r+15]<<8;m+=(me>>>8|ce<<8)&8191,y+=ce>>>5|i;var ie=0,J=ie;J+=s*A,J+=o*(5*T),J+=a*(5*_),J+=u*(5*N),J+=c*(5*S),ie=J>>>13,J&=8191,J+=f*(5*b),J+=d*(5*M),J+=g*(5*z),J+=m*(5*R),J+=y*(5*O),ie+=J>>>13,J&=8191;var oe=ie;oe+=s*O,oe+=o*A,oe+=a*(5*T),oe+=u*(5*_),oe+=c*(5*N),ie=oe>>>13,oe&=8191,oe+=f*(5*S),oe+=d*(5*b),oe+=g*(5*M),oe+=m*(5*z),oe+=y*(5*R),ie+=oe>>>13,oe&=8191;var re=ie;re+=s*R,re+=o*O,re+=a*A,re+=u*(5*T),re+=c*(5*_),ie=re>>>13,re&=8191,re+=f*(5*N),re+=d*(5*S),re+=g*(5*b),re+=m*(5*M),re+=y*(5*z),ie+=re>>>13,re&=8191;var se=ie;se+=s*z,se+=o*R,se+=a*O,se+=u*A,se+=c*(5*T),ie=se>>>13,se&=8191,se+=f*(5*_),se+=d*(5*N),se+=g*(5*S),se+=m*(5*b),se+=y*(5*M),ie+=se>>>13,se&=8191;var U=ie;U+=s*M,U+=o*z,U+=a*R,U+=u*O,U+=c*A,ie=U>>>13,U&=8191,U+=f*(5*T),U+=d*(5*_),U+=g*(5*N),U+=m*(5*S),U+=y*(5*b),ie+=U>>>13,U&=8191;var fe=ie;fe+=s*b,fe+=o*M,fe+=a*z,fe+=u*R,fe+=c*O,ie=fe>>>13,fe&=8191,fe+=f*A,fe+=d*(5*T),fe+=g*(5*_),fe+=m*(5*N),fe+=y*(5*S),ie+=fe>>>13,fe&=8191;var ue=ie;ue+=s*S,ue+=o*b,ue+=a*M,ue+=u*z,ue+=c*R,ie=ue>>>13,ue&=8191,ue+=f*O,ue+=d*A,ue+=g*(5*T),ue+=m*(5*_),ue+=y*(5*N),ie+=ue>>>13,ue&=8191;var de=ie;de+=s*N,de+=o*S,de+=a*b,de+=u*M,de+=c*z,ie=de>>>13,de&=8191,de+=f*R,de+=d*O,de+=g*A,de+=m*(5*T),de+=y*(5*_),ie+=de>>>13,de&=8191;var ae=ie;ae+=s*_,ae+=o*N,ae+=a*S,ae+=u*b,ae+=c*M,ie=ae>>>13,ae&=8191,ae+=f*z,ae+=d*R,ae+=g*O,ae+=m*A,ae+=y*(5*T),ie+=ae>>>13,ae&=8191;var le=ie;le+=s*T,le+=o*_,le+=a*N,le+=u*S,le+=c*b,ie=le>>>13,le&=8191,le+=f*M,le+=d*z,le+=g*R,le+=m*O,le+=y*A,ie+=le>>>13,le&=8191,ie=(ie<<2)+ie|0,ie=ie+J|0,J=ie&8191,ie=ie>>>13,oe+=ie,s=J,o=oe,a=re,u=se,c=U,f=fe,d=ue,g=de,m=ae,y=le,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=c,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=m,this._h[9]=y},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";l();Object.defineProperty(ai,"__esModule",{value:!0});var Rp=LP(),uW=UP(),Al=Hr(),qP=Ma(),cW=Dp();ai.KEY_LENGTH=32;ai.NONCE_LENGTH=12;ai.TAG_LENGTH=16;var VP=new Uint8Array(16),lW=function(){function t(e){if(this.nonceLength=ai.NONCE_LENGTH,this.tagLength=ai.TAG_LENGTH,e.length!==ai.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);Rp.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 Rp.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),Al.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(VP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(VP.subarray(n.length%16));var o=new Uint8Array(8);i&&qP.writeUint64LE(i.length,o),s.update(o),qP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(DA,"__esModule",{value:!0});function fW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}DA.isSerializableHash=fW});var jP=v(bl=>{"use strict";l();Object.defineProperty(bl,"__esModule",{value:!0});var Dn=kP(),dW=Dp(),hW=Hr(),GP=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";l();Object.defineProperty(PA,"__esModule",{value:!0});var QP=jP(),zP=Hr(),gW=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=QP.hmac(this._hash,n,r);this._hmac=new QP.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";l();Object.defineProperty(Yi,"__esModule",{value:!0});var Lp=Ma(),Bp=Hr();Yi.DIGEST_LENGTH=32;Yi.BLOCK_SIZE=64;var $P=function(){function t(){this.digestLength=Yi.DIGEST_LENGTH,this.blockSize=Yi.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(){Bp.wipe(this._buffer),Bp.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&&(RA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=RA(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){Bp.wipe(e.state),e.buffer&&Bp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Yi.SHA256=$P;var yW=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 RA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],c=e[4],f=e[5],d=e[6],g=e[7],m=0;m<16;m++){var y=n+m*4;t[m]=Lp.readUint32BE(r,y)}for(var m=16;m<64;m++){var A=t[m-2],O=(A>>>17|A<<15)^(A>>>19|A<<13)^A>>>10;A=t[m-15];var R=(A>>>7|A<<25)^(A>>>18|A<<14)^A>>>3;t[m]=(O+t[m-7]|0)+(R+t[m-16]|0)}for(var m=0;m<64;m++){var O=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&d)|0)+(g+(yW[m]+t[m]|0)|0)|0,R=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&a^o&a)|0;g=d,d=f,f=c,c=u+O|0,u=a,a=o,o=s,s=O+R|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function mW(t){var e=new $P;e.update(t);var r=e.digest();return e.clean(),r}Yi.hash=mW});var ZP=v(mt=>{"use strict";l();Object.defineProperty(mt,"__esModule",{value:!0});mt.sharedKey=mt.generateKeyPair=mt.generateKeyPairFromSeed=mt.scalarMultBase=mt.scalarMult=mt.SHARED_KEY_LENGTH=mt.SECRET_KEY_LENGTH=mt.PUBLIC_KEY_LENGTH=void 0;var wW=cl(),EW=Hr();mt.PUBLIC_KEY_LENGTH=32;mt.SECRET_KEY_LENGTH=32;mt.SHARED_KEY_LENGTH=32;function Pn(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,Il(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 bW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Mp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ui(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,A=0,O=0,R=0,z=0,M=0,b=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],E=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*E,A+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,b+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,A+=n*E,O+=n*I,R+=n*P,z+=n*C,M+=n*D,b+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,A+=n*w,O+=n*E,R+=n*I,z+=n*P,M+=n*C,b+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,A+=n*le,O+=n*w,R+=n*E,z+=n*I,M+=n*P,b+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,A+=n*ae,O+=n*le,R+=n*w,z+=n*E,M+=n*I,b+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,A+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*E,b+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,A+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,b+=n*E,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,A+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,b+=n*w,S+=n*E,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,A+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,b+=n*le,S+=n*w,N+=n*E,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,A+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,b+=n*ae,S+=n*le,N+=n*w,_+=n*E,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],A+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,b+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*E,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,b+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*E,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,b+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*E,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,b+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*E,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,b+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*E,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],b+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*E,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,A+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=A,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=b}function _l(t,e){ui(t,e,e)}function IW(t,e){let r=Pn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)_l(r,r),n!==2&&n!==4&&ui(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function LA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Pn(),s=Pn(),o=Pn(),a=Pn(),u=Pn(),c=Pn();for(let m=0;m<31;m++)r[m]=t[m];r[31]=t[31]&127|64,r[0]&=248,bW(n,e);for(let m=0;m<16;m++)s[m]=n[m];i[0]=a[0]=1;for(let m=254;m>=0;--m){let y=r[m>>>3]>>>(m&7)&1;Il(i,s,y),Il(o,a,y),Fp(u,i,o),Mp(i,i,o),Fp(o,s,a),Mp(s,s,a),_l(a,u),_l(c,i),ui(i,o,i),ui(o,s,u),Fp(u,i,o),Mp(i,i,o),_l(s,i),Mp(o,a,c),ui(i,o,vW),Fp(i,i,a),ui(o,o,i),ui(i,a,c),ui(a,s,n),_l(s,u),Il(i,s,y),Il(o,a,y)}for(let m=0;m<16;m++)n[m+16]=i[m],n[m+32]=o[m],n[m+48]=s[m],n[m+64]=a[m];let f=n.subarray(32),d=n.subarray(16);IW(f,f),ui(d,d,f);let g=new Uint8Array(32);return AW(g,d),g}mt.scalarMult=LA;function JP(t){return LA(t,YP)}mt.scalarMultBase=JP;function XP(t){if(t.length!==mt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${mt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:JP(e),secretKey:e}}mt.generateKeyPairFromSeed=XP;function _W(t){let e=(0,wW.randomBytes)(32,t),r=XP(e);return(0,EW.wipe)(e),r}mt.generateKeyPair=_W;function SW(t,e,r=!1){if(t.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=LA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{l()});function rR(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{l()});function iR(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ga(t.length);for(let n=0;n{l();bp();hl()});var FA={};ft(FA,{compare:()=>eR,concat:()=>Ip,equals:()=>rR,fromString:()=>On,toString:()=>si,xor:()=>iR});var MA=he(()=>{l();tR();Y1();nR();IA();bA();sR()});var mR=v(ut=>{"use strict";l();var oR=ut&&ut.__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 hR:typeof navigator<"u"?UA(navigator.userAgent):yR()}ut.detect=NW;function pR(t){return t!==""&&xW.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 OW(t){var e=pR(t);return e?e[0]:null}ut.browserName=OW;function UA(t){var e=pR(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new dR;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";l();Object.defineProperty(et,"__esModule",{value:!0});et.getLocalStorage=et.getLocalStorageOrThrow=et.getCrypto=et.getCryptoOrThrow=et.getLocation=et.getLocationOrThrow=et.getNavigator=et.getNavigatorOrThrow=et.getDocument=et.getDocumentOrThrow=et.getFromWindowOrThrow=et.getFromWindow=void 0;function so(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}et.getFromWindow=so;function Ja(t){let e=so(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}et.getFromWindowOrThrow=Ja;function PW(){return Ja("document")}et.getDocumentOrThrow=PW;function RW(){return so("document")}et.getDocument=RW;function BW(){return Ja("navigator")}et.getNavigatorOrThrow=BW;function LW(){return so("navigator")}et.getNavigator=LW;function FW(){return Ja("location")}et.getLocationOrThrow=FW;function MW(){return so("location")}et.getLocation=MW;function UW(){return Ja("crypto")}et.getCryptoOrThrow=UW;function qW(){return so("crypto")}et.getCrypto=qW;function VW(){return Ja("localStorage")}et.getLocalStorageOrThrow=VW;function HW(){return so("localStorage")}et.getLocalStorage=HW});var ER=v(Up=>{"use strict";l();Object.defineProperty(Up,"__esModule",{value:!0});Up.getWindowMetadata=void 0;var wR=qA();function kW(){let t,e;try{t=wR.getDocumentOrThrow(),e=wR.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let m=0;m-1){let O=y.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let R=e.protocol+"//"+e.host;if(O.indexOf("/")===0)R+=O;else{let z=e.pathname.split("/");z.pop();let M=z.join("/");R+=M+"/"+O}g.push(R)}else if(O.indexOf("//")===0){let R=e.protocol+O;g.push(R)}else g.push(O)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let m=0;my.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(A.length&&A){let O=y.getAttribute("content");if(O)return O}}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,c=r();return{description:a,url:u,icons:c,name:o}}Up.getWindowMetadata=kW});var AR=v((mge,vR)=>{"use strict";l();vR.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var TR=v((Ege,SR)=>{"use strict";l();var _R="%[a-f0-9]{2}",bR=new RegExp("("+_R+")|([^%]+?)","gi"),IR=new RegExp("("+_R+")+","gi");function VA(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([],VA(r),VA(n))}function GW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(bR)||[],r=1;r{"use strict";l();CR.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 OR=v((Ige,NR)=>{"use strict";l();NR.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";l();var QW=AR(),zW=TR(),PR=xR(),WW=OR(),$W=t=>t==null,HA=Symbol("encodeFragmentIdentifier");function KW(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,[It(e,t),"[",i,"]"].join("")]:[...r,[It(e,t),"[",It(i,t),"]=",It(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[It(e,t),"[]"].join("")]:[...r,[It(e,t),"[]=",It(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,[It(e,t),":list="].join("")]:[...r,[It(e,t),":list=",It(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?[[It(r,t),e,It(i,t)].join("")]:[[n,It(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,It(e,t)]:[...r,[It(e,t),"=",It(n,t)].join("")]}}function YW(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&&ci(n,t).includes(t.arrayFormatSeparator);n=o?ci(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ci(u,t)):n===null?n:ci(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ci(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ci(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 RR(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function It(t,e){return e.encode?e.strict?QW(t):encodeURIComponent(t):t}function ci(t,e){return e.decode?zW(t):t}function BR(t){return Array.isArray(t)?t.sort():typeof t=="object"?BR(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function LR(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function JW(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function FR(t){t=LR(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function DR(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 MR(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),RR(e.arrayFormatSeparator);let r=YW(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]=PR(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ci(o,e),r(ci(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]=DR(s[o],e);else n[i]=DR(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]=BR(o):i[s]=o,i},Object.create(null))}wr.extract=FR;wr.parse=MR;wr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),RR(e.arrayFormatSeparator);let r=o=>e.skipNull&&$W(t[o])||e.skipEmptyString&&t[o]==="",n=KW(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?It(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?It(o,e)+"[]":a.reduce(n(o),[]).join("&"):It(o,e)+"="+It(a,e)}).filter(o=>o.length>0).join("&")};wr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=PR(t,"#");return Object.assign({url:r.split("?")[0]||"",query:MR(FR(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ci(n,e)}:{})};wr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[HA]:!0},e);let r=LR(t.url).split("?")[0]||"",n=wr.extract(t.url),i=wr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=wr.stringify(s,e);o&&(o=`?${o}`);let a=JW(t.url);return t.fragmentIdentifier&&(a=`#${e[HA]?It(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};wr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[HA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=wr.parseUrl(t,r);return wr.stringifyUrl({url:n,query:WW(i,e),fragmentIdentifier:s},r)};wr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return wr.pick(t,n,r)}});var qR=he(()=>{l()});function Ji(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function XW(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function ZW(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function e$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Sl(t,e,r){return(!r.length?ZW(t,e.length):e$(t,e.length))?XW(t,e):!1}function Tl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var kA=he(()=>{l()});function t$(t){return qp(t.method)&&Vp(t.params)}function qp(t){return Tl(t,"subscribe")}function Vp(t){return Sl(t,["topic"],[])}function r$(t){return Hp(t.method)&&kp(t.params)}function Hp(t){return Tl(t,"publish")}function kp(t){return Sl(t,["message","topic","ttl"],["prompt","tag"])}function n$(t){return Gp(t.method)&&jp(t.params)}function Gp(t){return Tl(t,"unsubscribe")}function jp(t){return Sl(t,["id","topic"],[])}function i$(t){return Qp(t.method)&&zp(t.params)}function Qp(t){return Tl(t,"subscription")}function zp(t){return Sl(t,["id","data"],[])}var GA=he(()=>{l();kA()});function s$(t){if(!qp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Vp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Ji(e,"topic"),e}function o$(t){if(!Hp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!kp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Ji(e,"topic"),Ji(e,"message"),Ji(e,"ttl","number"),e}function a$(t){if(!Gp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!jp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Ji(e,"id"),e}function u$(t){if(!Qp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!zp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Ji(e,"id"),Ji(e,"data"),e}var VR=he(()=>{l();kA();GA()});var c$,HR=he(()=>{l();c$={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 kR={};ft(kR,{RELAY_JSONRPC:()=>c$,isPublishMethod:()=>Hp,isPublishParams:()=>kp,isPublishRequest:()=>r$,isSubscribeMethod:()=>qp,isSubscribeParams:()=>Vp,isSubscribeRequest:()=>t$,isSubscriptionMethod:()=>Qp,isSubscriptionParams:()=>zp,isSubscriptionRequest:()=>i$,isUnsubscribeMethod:()=>Gp,isUnsubscribeParams:()=>jp,isUnsubscribeRequest:()=>n$,parsePublishRequest:()=>o$,parseSubscribeRequest:()=>s$,parseSubscriptionRequest:()=>u$,parseUnsubscribeRequest:()=>a$});var GR=he(()=>{l();qR();VR();HR();GA()});var Dl=v(V=>{"use strict";l();Object.defineProperty(V,"__esModule",{value:!0});var ZR=HP(),l$=WP(),e3=cl(),KA=KP(),f$=ZP(),ct=(MA(),ht(FA)),d$=mR(),Xa=Zs(),Za=qA(),h$=ER(),p$=UR(),g$=(GR(),ht(kR));function t3(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 r3=t3(f$),Wp=t3(p$),Yp=":";function n3(t){let[e,r]=t.split(Yp);return{namespace:e,reference:r}}function i3(t){let{namespace:e,reference:r}=t;return[e,r].join(Yp)}function YA(t){let[e,r,n]=t.split(Yp);return{namespace:e,reference:r,address:n}}function s3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Yp)}function JA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function o3(t){let{address:e}=YA(t);return e}function a3(t){let{namespace:e,reference:r}=YA(t);return i3({namespace:e,reference:r})}function y$(t,e){let{namespace:r,reference:n}=n3(e);return s3({namespace:r,reference:n,address:t})}function m$(t){return JA(t,o3)}function u3(t){return JA(t,a3)}function w$(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 E$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...u3(i.accounts))}),r}function v$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Jp(n,i))}),r}function Jp(t,e){return t.includes(":")?[t]:e.chains||[]}var Xp=t=>t?.split(":"),c3=t=>{let e=t&&Xp(t);if(e)return e[3]},A$=t=>{let e=t&&Xp(t);if(e)return e[2]+":"+e[3]},l3=t=>{let e=t&&Xp(t);if(e)return e.pop()},b$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=l3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${c3(e)}`,u=`Nonce: ${t.nonce}`,c=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var NP=he(()=>{l();xP();Sp();Ki();vA();ml()});var IA,ppe,OP=he(()=>{l();nP();iP();sP();oP();aP();fA();uP();pA();cP();fP();vP();IP();_P();SP();NP();IA={...sA,...oA,...aA,...uA,...cA,...lA,...dA,...hA,...gA,...yA},ppe={...AA,...bA}});function PP(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var DP,_A,sW,Np,SA=he(()=>{l();OP();bp();DP=PP("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),_A=PP("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Qa(t.length);for(let r=0;r{l();SA()});function On(t,e="utf8"){let r=Np[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?$i(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var CA=he(()=>{l();SA();hl()});function El(t){return Qi(si(On(t,Ga),gp))}function vl(t){return si(On(zi(t),gp),Ga)}function xA(t){let e=On(vp,ja),r=Ep+si(Ip([e,t]),ja);return[mp,wp,r].join(yp)}function NA(t){let[e,r,n]=t.split(yp);if(e!==mp||r!==wp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==Ep)throw new Error("Issuer must be a key in mulicodec format");let s=On(n.slice(1),ja);if(si(s.slice(0,2),ja)!==vp)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 RP(t){return si(t,Ga)}function BP(t){return On(t,Ga)}function OA(t){return On([vl(t.header),vl(t.payload)].join(no),dl)}function oW(t){let e=si(t,dl).split(no),r=El(e[0]),n=El(e[1]);return{header:r,payload:n}}function DA(t){return[vl(t.header),vl(t.payload),RP(t.signature)].join(no)}function PA(t){let e=t.split(no),r=El(e[0]),n=El(e[1]),i=BP(e[2]),s=On(e.slice(0,2).join(no),dl);return{header:r,payload:n,signature:i,data:s}}var RA=he(()=>{l();eA();TA();CA();nl();Ap()});function aW(t=(0,LP.randomBytes)(32)){return Ja.generateKeyPairFromSeed(t)}async function uW(t,e,r,n,i=(0,FP.fromMiliseconds)(Date.now())){let s={alg:hp,typ:pp},o=xA(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},c=OA({header:s,payload:u}),f=Ja.sign(n.secretKey,c);return DA({header:s,payload:u,signature:f})}async function cW(t){let{header:e,payload:r,data:n,signature:i}=PA(t);if(e.alg!==hp||e.typ!==pp)throw new Error("JWT must use EdDSA algorithm");let s=NA(r.iss);return Ja.verify(s,n,i)}var Ja,LP,FP,MP=he(()=>{l();Ja=be(WD()),LP=be(cl()),FP=be(Zs());Ap();RA()});var UP=he(()=>{l()});var qP={};ft(qP,{DATA_ENCODING:()=>dl,DID_DELIMITER:()=>yp,DID_METHOD:()=>wp,DID_PREFIX:()=>mp,JSON_ENCODING:()=>gp,JWT_DELIMITER:()=>no,JWT_ENCODING:()=>Ga,JWT_IRIDIUM_ALG:()=>hp,JWT_IRIDIUM_TYP:()=>pp,KEY_PAIR_SEED_LENGTH:()=>KD,MULTICODEC_ED25519_BASE:()=>Ep,MULTICODEC_ED25519_ENCODING:()=>ja,MULTICODEC_ED25519_HEADER:()=>vp,MULTICODEC_ED25519_LENGTH:()=>$D,decodeData:()=>oW,decodeIss:()=>NA,decodeJSON:()=>El,decodeJWT:()=>PA,decodeSig:()=>BP,encodeData:()=>OA,encodeIss:()=>xA,encodeJSON:()=>vl,encodeJWT:()=>DA,encodeSig:()=>RP,generateKeyPair:()=>aW,signJWT:()=>uW,verifyJWT:()=>cW});var VP=he(()=>{l();MP();Ap();UP();RA()});var kP=A(Op=>{"use strict";l();Object.defineProperty(Op,"__esModule",{value:!0});var tr=qa(),BA=Hr(),lW=20;function fW(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],c=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],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],b=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],R=e[11]<<24|e[10]<<16|e[9]<<8|e[8],z=e[15]<<24|e[14]<<16|e[13]<<8|e[12],M=n,E=i,S=s,N=o,_=a,T=u,B=c,X=f,Q=d,H=g,j=m,K=y,me=b,ce=O,ie=R,J=z,oe=0;oe>>16|me<<16,Q=Q+me|0,_^=Q,_=_>>>20|_<<12,E=E+T|0,ce^=E,ce=ce>>>16|ce<<16,H=H+ce|0,T^=H,T=T>>>20|T<<12,S=S+B|0,ie^=S,ie=ie>>>16|ie<<16,j=j+ie|0,B^=j,B=B>>>20|B<<12,N=N+X|0,J^=N,J=J>>>16|J<<16,K=K+J|0,X^=K,X=X>>>20|X<<12,S=S+B|0,ie^=S,ie=ie>>>24|ie<<8,j=j+ie|0,B^=j,B=B>>>25|B<<7,N=N+X|0,J^=N,J=J>>>24|J<<8,K=K+J|0,X^=K,X=X>>>25|X<<7,E=E+T|0,ce^=E,ce=ce>>>24|ce<<8,H=H+ce|0,T^=H,T=T>>>25|T<<7,M=M+_|0,me^=M,me=me>>>24|me<<8,Q=Q+me|0,_^=Q,_=_>>>25|_<<7,M=M+T|0,J^=M,J=J>>>16|J<<16,j=j+J|0,T^=j,T=T>>>20|T<<12,E=E+B|0,me^=E,me=me>>>16|me<<16,K=K+me|0,B^=K,B=B>>>20|B<<12,S=S+X|0,ce^=S,ce=ce>>>16|ce<<16,Q=Q+ce|0,X^=Q,X=X>>>20|X<<12,N=N+_|0,ie^=N,ie=ie>>>16|ie<<16,H=H+ie|0,_^=H,_=_>>>20|_<<12,S=S+X|0,ce^=S,ce=ce>>>24|ce<<8,Q=Q+ce|0,X^=Q,X=X>>>25|X<<7,N=N+_|0,ie^=N,ie=ie>>>24|ie<<8,H=H+ie|0,_^=H,_=_>>>25|_<<7,E=E+B|0,me^=E,me=me>>>24|me<<8,K=K+me|0,B^=K,B=B>>>25|B<<7,M=M+T|0,J^=M,J=J>>>24|J<<8,j=j+J|0,T^=j,T=T>>>25|T<<7;tr.writeUint32LE(M+n|0,t,0),tr.writeUint32LE(E+i|0,t,4),tr.writeUint32LE(S+s|0,t,8),tr.writeUint32LE(N+o|0,t,12),tr.writeUint32LE(_+a|0,t,16),tr.writeUint32LE(T+u|0,t,20),tr.writeUint32LE(B+c|0,t,24),tr.writeUint32LE(X+f|0,t,28),tr.writeUint32LE(Q+d|0,t,32),tr.writeUint32LE(H+g|0,t,36),tr.writeUint32LE(j+m|0,t,40),tr.writeUint32LE(K+y|0,t,44),tr.writeUint32LE(me+b|0,t,48),tr.writeUint32LE(ce+O|0,t,52),tr.writeUint32LE(ie+R|0,t,56),tr.writeUint32LE(J+z|0,t,60)}function HP(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 Dp=A(Xa=>{"use strict";l();Object.defineProperty(Xa,"__esModule",{value:!0});function pW(t,e,r){return~(t-1)&e|t-1&r}Xa.select=pW;function gW(t,e){return(t|0)-(e|0)-1>>>31&1}Xa.lessOrEqual=gW;function GP(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Xa.compare=GP;function yW(t,e){return t.length===0||e.length===0?!1:GP(t,e)!==0}Xa.equal=yW});var QP=A(oi=>{"use strict";l();Object.defineProperty(oi,"__esModule",{value:!0});var mW=Dp(),Pp=Hr();oi.DIGEST_LENGTH=16;var jP=function(){function t(e){this.digestLength=oi.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 c=e[14]|e[15]<<8;this._r[8]=(u>>>8|c<<8)&8191,this._r[9]=c>>>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],c=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],m=this._h[8],y=this._h[9],b=this._r[0],O=this._r[1],R=this._r[2],z=this._r[3],M=this._r[4],E=this._r[5],S=this._r[6],N=this._r[7],_=this._r[8],T=this._r[9];n>=16;){var B=e[r+0]|e[r+1]<<8;s+=B&8191;var X=e[r+2]|e[r+3]<<8;o+=(B>>>13|X<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(X>>>10|Q<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(Q>>>7|H<<9)&8191;var j=e[r+8]|e[r+9]<<8;c+=(H>>>4|j<<12)&8191,f+=j>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(j>>>14|K<<2)&8191;var me=e[r+12]|e[r+13]<<8;g+=(K>>>11|me<<5)&8191;var ce=e[r+14]|e[r+15]<<8;m+=(me>>>8|ce<<8)&8191,y+=ce>>>5|i;var ie=0,J=ie;J+=s*b,J+=o*(5*T),J+=a*(5*_),J+=u*(5*N),J+=c*(5*S),ie=J>>>13,J&=8191,J+=f*(5*E),J+=d*(5*M),J+=g*(5*z),J+=m*(5*R),J+=y*(5*O),ie+=J>>>13,J&=8191;var oe=ie;oe+=s*O,oe+=o*b,oe+=a*(5*T),oe+=u*(5*_),oe+=c*(5*N),ie=oe>>>13,oe&=8191,oe+=f*(5*S),oe+=d*(5*E),oe+=g*(5*M),oe+=m*(5*z),oe+=y*(5*R),ie+=oe>>>13,oe&=8191;var re=ie;re+=s*R,re+=o*O,re+=a*b,re+=u*(5*T),re+=c*(5*_),ie=re>>>13,re&=8191,re+=f*(5*N),re+=d*(5*S),re+=g*(5*E),re+=m*(5*M),re+=y*(5*z),ie+=re>>>13,re&=8191;var se=ie;se+=s*z,se+=o*R,se+=a*O,se+=u*b,se+=c*(5*T),ie=se>>>13,se&=8191,se+=f*(5*_),se+=d*(5*N),se+=g*(5*S),se+=m*(5*E),se+=y*(5*M),ie+=se>>>13,se&=8191;var U=ie;U+=s*M,U+=o*z,U+=a*R,U+=u*O,U+=c*b,ie=U>>>13,U&=8191,U+=f*(5*T),U+=d*(5*_),U+=g*(5*N),U+=m*(5*S),U+=y*(5*E),ie+=U>>>13,U&=8191;var fe=ie;fe+=s*E,fe+=o*M,fe+=a*z,fe+=u*R,fe+=c*O,ie=fe>>>13,fe&=8191,fe+=f*b,fe+=d*(5*T),fe+=g*(5*_),fe+=m*(5*N),fe+=y*(5*S),ie+=fe>>>13,fe&=8191;var ue=ie;ue+=s*S,ue+=o*E,ue+=a*M,ue+=u*z,ue+=c*R,ie=ue>>>13,ue&=8191,ue+=f*O,ue+=d*b,ue+=g*(5*T),ue+=m*(5*_),ue+=y*(5*N),ie+=ue>>>13,ue&=8191;var de=ie;de+=s*N,de+=o*S,de+=a*E,de+=u*M,de+=c*z,ie=de>>>13,de&=8191,de+=f*R,de+=d*O,de+=g*b,de+=m*(5*T),de+=y*(5*_),ie+=de>>>13,de&=8191;var ae=ie;ae+=s*_,ae+=o*N,ae+=a*S,ae+=u*E,ae+=c*M,ie=ae>>>13,ae&=8191,ae+=f*z,ae+=d*R,ae+=g*O,ae+=m*b,ae+=y*(5*T),ie+=ae>>>13,ae&=8191;var le=ie;le+=s*T,le+=o*_,le+=a*N,le+=u*S,le+=c*E,ie=le>>>13,le&=8191,le+=f*M,le+=d*z,le+=g*R,le+=m*O,le+=y*b,ie+=le>>>13,le&=8191,ie=(ie<<2)+ie|0,ie=ie+J|0,J=ie&8191,ie=ie>>>13,oe+=ie,s=J,o=oe,a=re,u=se,c=U,f=fe,d=ue,g=de,m=ae,y=le,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=c,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=m,this._h[9]=y},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";l();Object.defineProperty(ai,"__esModule",{value:!0});var Rp=kP(),vW=QP(),Al=Hr(),zP=qa(),AW=Dp();ai.KEY_LENGTH=32;ai.NONCE_LENGTH=12;ai.TAG_LENGTH=16;var WP=new Uint8Array(16),bW=function(){function t(e){if(this.nonceLength=ai.NONCE_LENGTH,this.tagLength=ai.TAG_LENGTH,e.length!==ai.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);Rp.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 Rp.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),Al.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(WP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(WP.subarray(n.length%16));var o=new Uint8Array(8);i&&zP.writeUint64LE(i.length,o),s.update(o),zP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(LA,"__esModule",{value:!0});function IW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}LA.isSerializableHash=IW});var JP=A(bl=>{"use strict";l();Object.defineProperty(bl,"__esModule",{value:!0});var Dn=KP(),_W=Dp(),SW=Hr(),YP=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";l();Object.defineProperty(FA,"__esModule",{value:!0});var XP=JP(),ZP=Hr(),CW=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=XP.hmac(this._hash,n,r);this._hmac=new XP.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";l();Object.defineProperty(Ji,"__esModule",{value:!0});var Lp=qa(),Bp=Hr();Ji.DIGEST_LENGTH=32;Ji.BLOCK_SIZE=64;var tR=function(){function t(){this.digestLength=Ji.DIGEST_LENGTH,this.blockSize=Ji.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(){Bp.wipe(this._buffer),Bp.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&&(MA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=MA(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){Bp.wipe(e.state),e.buffer&&Bp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Ji.SHA256=tR;var xW=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 MA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],c=e[4],f=e[5],d=e[6],g=e[7],m=0;m<16;m++){var y=n+m*4;t[m]=Lp.readUint32BE(r,y)}for(var m=16;m<64;m++){var b=t[m-2],O=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10;b=t[m-15];var R=(b>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;t[m]=(O+t[m-7]|0)+(R+t[m-16]|0)}for(var m=0;m<64;m++){var O=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&d)|0)+(g+(xW[m]+t[m]|0)|0)|0,R=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&a^o&a)|0;g=d,d=f,f=c,c=u+O|0,u=a,a=o,o=s,s=O+R|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function NW(t){var e=new tR;e.update(t);var r=e.digest();return e.clean(),r}Ji.hash=NW});var oR=A(mt=>{"use strict";l();Object.defineProperty(mt,"__esModule",{value:!0});mt.sharedKey=mt.generateKeyPair=mt.generateKeyPairFromSeed=mt.scalarMultBase=mt.scalarMult=mt.SHARED_KEY_LENGTH=mt.SECRET_KEY_LENGTH=mt.PUBLIC_KEY_LENGTH=void 0;var OW=cl(),DW=Hr();mt.PUBLIC_KEY_LENGTH=32;mt.SECRET_KEY_LENGTH=32;mt.SHARED_KEY_LENGTH=32;function Pn(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,Il(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 BW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Mp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ui(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,d=0,g=0,m=0,y=0,b=0,O=0,R=0,z=0,M=0,E=0,S=0,N=0,_=0,T=0,B=0,X=0,Q=0,H=0,j=0,K=0,me=0,ce=0,ie=0,J=0,oe=0,re=r[0],se=r[1],U=r[2],fe=r[3],ue=r[4],de=r[5],ae=r[6],le=r[7],w=r[8],v=r[9],I=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*re,o+=n*se,a+=n*U,u+=n*fe,c+=n*ue,f+=n*de,d+=n*ae,g+=n*le,m+=n*w,y+=n*v,b+=n*I,O+=n*P,R+=n*C,z+=n*D,M+=n*L,E+=n*x,n=e[1],o+=n*re,a+=n*se,u+=n*U,c+=n*fe,f+=n*ue,d+=n*de,g+=n*ae,m+=n*le,y+=n*w,b+=n*v,O+=n*I,R+=n*P,z+=n*C,M+=n*D,E+=n*L,S+=n*x,n=e[2],a+=n*re,u+=n*se,c+=n*U,f+=n*fe,d+=n*ue,g+=n*de,m+=n*ae,y+=n*le,b+=n*w,O+=n*v,R+=n*I,z+=n*P,M+=n*C,E+=n*D,S+=n*L,N+=n*x,n=e[3],u+=n*re,c+=n*se,f+=n*U,d+=n*fe,g+=n*ue,m+=n*de,y+=n*ae,b+=n*le,O+=n*w,R+=n*v,z+=n*I,M+=n*P,E+=n*C,S+=n*D,N+=n*L,_+=n*x,n=e[4],c+=n*re,f+=n*se,d+=n*U,g+=n*fe,m+=n*ue,y+=n*de,b+=n*ae,O+=n*le,R+=n*w,z+=n*v,M+=n*I,E+=n*P,S+=n*C,N+=n*D,_+=n*L,T+=n*x,n=e[5],f+=n*re,d+=n*se,g+=n*U,m+=n*fe,y+=n*ue,b+=n*de,O+=n*ae,R+=n*le,z+=n*w,M+=n*v,E+=n*I,S+=n*P,N+=n*C,_+=n*D,T+=n*L,B+=n*x,n=e[6],d+=n*re,g+=n*se,m+=n*U,y+=n*fe,b+=n*ue,O+=n*de,R+=n*ae,z+=n*le,M+=n*w,E+=n*v,S+=n*I,N+=n*P,_+=n*C,T+=n*D,B+=n*L,X+=n*x,n=e[7],g+=n*re,m+=n*se,y+=n*U,b+=n*fe,O+=n*ue,R+=n*de,z+=n*ae,M+=n*le,E+=n*w,S+=n*v,N+=n*I,_+=n*P,T+=n*C,B+=n*D,X+=n*L,Q+=n*x,n=e[8],m+=n*re,y+=n*se,b+=n*U,O+=n*fe,R+=n*ue,z+=n*de,M+=n*ae,E+=n*le,S+=n*w,N+=n*v,_+=n*I,T+=n*P,B+=n*C,X+=n*D,Q+=n*L,H+=n*x,n=e[9],y+=n*re,b+=n*se,O+=n*U,R+=n*fe,z+=n*ue,M+=n*de,E+=n*ae,S+=n*le,N+=n*w,_+=n*v,T+=n*I,B+=n*P,X+=n*C,Q+=n*D,H+=n*L,j+=n*x,n=e[10],b+=n*re,O+=n*se,R+=n*U,z+=n*fe,M+=n*ue,E+=n*de,S+=n*ae,N+=n*le,_+=n*w,T+=n*v,B+=n*I,X+=n*P,Q+=n*C,H+=n*D,j+=n*L,K+=n*x,n=e[11],O+=n*re,R+=n*se,z+=n*U,M+=n*fe,E+=n*ue,S+=n*de,N+=n*ae,_+=n*le,T+=n*w,B+=n*v,X+=n*I,Q+=n*P,H+=n*C,j+=n*D,K+=n*L,me+=n*x,n=e[12],R+=n*re,z+=n*se,M+=n*U,E+=n*fe,S+=n*ue,N+=n*de,_+=n*ae,T+=n*le,B+=n*w,X+=n*v,Q+=n*I,H+=n*P,j+=n*C,K+=n*D,me+=n*L,ce+=n*x,n=e[13],z+=n*re,M+=n*se,E+=n*U,S+=n*fe,N+=n*ue,_+=n*de,T+=n*ae,B+=n*le,X+=n*w,Q+=n*v,H+=n*I,j+=n*P,K+=n*C,me+=n*D,ce+=n*L,ie+=n*x,n=e[14],M+=n*re,E+=n*se,S+=n*U,N+=n*fe,_+=n*ue,T+=n*de,B+=n*ae,X+=n*le,Q+=n*w,H+=n*v,j+=n*I,K+=n*P,me+=n*C,ce+=n*D,ie+=n*L,J+=n*x,n=e[15],E+=n*re,S+=n*se,N+=n*U,_+=n*fe,T+=n*ue,B+=n*de,X+=n*ae,Q+=n*le,H+=n*w,j+=n*v,K+=n*I,me+=n*P,ce+=n*C,ie+=n*D,J+=n*L,oe+=n*x,s+=38*S,o+=38*N,a+=38*_,u+=38*T,c+=38*B,f+=38*X,d+=38*Q,g+=38*H,m+=38*j,y+=38*K,b+=38*me,O+=38*ce,R+=38*ie,z+=38*J,M+=38*oe,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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=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=c+i+65535,i=Math.floor(n/65536),c=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=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=M+i+65535,i=Math.floor(n/65536),M=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=d,t[7]=g,t[8]=m,t[9]=y,t[10]=b,t[11]=O,t[12]=R,t[13]=z,t[14]=M,t[15]=E}function _l(t,e){ui(t,e,e)}function LW(t,e){let r=Pn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)_l(r,r),n!==2&&n!==4&&ui(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function qA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Pn(),s=Pn(),o=Pn(),a=Pn(),u=Pn(),c=Pn();for(let m=0;m<31;m++)r[m]=t[m];r[31]=t[31]&127|64,r[0]&=248,BW(n,e);for(let m=0;m<16;m++)s[m]=n[m];i[0]=a[0]=1;for(let m=254;m>=0;--m){let y=r[m>>>3]>>>(m&7)&1;Il(i,s,y),Il(o,a,y),Fp(u,i,o),Mp(i,i,o),Fp(o,s,a),Mp(s,s,a),_l(a,u),_l(c,i),ui(i,o,i),ui(o,s,u),Fp(u,i,o),Mp(i,i,o),_l(s,i),Mp(o,a,c),ui(i,o,PW),Fp(i,i,a),ui(o,o,i),ui(i,a,c),ui(a,s,n),_l(s,u),Il(i,s,y),Il(o,a,y)}for(let m=0;m<16;m++)n[m+16]=i[m],n[m+32]=o[m],n[m+48]=s[m],n[m+64]=a[m];let f=n.subarray(32),d=n.subarray(16);LW(f,f),ui(d,d,f);let g=new Uint8Array(32);return RW(g,d),g}mt.scalarMult=qA;function iR(t){return qA(t,nR)}mt.scalarMultBase=iR;function sR(t){if(t.length!==mt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${mt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:iR(e),secretKey:e}}mt.generateKeyPairFromSeed=sR;function FW(t){let e=(0,OW.randomBytes)(32,t),r=sR(e);return(0,DW.wipe)(e),r}mt.generateKeyPair=FW;function MW(t,e,r=!1){if(t.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==mt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=qA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{l()});function cR(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{l()});function fR(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Qa(t.length);for(let n=0;n{l();bp();hl()});var VA={};ft(VA,{compare:()=>aR,concat:()=>Ip,equals:()=>cR,fromString:()=>On,toString:()=>si,xor:()=>fR});var HA=he(()=>{l();uR();eA();lR();CA();TA();dR()});var _R=A(ut=>{"use strict";l();var hR=ut&&ut.__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 vR:typeof navigator<"u"?kA(navigator.userAgent):IR()}ut.detect=HW;function AR(t){return t!==""&&VW.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 kW(t){var e=AR(t);return e?e[0]:null}ut.browserName=kW;function kA(t){var e=AR(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new ER;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";l();Object.defineProperty(et,"__esModule",{value:!0});et.getLocalStorage=et.getLocalStorageOrThrow=et.getCrypto=et.getCryptoOrThrow=et.getLocation=et.getLocationOrThrow=et.getNavigator=et.getNavigatorOrThrow=et.getDocument=et.getDocumentOrThrow=et.getFromWindowOrThrow=et.getFromWindow=void 0;function so(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}et.getFromWindow=so;function Za(t){let e=so(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}et.getFromWindowOrThrow=Za;function jW(){return Za("document")}et.getDocumentOrThrow=jW;function QW(){return so("document")}et.getDocument=QW;function zW(){return Za("navigator")}et.getNavigatorOrThrow=zW;function WW(){return so("navigator")}et.getNavigator=WW;function $W(){return Za("location")}et.getLocationOrThrow=$W;function KW(){return so("location")}et.getLocation=KW;function YW(){return Za("crypto")}et.getCryptoOrThrow=YW;function JW(){return so("crypto")}et.getCrypto=JW;function XW(){return Za("localStorage")}et.getLocalStorageOrThrow=XW;function ZW(){return so("localStorage")}et.getLocalStorage=ZW});var TR=A(Up=>{"use strict";l();Object.defineProperty(Up,"__esModule",{value:!0});Up.getWindowMetadata=void 0;var SR=GA();function e$(){let t,e;try{t=SR.getDocumentOrThrow(),e=SR.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let m=0;m-1){let O=y.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let R=e.protocol+"//"+e.host;if(O.indexOf("/")===0)R+=O;else{let z=e.pathname.split("/");z.pop();let M=z.join("/");R+=M+"/"+O}g.push(R)}else if(O.indexOf("//")===0){let R=e.protocol+O;g.push(R)}else g.push(O)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let m=0;my.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(b.length&&b){let O=y.getAttribute("content");if(O)return O}}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,c=r();return{description:a,url:u,icons:c,name:o}}Up.getWindowMetadata=e$});var xR=A((Oge,CR)=>{"use strict";l();CR.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var RR=A((Pge,PR)=>{"use strict";l();var DR="%[a-f0-9]{2}",NR=new RegExp("("+DR+")|([^%]+?)","gi"),OR=new RegExp("("+DR+")+","gi");function jA(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([],jA(r),jA(n))}function t$(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(NR)||[],r=1;r{"use strict";l();BR.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 MR=A((Fge,FR)=>{"use strict";l();FR.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";l();var n$=xR(),i$=RR(),qR=LR(),s$=MR(),o$=t=>t==null,QA=Symbol("encodeFragmentIdentifier");function a$(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,[It(e,t),"[",i,"]"].join("")]:[...r,[It(e,t),"[",It(i,t),"]=",It(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[It(e,t),"[]"].join("")]:[...r,[It(e,t),"[]=",It(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,[It(e,t),":list="].join("")]:[...r,[It(e,t),":list=",It(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?[[It(r,t),e,It(i,t)].join("")]:[[n,It(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,It(e,t)]:[...r,[It(e,t),"=",It(n,t)].join("")]}}function u$(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&&ci(n,t).includes(t.arrayFormatSeparator);n=o?ci(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ci(u,t)):n===null?n:ci(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ci(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ci(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 VR(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function It(t,e){return e.encode?e.strict?n$(t):encodeURIComponent(t):t}function ci(t,e){return e.decode?i$(t):t}function HR(t){return Array.isArray(t)?t.sort():typeof t=="object"?HR(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function kR(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function c$(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function GR(t){t=kR(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function UR(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 jR(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),VR(e.arrayFormatSeparator);let r=u$(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]=qR(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ci(o,e),r(ci(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]=UR(s[o],e);else n[i]=UR(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]=HR(o):i[s]=o,i},Object.create(null))}wr.extract=GR;wr.parse=jR;wr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),VR(e.arrayFormatSeparator);let r=o=>e.skipNull&&o$(t[o])||e.skipEmptyString&&t[o]==="",n=a$(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?It(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?It(o,e)+"[]":a.reduce(n(o),[]).join("&"):It(o,e)+"="+It(a,e)}).filter(o=>o.length>0).join("&")};wr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=qR(t,"#");return Object.assign({url:r.split("?")[0]||"",query:jR(GR(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ci(n,e)}:{})};wr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[QA]:!0},e);let r=kR(t.url).split("?")[0]||"",n=wr.extract(t.url),i=wr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=wr.stringify(s,e);o&&(o=`?${o}`);let a=c$(t.url);return t.fragmentIdentifier&&(a=`#${e[QA]?It(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};wr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[QA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=wr.parseUrl(t,r);return wr.stringifyUrl({url:n,query:s$(i,e),fragmentIdentifier:s},r)};wr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return wr.pick(t,n,r)}});var zR=he(()=>{l()});function Xi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function l$(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function f$(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function d$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Sl(t,e,r){return(!r.length?f$(t,e.length):d$(t,e.length))?l$(t,e):!1}function Tl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var zA=he(()=>{l()});function h$(t){return qp(t.method)&&Vp(t.params)}function qp(t){return Tl(t,"subscribe")}function Vp(t){return Sl(t,["topic"],[])}function p$(t){return Hp(t.method)&&kp(t.params)}function Hp(t){return Tl(t,"publish")}function kp(t){return Sl(t,["message","topic","ttl"],["prompt","tag"])}function g$(t){return Gp(t.method)&&jp(t.params)}function Gp(t){return Tl(t,"unsubscribe")}function jp(t){return Sl(t,["id","topic"],[])}function y$(t){return Qp(t.method)&&zp(t.params)}function Qp(t){return Tl(t,"subscription")}function zp(t){return Sl(t,["id","data"],[])}var WA=he(()=>{l();zA()});function m$(t){if(!qp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Vp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Xi(e,"topic"),e}function w$(t){if(!Hp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!kp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Xi(e,"topic"),Xi(e,"message"),Xi(e,"ttl","number"),e}function E$(t){if(!Gp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!jp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Xi(e,"id"),e}function v$(t){if(!Qp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!zp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Xi(e,"id"),Xi(e,"data"),e}var WR=he(()=>{l();zA();WA()});var A$,$R=he(()=>{l();A$={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 KR={};ft(KR,{RELAY_JSONRPC:()=>A$,isPublishMethod:()=>Hp,isPublishParams:()=>kp,isPublishRequest:()=>p$,isSubscribeMethod:()=>qp,isSubscribeParams:()=>Vp,isSubscribeRequest:()=>h$,isSubscriptionMethod:()=>Qp,isSubscriptionParams:()=>zp,isSubscriptionRequest:()=>y$,isUnsubscribeMethod:()=>Gp,isUnsubscribeParams:()=>jp,isUnsubscribeRequest:()=>g$,parsePublishRequest:()=>w$,parseSubscribeRequest:()=>m$,parseSubscriptionRequest:()=>v$,parseUnsubscribeRequest:()=>E$});var YR=he(()=>{l();zR();WR();$R();WA()});var Dl=A(V=>{"use strict";l();Object.defineProperty(V,"__esModule",{value:!0});var o3=$P(),b$=eR(),a3=cl(),ZA=rR(),I$=oR(),ct=(HA(),ht(VA)),_$=_R(),eu=Zs(),tu=GA(),S$=TR(),T$=QR(),C$=(YR(),ht(KR));function u3(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 c3=u3(I$),Wp=u3(T$),Yp=":";function l3(t){let[e,r]=t.split(Yp);return{namespace:e,reference:r}}function f3(t){let{namespace:e,reference:r}=t;return[e,r].join(Yp)}function eb(t){let[e,r,n]=t.split(Yp);return{namespace:e,reference:r,address:n}}function d3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Yp)}function tb(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function h3(t){let{address:e}=eb(t);return e}function p3(t){let{namespace:e,reference:r}=eb(t);return f3({namespace:e,reference:r})}function x$(t,e){let{namespace:r,reference:n}=l3(e);return d3({namespace:r,reference:n,address:t})}function N$(t){return tb(t,h3)}function g3(t){return tb(t,p3)}function O$(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 D$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...g3(i.accounts))}),r}function P$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Jp(n,i))}),r}function Jp(t,e){return t.includes(":")?[t]:e.chains||[]}var Xp=t=>t?.split(":"),y3=t=>{let e=t&&Xp(t);if(e)return e[3]},R$=t=>{let e=t&&Xp(t);if(e)return e[2]+":"+e[3]},m3=t=>{let e=t&&Xp(t);if(e)return e.pop()},B$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=m3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${y3(e)}`,u=`Nonce: ${t.nonce}`,c=`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,c,f].filter(d=>d!=null).join(` -`)},XA="base10",or="base16",$p="base64pad",Zp="utf8",ZA=0,eu=1,I$=0,jR=1,QA=12,eb=32;function _$(){let t=r3.generateKeyPair();return{privateKey:ct.toString(t.secretKey,or),publicKey:ct.toString(t.publicKey,or)}}function S$(){let t=e3.randomBytes(eb);return ct.toString(t,or)}function T$(t,e){let r=r3.sharedKey(ct.fromString(t,or),ct.fromString(e,or),!0),n=new l$.HKDF(KA.SHA256,r).expand(eb);return ct.toString(n,or)}function C$(t){let e=KA.hash(ct.fromString(t,or));return ct.toString(e,or)}function x$(t){let e=KA.hash(ct.fromString(t,Zp));return ct.toString(e,or)}function f3(t){return ct.fromString(`${t}`,XA)}function xl(t){return Number(ct.toString(t,XA))}function N$(t){let e=f3(typeof t.type<"u"?t.type:ZA);if(xl(e)===eu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ct.fromString(t.senderPublicKey,or):void 0,n=typeof t.iv<"u"?ct.fromString(t.iv,or):e3.randomBytes(QA),i=new ZR.ChaCha20Poly1305(ct.fromString(t.symKey,or)).seal(n,ct.fromString(t.message,Zp));return d3({type:e,sealed:i,iv:n,senderPublicKey:r})}function O$(t){let e=new ZR.ChaCha20Poly1305(ct.fromString(t.symKey,or)),{sealed:r,iv:n}=tb(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ct.toString(i,Zp)}function d3(t){if(xl(t.type)===eu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ct.toString(ct.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),$p)}return ct.toString(ct.concat([t.type,t.iv,t.sealed]),$p)}function tb(t){let e=ct.fromString(t,$p),r=e.slice(I$,jR),n=jR;if(xl(r)===eu){let a=n+eb,u=a+QA,c=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:c}}let i=n+QA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function D$(t,e){let r=tb(t);return h3({type:xl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ct.toString(r.senderPublicKey,or):void 0,receiverPublicKey:e?.receiverPublicKey})}function h3(t){let e=t?.type||ZA;if(e===eu){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 P$(t){return t.type===eu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var R$=Object.defineProperty,QR=Object.getOwnPropertySymbols,B$=Object.prototype.hasOwnProperty,L$=Object.prototype.propertyIsEnumerable,zR=(t,e,r)=>e in t?R$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WR=(t,e)=>{for(var r in e||(e={}))B$.call(e,r)&&zR(t,r,e[r]);if(QR)for(var r of QR(e))L$.call(e,r)&&zR(t,r,e[r]);return t},p3="ReactNative",sr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Kp=" ",F$=":",g3="/",rb=2,M$=1e3,y3="js";function nb(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function tu(){return!Za.getDocument()&&!!Za.getNavigator()&&navigator.product===p3}function Nl(){return!nb()&&!!Za.getNavigator()&&!!Za.getDocument()}function ao(){return tu()?sr.reactNative:nb()?sr.node:Nl()?sr.browser:sr.unknown}function U$(){var t;try{return tu()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function m3(t,e){let r=Wp.parse(t);return r=WR(WR({},r),e),t=Wp.stringify(r),t}function q$(){return h$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function V$(t,e){var r;let n=ao(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=Za.getLocation())==null?void 0:r.host)||"unknown"),i}function w3(){if(ao()===sr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=d$.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 E3(){var t;let e=ao();return e===sr.browser?[e,((t=Za.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function v3(t,e,r){let n=w3(),i=E3();return[[t,e].join("-"),[y3,r].join("-"),n,i].join("/")}function H$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){let u=r.split("?"),c=v3(t,e,n),f={auth:i,ua:c,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},d=m3(u[1]||"",f);return u[0]+"?"+d}function k$(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 G$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function A3(t,e=rb){return b3(t.split(g3),e)}function j$(t){return A3(t).join(Kp)}function Xi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function b3(t,e=rb){return t.slice(Math.max(t.length-e,0))}function Q$(t){return Object.fromEntries(t.entries())}function z$(t){return new Map(Object.entries(t))}function W$(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var $$=t=>t;function I3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function K$(t){return t.split(Kp).map(e=>I3(e)).join(Kp)}function Y$(t=Xa.FIVE_MINUTES,e){let r=Xa.toMiliseconds(t||Xa.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 J$(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 ib(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 X$(t){return ib("topic",t)}function Z$(t){return ib("id",t)}function eK(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 tK(t,e){return Xa.fromMiliseconds((e||Date.now())+Xa.toMiliseconds(t))}function rK(t){return Date.now()>=Xa.toMiliseconds(t)}function nK(t,e){return`${t}${e?`:${e}`:""}`}function Zi(t=[],e=[]){return[...new Set([...t,...e])]}async function iK({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=ao();o===sr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===sr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function sK(t,e){try{return await t.getItem(e)||(Nl()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var _3="irn";function oK(t){return t?.relay||{protocol:_3}}function aK(t){let e=g$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var uK=Object.defineProperty,$R=Object.getOwnPropertySymbols,cK=Object.prototype.hasOwnProperty,lK=Object.prototype.propertyIsEnumerable,KR=(t,e,r)=>e in t?uK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fK=(t,e)=>{for(var r in e||(e={}))cK.call(e,r)&&KR(t,r,e[r]);if($R)for(var r of $R(e))lK.call(e,r)&&KR(t,r,e[r]);return t};function S3(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 dK(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):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=Wp.parse(s);return{protocol:n,topic:T3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:S3(o)}}function T3(t){return t.startsWith("//")?t.substring(2):t}function C3(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 hK(t){return`${t.protocol}:${t.topic}@${t.version}?`+Wp.stringify(fK({symKey:t.symKey},C3(t.relay)))}var pK=Object.defineProperty,gK=Object.defineProperties,yK=Object.getOwnPropertyDescriptors,YR=Object.getOwnPropertySymbols,mK=Object.prototype.hasOwnProperty,wK=Object.prototype.propertyIsEnumerable,JR=(t,e,r)=>e in t?pK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,EK=(t,e)=>{for(var r in e||(e={}))mK.call(e,r)&&JR(t,r,e[r]);if(YR)for(var r of YR(e))wK.call(e,r)&&JR(t,r,e[r]);return t},vK=(t,e)=>gK(t,yK(e));function uo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function x3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...uo(r.accounts))}),e}function N3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function O3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.events)}),r}function AK(t,e){let r=V3(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 bK(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=zA(e),s=zA(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,d=n[c].methods,g=n[c].events,m=n[c].accounts;f.forEach(y=>{if(!m.some(A=>A.includes(y)))throw new Error(`No accounts provided for chain ${y} in namespace ${c}`)}),o[c]={chains:f,methods:d,events:g,accounts:m}});let a=k3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(y=>{var A,O;return(O=(A=i[c])==null?void 0:A.chains)==null?void 0:O.includes(y)}),d=n[c].methods.filter(y=>{var A,O;return(O=(A=i[c])==null?void 0:A.methods)==null?void 0:O.includes(y)}),g=n[c].events.filter(y=>{var A,O;return(O=(A=i[c])==null?void 0:A.events)==null?void 0:O.includes(y)}),m=f.map(y=>n[c].accounts.filter(A=>A.includes(`${y}:`))).flat();u[c]={chains:f,methods:d,events:g,accounts:m}}),Object.keys(s).forEach(c=>{var f,d,g,m,y,A;if(!n[c])return;let O=(d=(f=s[c])==null?void 0:f.chains)==null?void 0:d.filter(b=>n[c].chains.includes(b)),R=n[c].methods.filter(b=>{var S,N;return(N=(S=s[c])==null?void 0:S.methods)==null?void 0:N.includes(b)}),z=n[c].events.filter(b=>{var S,N;return(N=(S=s[c])==null?void 0:S.events)==null?void 0:N.includes(b)}),M=O?.map(b=>n[c].accounts.filter(S=>S.includes(`${b}:`))).flat();u[c]={chains:Zi((g=u[c])==null?void 0:g.chains,O),methods:Zi((m=u[c])==null?void 0:m.methods,R),events:Zi((y=u[c])==null?void 0:y.events,z),accounts:Zi((A=u[c])==null?void 0:A.accounts,M)}}),u)}function sb(t){return t.includes(":")}function D3(t){return sb(t)?t.split(":")[0]:t}function zA(t){var e,r,n;let i={};if(!eg(t))return i;for(let[s,o]of Object.entries(t)){let a=sb(s)?[s]:o.chains,u=o.methods||[],c=o.events||[],f=D3(s);i[f]=vK(EK({},i[f]),{chains:Zi(a,(e=i[f])==null?void 0:e.chains),methods:Zi(u,(r=i[f])==null?void 0:r.methods),events:Zi(c,(n=i[f])==null?void 0:n.events)})}return i}var P3={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}},R3={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 li(t,e){let{message:r,code:n}=R3[t];return{message:e?`${r} ${e}`:r,code:n}}function oo(t,e){let{message:r,code:n}=P3[t];return{message:e?`${r} ${e}`:r,code:n}}function Ol(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function eg(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function es(t){return typeof t>"u"}function _r(t,e){return e&&es(t)?!0:typeof t=="string"&&!!t.trim().length}function tg(t,e){return e&&es(t)?!0:typeof t=="number"&&!isNaN(t)}function IK(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Xi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:c}=t.namespaces[o],f=uo(a),d=r[o];(!Xi(Jp(o,d),f)||!Xi(d.methods,u)||!Xi(d.events,c))&&(s=!1)}),s):!1}function Cl(t){return _r(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function B3(t){if(_r(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Cl(r)}}return!1}function _K(t){if(_r(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function SK(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function TK(t){return t?.topic}function CK(t,e){let r=null;return _r(t?.publicKey,!1)||(r=li("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function WA(t){let e=!0;return Ol(t)?t.length&&(e=t.every(r=>_r(r,!1))):e=!1,e}function L3(t,e,r){let n=null;return Ol(e)&&e.length?e.forEach(i=>{n||Cl(i)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Cl(t)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function F3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=L3(i,Jp(i,s),`${e} ${r}`);o&&(n=o)}),n}function M3(t,e){let r=null;return Ol(t)?t.forEach(n=>{r||B3(n)||(r=oo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=oo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function U3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=M3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function q3(t,e){let r=null;return WA(t?.methods)?WA(t?.events)||(r=oo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=oo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function ob(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=q3(n,`${e}, namespace`);i&&(r=i)}),r}function xK(t,e,r){let n=null;if(t&&eg(t)){let i=ob(t,e);i&&(n=i);let s=F3(t,e,r);s&&(n=s)}else n=li("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function V3(t,e){let r=null;if(t&&eg(t)){let n=ob(t,e);n&&(r=n);let i=U3(t,e);i&&(r=i)}else r=li("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function H3(t){return _r(t.protocol,!0)}function NK(t,e){let r=!1;return e&&!t?r=!0:t&&Ol(t)&&t.length&&t.forEach(n=>{r=H3(n)}),r}function OK(t){return typeof t=="number"}function DK(t){return typeof t<"u"&&typeof t!==null}function PK(t){return!(!t||typeof t!="object"||!t.code||!tg(t.code,!1)||!t.message||!_r(t.message,!1))}function RK(t){return!(es(t)||!_r(t.method,!1))}function BK(t){return!(es(t)||es(t.result)&&es(t.error)||!tg(t.id,!1)||!_r(t.jsonrpc,!1))}function LK(t){return!(es(t)||!_r(t.name,!1))}function FK(t,e){return!(!Cl(e)||!x3(t).includes(e))}function MK(t,e,r){return _r(r,!1)?N3(t,e).includes(r):!1}function UK(t,e,r){return _r(r,!1)?O3(t,e).includes(r):!1}function k3(t,e,r){let n=null,i=qK(t),s=VK(e),o=Object.keys(i),a=Object.keys(s),u=XR(Object.keys(t)),c=XR(Object.keys(e)),f=u.filter(d=>!c.includes(d));return f.length&&(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)},rb="base10",or="base16",$p="base64pad",Zp="utf8",nb=0,ru=1,L$=0,JR=1,KA=12,ib=32;function F$(){let t=c3.generateKeyPair();return{privateKey:ct.toString(t.secretKey,or),publicKey:ct.toString(t.publicKey,or)}}function M$(){let t=a3.randomBytes(ib);return ct.toString(t,or)}function U$(t,e){let r=c3.sharedKey(ct.fromString(t,or),ct.fromString(e,or),!0),n=new b$.HKDF(ZA.SHA256,r).expand(ib);return ct.toString(n,or)}function q$(t){let e=ZA.hash(ct.fromString(t,or));return ct.toString(e,or)}function V$(t){let e=ZA.hash(ct.fromString(t,Zp));return ct.toString(e,or)}function w3(t){return ct.fromString(`${t}`,rb)}function xl(t){return Number(ct.toString(t,rb))}function H$(t){let e=w3(typeof t.type<"u"?t.type:nb);if(xl(e)===ru&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ct.fromString(t.senderPublicKey,or):void 0,n=typeof t.iv<"u"?ct.fromString(t.iv,or):a3.randomBytes(KA),i=new o3.ChaCha20Poly1305(ct.fromString(t.symKey,or)).seal(n,ct.fromString(t.message,Zp));return E3({type:e,sealed:i,iv:n,senderPublicKey:r})}function k$(t){let e=new o3.ChaCha20Poly1305(ct.fromString(t.symKey,or)),{sealed:r,iv:n}=sb(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ct.toString(i,Zp)}function E3(t){if(xl(t.type)===ru){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ct.toString(ct.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),$p)}return ct.toString(ct.concat([t.type,t.iv,t.sealed]),$p)}function sb(t){let e=ct.fromString(t,$p),r=e.slice(L$,JR),n=JR;if(xl(r)===ru){let a=n+ib,u=a+KA,c=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:c}}let i=n+KA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function G$(t,e){let r=sb(t);return v3({type:xl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ct.toString(r.senderPublicKey,or):void 0,receiverPublicKey:e?.receiverPublicKey})}function v3(t){let e=t?.type||nb;if(e===ru){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 j$(t){return t.type===ru&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var Q$=Object.defineProperty,XR=Object.getOwnPropertySymbols,z$=Object.prototype.hasOwnProperty,W$=Object.prototype.propertyIsEnumerable,ZR=(t,e,r)=>e in t?Q$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,e3=(t,e)=>{for(var r in e||(e={}))z$.call(e,r)&&ZR(t,r,e[r]);if(XR)for(var r of XR(e))W$.call(e,r)&&ZR(t,r,e[r]);return t},A3="ReactNative",sr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Kp=" ",$$=":",b3="/",ob=2,K$=1e3,I3="js";function ab(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function nu(){return!tu.getDocument()&&!!tu.getNavigator()&&navigator.product===A3}function Nl(){return!ab()&&!!tu.getNavigator()&&!!tu.getDocument()}function ao(){return nu()?sr.reactNative:ab()?sr.node:Nl()?sr.browser:sr.unknown}function Y$(){var t;try{return nu()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function _3(t,e){let r=Wp.parse(t);return r=e3(e3({},r),e),t=Wp.stringify(r),t}function J$(){return S$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function X$(t,e){var r;let n=ao(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=tu.getLocation())==null?void 0:r.host)||"unknown"),i}function S3(){if(ao()===sr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=_$.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 T3(){var t;let e=ao();return e===sr.browser?[e,((t=tu.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function C3(t,e,r){let n=S3(),i=T3();return[[t,e].join("-"),[I3,r].join("-"),n,i].join("/")}function Z$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){let u=r.split("?"),c=C3(t,e,n),f={auth:i,ua:c,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},d=_3(u[1]||"",f);return u[0]+"?"+d}function eK(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 tK(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function x3(t,e=ob){return N3(t.split(b3),e)}function rK(t){return x3(t).join(Kp)}function Zi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function N3(t,e=ob){return t.slice(Math.max(t.length-e,0))}function nK(t){return Object.fromEntries(t.entries())}function iK(t){return new Map(Object.entries(t))}function sK(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var oK=t=>t;function O3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function aK(t){return t.split(Kp).map(e=>O3(e)).join(Kp)}function uK(t=eu.FIVE_MINUTES,e){let r=eu.toMiliseconds(t||eu.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 cK(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 ub(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 lK(t){return ub("topic",t)}function fK(t){return ub("id",t)}function dK(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 hK(t,e){return eu.fromMiliseconds((e||Date.now())+eu.toMiliseconds(t))}function pK(t){return Date.now()>=eu.toMiliseconds(t)}function gK(t,e){return`${t}${e?`:${e}`:""}`}function es(t=[],e=[]){return[...new Set([...t,...e])]}async function yK({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=ao();o===sr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===sr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function mK(t,e){try{return await t.getItem(e)||(Nl()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var D3="irn";function wK(t){return t?.relay||{protocol:D3}}function EK(t){let e=C$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var vK=Object.defineProperty,t3=Object.getOwnPropertySymbols,AK=Object.prototype.hasOwnProperty,bK=Object.prototype.propertyIsEnumerable,r3=(t,e,r)=>e in t?vK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,IK=(t,e)=>{for(var r in e||(e={}))AK.call(e,r)&&r3(t,r,e[r]);if(t3)for(var r of t3(e))bK.call(e,r)&&r3(t,r,e[r]);return t};function P3(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 _K(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):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=Wp.parse(s);return{protocol:n,topic:R3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:P3(o)}}function R3(t){return t.startsWith("//")?t.substring(2):t}function B3(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 SK(t){return`${t.protocol}:${t.topic}@${t.version}?`+Wp.stringify(IK({symKey:t.symKey},B3(t.relay)))}var TK=Object.defineProperty,CK=Object.defineProperties,xK=Object.getOwnPropertyDescriptors,n3=Object.getOwnPropertySymbols,NK=Object.prototype.hasOwnProperty,OK=Object.prototype.propertyIsEnumerable,i3=(t,e,r)=>e in t?TK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,DK=(t,e)=>{for(var r in e||(e={}))NK.call(e,r)&&i3(t,r,e[r]);if(n3)for(var r of n3(e))OK.call(e,r)&&i3(t,r,e[r]);return t},PK=(t,e)=>CK(t,xK(e));function uo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function L3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...uo(r.accounts))}),e}function F3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function M3(t,e){let r=[];return Object.values(t).forEach(n=>{uo(n.accounts).includes(e)&&r.push(...n.events)}),r}function RK(t,e){let r=W3(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 BK(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=YA(e),s=YA(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,d=n[c].methods,g=n[c].events,m=n[c].accounts;f.forEach(y=>{if(!m.some(b=>b.includes(y)))throw new Error(`No accounts provided for chain ${y} in namespace ${c}`)}),o[c]={chains:f,methods:d,events:g,accounts:m}});let a=K3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(y=>{var b,O;return(O=(b=i[c])==null?void 0:b.chains)==null?void 0:O.includes(y)}),d=n[c].methods.filter(y=>{var b,O;return(O=(b=i[c])==null?void 0:b.methods)==null?void 0:O.includes(y)}),g=n[c].events.filter(y=>{var b,O;return(O=(b=i[c])==null?void 0:b.events)==null?void 0:O.includes(y)}),m=f.map(y=>n[c].accounts.filter(b=>b.includes(`${y}:`))).flat();u[c]={chains:f,methods:d,events:g,accounts:m}}),Object.keys(s).forEach(c=>{var f,d,g,m,y,b;if(!n[c])return;let O=(d=(f=s[c])==null?void 0:f.chains)==null?void 0:d.filter(E=>n[c].chains.includes(E)),R=n[c].methods.filter(E=>{var S,N;return(N=(S=s[c])==null?void 0:S.methods)==null?void 0:N.includes(E)}),z=n[c].events.filter(E=>{var S,N;return(N=(S=s[c])==null?void 0:S.events)==null?void 0:N.includes(E)}),M=O?.map(E=>n[c].accounts.filter(S=>S.includes(`${E}:`))).flat();u[c]={chains:es((g=u[c])==null?void 0:g.chains,O),methods:es((m=u[c])==null?void 0:m.methods,R),events:es((y=u[c])==null?void 0:y.events,z),accounts:es((b=u[c])==null?void 0:b.accounts,M)}}),u)}function cb(t){return t.includes(":")}function U3(t){return cb(t)?t.split(":")[0]:t}function YA(t){var e,r,n;let i={};if(!eg(t))return i;for(let[s,o]of Object.entries(t)){let a=cb(s)?[s]:o.chains,u=o.methods||[],c=o.events||[],f=U3(s);i[f]=PK(DK({},i[f]),{chains:es(a,(e=i[f])==null?void 0:e.chains),methods:es(u,(r=i[f])==null?void 0:r.methods),events:es(c,(n=i[f])==null?void 0:n.events)})}return i}var q3={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}},V3={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 li(t,e){let{message:r,code:n}=V3[t];return{message:e?`${r} ${e}`:r,code:n}}function oo(t,e){let{message:r,code:n}=q3[t];return{message:e?`${r} ${e}`:r,code:n}}function Ol(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function eg(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function ts(t){return typeof t>"u"}function _r(t,e){return e&&ts(t)?!0:typeof t=="string"&&!!t.trim().length}function tg(t,e){return e&&ts(t)?!0:typeof t=="number"&&!isNaN(t)}function LK(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Zi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:c}=t.namespaces[o],f=uo(a),d=r[o];(!Zi(Jp(o,d),f)||!Zi(d.methods,u)||!Zi(d.events,c))&&(s=!1)}),s):!1}function Cl(t){return _r(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function H3(t){if(_r(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Cl(r)}}return!1}function FK(t){if(_r(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function MK(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function UK(t){return t?.topic}function qK(t,e){let r=null;return _r(t?.publicKey,!1)||(r=li("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function JA(t){let e=!0;return Ol(t)?t.length&&(e=t.every(r=>_r(r,!1))):e=!1,e}function k3(t,e,r){let n=null;return Ol(e)&&e.length?e.forEach(i=>{n||Cl(i)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Cl(t)||(n=oo("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function G3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=k3(i,Jp(i,s),`${e} ${r}`);o&&(n=o)}),n}function j3(t,e){let r=null;return Ol(t)?t.forEach(n=>{r||H3(n)||(r=oo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=oo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Q3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=j3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function z3(t,e){let r=null;return JA(t?.methods)?JA(t?.events)||(r=oo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=oo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function lb(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=z3(n,`${e}, namespace`);i&&(r=i)}),r}function VK(t,e,r){let n=null;if(t&&eg(t)){let i=lb(t,e);i&&(n=i);let s=G3(t,e,r);s&&(n=s)}else n=li("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function W3(t,e){let r=null;if(t&&eg(t)){let n=lb(t,e);n&&(r=n);let i=Q3(t,e);i&&(r=i)}else r=li("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function $3(t){return _r(t.protocol,!0)}function HK(t,e){let r=!1;return e&&!t?r=!0:t&&Ol(t)&&t.length&&t.forEach(n=>{r=$3(n)}),r}function kK(t){return typeof t=="number"}function GK(t){return typeof t<"u"&&typeof t!==null}function jK(t){return!(!t||typeof t!="object"||!t.code||!tg(t.code,!1)||!t.message||!_r(t.message,!1))}function QK(t){return!(ts(t)||!_r(t.method,!1))}function zK(t){return!(ts(t)||ts(t.result)&&ts(t.error)||!tg(t.id,!1)||!_r(t.jsonrpc,!1))}function WK(t){return!(ts(t)||!_r(t.name,!1))}function $K(t,e){return!(!Cl(e)||!L3(t).includes(e))}function KK(t,e,r){return _r(r,!1)?F3(t,e).includes(r):!1}function YK(t,e,r){return _r(r,!1)?M3(t,e).includes(r):!1}function K3(t,e,r){let n=null,i=JK(t),s=XK(e),o=Object.keys(i),a=Object.keys(s),u=s3(Object.keys(t)),c=s3(Object.keys(e)),f=u.filter(d=>!c.includes(d));return f.length&&(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Xi(o,a)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),Zi(o,a)||(n=li("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 g=uo(e[d].accounts);g.includes(d)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${g.toString()}`))}),o.forEach(d=>{n||(Xi(i[d].methods,s[d].methods)?Xi(i[d].events,s[d].events)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function qK(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 XR(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function VK(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:uo(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 HK(t,e){return tg(t,!1)&&t<=e.max&&t>=e.min}function kK(){let t=ao();return new Promise(e=>{switch(t){case sr.browser:e(G3());break;case sr.reactNative:e(j3());break;case sr.node:e(Q3());break;default:e(!0)}})}function G3(){return Nl()&&navigator?.onLine}async function j3(){return tu()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function Q3(){return!0}function GK(t){switch(ao()){case sr.browser:z3(t);break;case sr.reactNative:W3(t);break;case sr.node:break}}function z3(t){!tu()&&Nl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function W3(t){tu()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var jA={},$A=class{static get(e){return jA[e]}static set(e,r){jA[e]=r}static delete(e){delete jA[e]}};V.BASE10=XA,V.BASE16=or,V.BASE64=$p,V.COLON=F$,V.DEFAULT_DEPTH=rb,V.EMPTY_SPACE=Kp,V.ENV_MAP=sr,V.INTERNAL_ERRORS=R3,V.MemoryStore=$A,V.ONE_THOUSAND=M$,V.REACT_NATIVE_PRODUCT=p3,V.RELAYER_DEFAULT_PROTOCOL=_3,V.SDK_ERRORS=P3,V.SDK_TYPE=y3,V.SLASH=g3,V.TYPE_0=ZA,V.TYPE_1=eu,V.UTF8=Zp,V.appendToQueryString=m3,V.assertType=G$,V.buildApprovedNamespaces=bK,V.calcExpiry=tK,V.capitalize=K$,V.capitalizeWord=I3,V.createDelayedPromise=Y$,V.createExpiringPromise=J$,V.decodeTypeByte=xl,V.decrypt=O$,V.deriveSymKey=T$,V.deserialize=tb,V.encodeTypeByte=f3,V.encrypt=N$,V.engineEvent=nK,V.enumify=$$,V.formatAccountId=s3,V.formatAccountWithChain=y$,V.formatChainId=i3,V.formatExpirerTarget=ib,V.formatIdTarget=Z$,V.formatMessage=b$,V.formatMessageContext=j$,V.formatRelayParams=C3,V.formatRelayRpcUrl=H$,V.formatTopicTarget=X$,V.formatUA=v3,V.formatUri=hK,V.generateKeyPair=_$,V.generateRandomBytes32=S$,V.getAccountsChains=uo,V.getAccountsFromNamespaces=w$,V.getAddressFromAccount=o3,V.getAddressesFromAccounts=m$,V.getAppMetadata=q$,V.getBrowserOnlineStatus=G3,V.getBundleId=U$,V.getChainFromAccount=a3,V.getChainsFromAccounts=u3,V.getChainsFromNamespace=Jp,V.getChainsFromNamespaces=E$,V.getChainsFromRequiredNamespaces=v$,V.getDeepLink=sK,V.getDidAddress=l3,V.getDidAddressSegments=Xp,V.getDidChainId=c3,V.getEnvironment=ao,V.getHttpUrl=k$,V.getInternalError=li,V.getJavascriptID=E3,V.getJavascriptOS=w3,V.getLastItems=b3,V.getNamespacedDidChainId=A$,V.getNamespacesChains=x3,V.getNamespacesEventsForChainId=O3,V.getNamespacesMethodsForChainId=N3,V.getNodeOnlineStatus=Q3,V.getReactNativeOnlineStatus=j3,V.getRelayClientMetadata=V$,V.getRelayProtocolApi=aK,V.getRelayProtocolName=oK,V.getRequiredNamespacesFromNamespaces=AK,V.getSdkError=oo,V.getUniqueValues=JA,V.handleDeeplinkRedirect=iK,V.hasOverlap=Xi,V.hashKey=C$,V.hashMessage=x$,V.isBrowser=Nl,V.isCaipNamespace=sb,V.isConformingNamespaces=k3,V.isExpired=rK,V.isNode=nb,V.isOnline=kK,V.isProposalStruct=SK,V.isReactNative=tu,V.isSessionCompatible=IK,V.isSessionStruct=TK,V.isTypeOneEnvelope=P$,V.isUndefined=es,V.isValidAccountId=B3,V.isValidAccounts=M3,V.isValidActions=q3,V.isValidArray=Ol,V.isValidChainId=Cl,V.isValidChains=L3,V.isValidController=CK,V.isValidErrorReason=PK,V.isValidEvent=LK,V.isValidId=OK,V.isValidNamespaceAccounts=U3,V.isValidNamespaceActions=ob,V.isValidNamespaceChains=F3,V.isValidNamespaceMethodsOrEvents=WA,V.isValidNamespaces=V3,V.isValidNamespacesChainId=FK,V.isValidNamespacesEvent=UK,V.isValidNamespacesRequest=MK,V.isValidNumber=tg,V.isValidObject=eg,V.isValidParams=DK,V.isValidRelay=H3,V.isValidRelays=NK,V.isValidRequest=RK,V.isValidRequestExpiry=HK,V.isValidRequiredNamespaces=xK,V.isValidResponse=BK,V.isValidString=_r,V.isValidUrl=_K,V.mapEntries=W$,V.mapToObj=Q$,V.mergeArrays=Zi,V.normalizeNamespaces=zA,V.objToMap=z$,V.parseAccountId=YA,V.parseChainId=n3,V.parseContextNames=A3,V.parseExpirerTarget=eK,V.parseNamespaceKey=D3,V.parseRelayParams=S3,V.parseTopic=T3,V.parseUri=dK,V.serialize=d3,V.subscribeToBrowserNetworkChange=z3,V.subscribeToNetworkChange=GK,V.subscribeToReactNativeNetworkChange=W3,V.validateDecoding=D$,V.validateEncoding=h3});var $3,K3,Y3,J3,rg,Pl,ab,ng,ts,Rl,ig=he(()=>{l();$3="PARSE_ERROR",K3="INVALID_REQUEST",Y3="METHOD_NOT_FOUND",J3="INVALID_PARAMS",rg="INTERNAL_ERROR",Pl="SERVER_ERROR",ab=[-32700,-32600,-32601,-32602,-32603],ng=[-32e3,-32099],ts={[$3]:{code:-32700,message:"Parse error"},[K3]:{code:-32600,message:"Invalid Request"},[Y3]:{code:-32601,message:"Method not found"},[J3]:{code:-32602,message:"Invalid params"},[rg]:{code:-32603,message:"Internal error"},[Pl]:{code:-32e3,message:"Server error"}},Rl=Pl});function jK(t){return t<=ng[0]&&t>=ng[1]}function sg(t){return ab.includes(t)}function X3(t){return typeof t=="number"}function og(t){return Object.keys(ts).includes(t)?ts[t]:ts[Rl]}function ag(t){let e=Object.values(ts).find(r=>r.code===t);return e||ts[Rl]}function QK(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(!X3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(sg(t.error.code)){let e=ag(t.error.code);if(e.message!==ts[Rl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function ub(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var cb=he(()=>{l();ig()});var eB=v(rs=>{"use strict";l();Object.defineProperty(rs,"__esModule",{value:!0});rs.isBrowserCryptoAvailable=rs.getSubtleCrypto=rs.getBrowerCrypto=void 0;function lb(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}rs.getBrowerCrypto=lb;function Z3(){let t=lb();return t.subtle||t.webkitSubtle}rs.getSubtleCrypto=Z3;function zK(){return!!lb()&&!!Z3()}rs.isBrowserCryptoAvailable=zK});var nB=v(ns=>{"use strict";l();Object.defineProperty(ns,"__esModule",{value:!0});ns.isBrowser=ns.isNode=ns.isReactNative=void 0;function tB(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ns.isReactNative=tB;function rB(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}ns.isNode=rB;function WK(){return!tB()&&!rB()}ns.isBrowser=WK});var fb=v(ug=>{"use strict";l();Object.defineProperty(ug,"__esModule",{value:!0});var iB=(en(),ht(Zr));iB.__exportStar(eB(),ug);iB.__exportStar(nB(),ug)});var Ht={};ft(Ht,{isNodeJs:()=>oB});var sB,oB,aB=he(()=>{l();sB=Se(fb());Qt(Ht,Se(fb()));oB=sB.isNode});function db(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function hb(t=6){return BigInt(db(t))}function pb(t,e,r){return{id:r||db(),jsonrpc:"2.0",method:t,params:e}}function $K(t,e){return{id:t,jsonrpc:"2.0",result:e}}function gb(t,e,r){return{id:t,jsonrpc:"2.0",error:uB(e,r)}}function uB(t,e){return typeof t>"u"?og(rg):(typeof t=="string"&&(t=Object.assign(Object.assign({},og(Pl)),{message:t})),typeof e<"u"&&(t.data=e),sg(t.code)&&(t=ag(t.code)),t)}var cB=he(()=>{l();cb();ig()});function KK(t){return t.includes("*")?lg(t):!/\W/g.test(t)}function cg(t){return t==="*"}function lg(t){return cg(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function YK(t){return!cg(t)&&lg(t)&&!t.split("*")[0].trim()}function JK(t){return!cg(t)&&lg(t)&&!t.split("*")[1].trim()}var lB=he(()=>{l()});var fB=he(()=>{l()});var ru,yb=he(()=>{l();ru=class{}});var mb,fg,Bl,dB=he(()=>{l();yb();mb=class extends ru{constructor(e){super()}},fg=class extends ru{constructor(){super()}},Bl=class extends fg{constructor(e){super()}}});var hB=he(()=>{l()});var pB=he(()=>{l();fB();yb();dB();hB()});var gB=he(()=>{l();pB()});function eY(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function yB(t,e){let r=eY(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function tY(t){return yB(t,XK)}function dg(t){return yB(t,ZK)}function wb(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var XK,ZK,mB=he(()=>{l();XK="^https?:",ZK="^wss?:"});function Eb(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function rY(t){return Eb(t)&&"method"in t}function vb(t){return Eb(t)&&(wB(t)||hg(t))}function wB(t){return"result"in t}function hg(t){return"error"in t}function nY(t){return"error"in t&&t.valid===!1}var EB=he(()=>{l()});var rr={};ft(rr,{DEFAULT_ERROR:()=>Rl,IBaseJsonRpcProvider:()=>fg,IEvents:()=>ru,IJsonRpcConnection:()=>mb,IJsonRpcProvider:()=>Bl,INTERNAL_ERROR:()=>rg,INVALID_PARAMS:()=>J3,INVALID_REQUEST:()=>K3,METHOD_NOT_FOUND:()=>Y3,PARSE_ERROR:()=>$3,RESERVED_ERROR_CODES:()=>ab,SERVER_ERROR:()=>Pl,SERVER_ERROR_CODE_RANGE:()=>ng,STANDARD_ERROR_MAP:()=>ts,formatErrorMessage:()=>uB,formatJsonRpcError:()=>gb,formatJsonRpcRequest:()=>pb,formatJsonRpcResult:()=>$K,getBigIntRpcId:()=>hb,getError:()=>og,getErrorByCode:()=>ag,isHttpUrl:()=>tY,isJsonRpcError:()=>hg,isJsonRpcPayload:()=>Eb,isJsonRpcRequest:()=>rY,isJsonRpcResponse:()=>vb,isJsonRpcResult:()=>wB,isJsonRpcValidationInvalid:()=>nY,isLocalhostUrl:()=>wb,isNodeJs:()=>oB,isReservedErrorCode:()=>sg,isServerErrorCode:()=>jK,isValidDefaultRoute:()=>cg,isValidErrorCode:()=>X3,isValidLeadingWildcardRoute:()=>YK,isValidRoute:()=>KK,isValidTrailingWildcardRoute:()=>JK,isValidWildcardRoute:()=>lg,isWsUrl:()=>dg,parseConnectionError:()=>ub,payloadId:()=>db,validateJsonRpcError:()=>QK});var Ll=he(()=>{l();ig();cb();aB();Qt(rr,Ht);cB();lB();gB();mB();EB()});var vB,pg,AB,Ab=he(()=>{l();vB=Se(ti());Ll();pg=class extends Bl{constructor(e){super(e),this.events=new vB.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(pb(e.method,e.params||[],e.id||hb().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=>{hg(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),vb(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)}},AB=pg});var bB={};ft(bB,{JsonRpcProvider:()=>pg,default:()=>iY});var iY,IB=he(()=>{l();Ab();Ab();iY=AB});var SB=v((zye,_B)=>{"use strict";l();_B.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var NB={};ft(NB,{WsConnection:()=>bb,default:()=>bb});var xB,sY,oY,TB,CB,aY,bb,OB=he(()=>{l();xB=Se(ti());nl();Ll();sY=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:SB(),oY=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",TB=t=>t.split("?")[0],CB=10,aY=sY(),bb=class{constructor(e){if(this.url=e,this.events=new xB.EventEmitter,this.registering=!1,!dg(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){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Qi(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!dg(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=new URLSearchParams(e).get("origin"),s=(0,rr.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!wb(e)},o=new aY(e,[],s);oY()?o.onerror=a=>{let u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}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"?ji(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=gb(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return ub(e,TB(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>CB&&this.events.setMaxListeners(CB)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${TB(this.url)}`));return this.events.emit("register_error",r),r}}});var f6=v((Fl,iu)=>{l();var uY=200,Rb="__lodash_hash_undefined__",bg=1,kB=2,GB=9007199254740991,gg="[object Arguments]",Tb="[object Array]",cY="[object AsyncFunction]",jB="[object Boolean]",QB="[object Date]",zB="[object Error]",WB="[object Function]",lY="[object GeneratorFunction]",yg="[object Map]",$B="[object Number]",fY="[object Null]",nu="[object Object]",DB="[object Promise]",dY="[object Proxy]",KB="[object RegExp]",mg="[object Set]",YB="[object String]",hY="[object Symbol]",pY="[object Undefined]",Cb="[object WeakMap]",JB="[object ArrayBuffer]",wg="[object DataView]",gY="[object Float32Array]",yY="[object Float64Array]",mY="[object Int8Array]",wY="[object Int16Array]",EY="[object Int32Array]",vY="[object Uint8Array]",AY="[object Uint8ClampedArray]",bY="[object Uint16Array]",IY="[object Uint32Array]",_Y=/[\\^$.*+?()[\]{}|]/g,SY=/^\[object .+?Constructor\]$/,TY=/^(?:0|[1-9]\d*)$/,st={};st[gY]=st[yY]=st[mY]=st[wY]=st[EY]=st[vY]=st[AY]=st[bY]=st[IY]=!0;st[gg]=st[Tb]=st[JB]=st[jB]=st[wg]=st[QB]=st[zB]=st[WB]=st[yg]=st[$B]=st[nu]=st[KB]=st[mg]=st[YB]=st[Cb]=!1;var XB=typeof global=="object"&&global&&global.Object===Object&&global,CY=typeof self=="object"&&self&&self.Object===Object&&self,fi=XB||CY||Function("return this")(),ZB=typeof Fl=="object"&&Fl&&!Fl.nodeType&&Fl,PB=ZB&&typeof iu=="object"&&iu&&!iu.nodeType&&iu,e6=PB&&PB.exports===ZB,Ib=e6&&XB.process,RB=function(){try{return Ib&&Ib.binding&&Ib.binding("util")}catch{}}(),BB=RB&&RB.isTypedArray;function xY(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function iJ(t,e){var r=this.__data__,n=_g(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}di.prototype.clear=eJ;di.prototype.delete=tJ;di.prototype.get=rJ;di.prototype.has=nJ;di.prototype.set=iJ;function fo(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,d=!0,g=r&kB?new vg:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=GB}function c6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ql(t){return t!=null&&typeof t=="object"}var l6=BB?PY(BB):AJ;function LJ(t){return RJ(t)?mJ(t):bJ(t)}function FJ(){return[]}function MJ(){return!1}iu.exports=BJ});var Bb=v((Xye,d6)=>{l();d6.exports=function(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],o=[],a={},u=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return s},entries:function(){return o},get:function(f){return a[f.toLowerCase()]},has:function(f){return f.toLowerCase()in a}}}};for(var c in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(f,d,g){s.push(d=d.toLowerCase()),o.push([d,g]),a[d]=a[d]?a[d]+","+g:g}),r(u())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(c,e.headers[c]);i.send(e.body||null)})}});var p6=v((e0e,h6)=>{l();h6.exports=self.fetch||(self.fetch=Bb().default||Bb())});var A8=v(Ee=>{"use strict";l();Object.defineProperty(Ee,"__esModule",{value:!0});var po=ti(),UJ=(R2(),ht(P2)),Gl=Y2(),Qe=h1(),Ln=P1(),g6=(nl(),ht(O2)),qJ=(RP(),ht(PP)),te=Dl(),VJ=(MA(),ht(FA)),Ke=Zs(),HJ=(IB(),ht(bB)),Sr=(Ll(),ht(rr)),kJ=(OB(),ht(NB)),GJ=f6(),jJ=p6();function jl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function QJ(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 zJ=jl(po),WJ=jl(UJ),Tg=QJ(qJ),$J=jl(kJ),KJ=jl(GJ),YJ=jl(jJ);function JJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,b=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,b[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&b[T]===0;)T++;for(var B=u.repeat(A);T>>0,M=new Uint8Array(z);y[A];){var b=r[y.charCodeAt(A)];if(b===255)return;for(var S=0,N=z-1;(b!==0||S>>0,M[N]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");R=S,A++}if(y[A]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var A=g(y);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var XJ=JJ,ZJ=XJ,P6=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")},eX=t=>new TextEncoder().encode(t),tX=t=>new TextDecoder().decode(t),Mb=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")}},Ub=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 R6(this,e)}},qb=class{constructor(e){this.decoders=e}or(e){return R6(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`)}},R6=(t,e)=>new qb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Vb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Mb(e,r,n),this.decoder=new Ub(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Hg=({name:t,prefix:e,encode:r,decode:n})=>new Vb(t,e,r,n),Ql=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=ZJ(r,e);return Hg({prefix:t,name:e,encode:n,decode:s=>P6(i(s))})},rX=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},nX=(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<Hg({prefix:e,name:t,encode(i){return nX(i,n,r)},decode(i){return rX(i,n,r,t)}}),iX=Hg({prefix:"\0",name:"identity",encode:t=>tX(t),decode:t=>eX(t)}),sX=Object.freeze({__proto__:null,identity:iX}),oX=zt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),aX=Object.freeze({__proto__:null,base2:oX}),uX=zt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),cX=Object.freeze({__proto__:null,base8:uX}),lX=Ql({prefix:"9",name:"base10",alphabet:"0123456789"}),fX=Object.freeze({__proto__:null,base10:lX}),dX=zt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),hX=zt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),pX=Object.freeze({__proto__:null,base16:dX,base16upper:hX}),gX=zt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),yX=zt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mX=zt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),wX=zt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),EX=zt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),vX=zt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),AX=zt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),bX=zt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),IX=zt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_X=Object.freeze({__proto__:null,base32:gX,base32upper:yX,base32pad:mX,base32padupper:wX,base32hex:EX,base32hexupper:vX,base32hexpad:AX,base32hexpadupper:bX,base32z:IX}),SX=Ql({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),TX=Ql({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),CX=Object.freeze({__proto__:null,base36:SX,base36upper:TX}),xX=Ql({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),NX=Ql({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),OX=Object.freeze({__proto__:null,base58btc:xX,base58flickr:NX}),DX=zt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),PX=zt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),RX=zt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),BX=zt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),LX=Object.freeze({__proto__:null,base64:DX,base64pad:PX,base64url:RX,base64urlpad:BX}),B6=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}"),FX=B6.reduce((t,e,r)=>(t[r]=e,t),[]),MX=B6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function UX(t){return t.reduce((e,r)=>(e+=FX[r],e),"")}function qX(t){let e=[];for(let r of t){let n=MX[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var VX=Hg({prefix:"\u{1F680}",name:"base256emoji",encode:UX,decode:qX}),HX=Object.freeze({__proto__:null,base256emoji:VX}),kX=L6,y6=128,GX=127,jX=~GX,QX=Math.pow(2,31);function L6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=QX;)e[r++]=t&255|y6,t/=128;for(;t&jX;)e[r++]=t&255|y6,t>>>=7;return e[r]=t|0,L6.bytes=r-n+1,e}var zX=Hb,WX=128,m6=127;function Hb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Hb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&m6)<=WX);return Hb.bytes=s-n,r}var $X=Math.pow(2,7),KX=Math.pow(2,14),YX=Math.pow(2,21),JX=Math.pow(2,28),XX=Math.pow(2,35),ZX=Math.pow(2,42),eZ=Math.pow(2,49),tZ=Math.pow(2,56),rZ=Math.pow(2,63),nZ=function(t){return t<$X?1:t(F6.encode(t,e,r),e),E6=t=>F6.encodingLength(t),kb=(t,e)=>{let r=e.byteLength,n=E6(t),i=n+E6(r),s=new Uint8Array(i+r);return w6(t,s,0),w6(r,s,n),s.set(e,i),new Gb(t,r,e,s)},Gb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},M6=({name:t,code:e,encode:r})=>new jb(t,e,r),jb=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?kb(this.code,r):r.then(n=>kb(this.code,n))}else throw Error("Unknown type, must be binary type")}},U6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),sZ=M6({name:"sha2-256",code:18,encode:U6("SHA-256")}),oZ=M6({name:"sha2-512",code:19,encode:U6("SHA-512")}),aZ=Object.freeze({__proto__:null,sha256:sZ,sha512:oZ}),q6=0,uZ="identity",V6=P6,cZ=t=>kb(q6,V6(t)),lZ={code:q6,name:uZ,encode:V6,digest:cZ},fZ=Object.freeze({__proto__:null,identity:lZ});new TextEncoder,new TextDecoder;var v6={...sX,...aX,...cX,...fX,...pX,..._X,...CX,...OX,...LX,...HX};({...aZ,...fZ});function H6(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function dZ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?H6(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function k6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var A6=k6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Lb=k6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=dZ(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}=te.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Og=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=z6,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=Tg.generateKeyPair(i);return Tg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=te.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Tg.generateKeyPair(s),a=te.generateRandomBytes32(),u=W6;return await Tg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=te.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||te.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=te.validateEncoding(o),u=g6.safeJsonStringify(s);if(te.isTypeOneEnvelope(a)){let g=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(g,m)}let c=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return te.encrypt({type:f,symKey:c,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=te.validateDecoding(s,o);if(te.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,c=a.senderPublicKey;i=await this.generateSharedKey(u,c)}try{let u=this.getSymKey(i),c=te.decrypt({symKey:u,encoded:s});return g6.safeJsonParse(c)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=te.deserialize(i);return te.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=te.deserialize(i);return s.senderPublicKey?VJ.toString(s.senderPublicKey,te.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new Ng(this.core,this.logger)}get context(){return Qe.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(Qb)}catch{e=te.generateRandomBytes32(),await this.keychain.set(Qb,e)}return pZ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Dg=class extends Ln.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=Y6,this.version=J6,this.initialized=!1,this.storagePrefix=hi,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=te.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=te.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Wb=class extends Ln.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new po.EventEmitter,this.name=Z6,this.queue=new Map,this.publishTimeout=Ke.toMiliseconds(Ke.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||X6,u=te.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,d=s?.id||Sr.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:c,tag:f,id:d}},m=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await te.createExpiringPromise(this.rpcPublish(n,i,a,u,c,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(ar.publish,g)}catch(y){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),y;return}finally{clearTimeout(m)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},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=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,c,f,d;let g={method:te.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return te.isUndefined((u=g.params)==null?void 0:u.prompt)&&((c=g.params)==null||delete c.prompt),te.isUndefined((f=g.params)==null?void 0:f.tag)&&((d=g.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){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(Gl.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ar.connection_stalled);return}this.checkQueue()}),this.relayer.on(ar.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},$b=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())}},EZ=Object.defineProperty,vZ=Object.defineProperties,AZ=Object.getOwnPropertyDescriptors,b6=Object.getOwnPropertySymbols,bZ=Object.prototype.hasOwnProperty,IZ=Object.prototype.propertyIsEnumerable,I6=(t,e,r)=>e in t?EZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hl=(t,e)=>{for(var r in e||(e={}))bZ.call(e,r)&&I6(t,r,e[r]);if(b6)for(var r of b6(e))IZ.call(e,r)&&I6(t,r,e[r]);return t},Fb=(t,e)=>vZ(t,AZ(e)),Pg=class extends Ln.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new $b,this.events=new po.EventEmitter,this.name=c8,this.version=l8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),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=te.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 Ke.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)>=f8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!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.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+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=te.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=te.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:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}return te.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:te.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,Fb(Hl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Hl({},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,Hl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Gr.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}=te.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(Gr.deleted,Fb(Hl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Gr.sync)}async reset(){if(this.cached.length){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}=te.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);te.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>Fb(Hl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(ar.connect,async()=>{await this.onConnect()}),this.relayer.on(ar.disconnect,()=>{this.onDisconnect()}),this.events.on(Gr.created,async e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Gr.deleted,async e=>{let r=Gr.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}=te.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)})}},_Z=Object.defineProperty,_6=Object.getOwnPropertySymbols,SZ=Object.prototype.hasOwnProperty,TZ=Object.prototype.propertyIsEnumerable,S6=(t,e,r)=>e in t?_Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CZ=(t,e)=>{for(var r in e||(e={}))SZ.call(e,r)&&S6(t,r,e[r]);if(_6)for(var r of _6(e))TZ.call(e,r)&&S6(t,r,e[r]);return t},Rg=class extends Ln.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new po.EventEmitter,this.name=r8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,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.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(ar.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ar.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Bn.payload,this.onPayloadHandler),this.provider.on(Bn.connect,this.onConnectHandler),this.provider.on(Bn.disconnect,this.onDisconnectHandler),this.provider.on(Bn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||t8})),this.messages=new Dg(this.logger,e.core),this.subscriber=new Pg(this,this.logger),this.publisher=new Wb(this,this.logger),this.relayUrl=e?.relayUrl||Yb,this.projectId=e.projectId,this.bundleId=te.getBundleId(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${zb}...`),await this.restartTransport(zb)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},o8)}get context(){return Qe.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){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Gr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Gr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}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.hasExperiencedNetworkDisruption&&this.connected?await te.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Gr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await te.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Bn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await te.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new HJ.JsonRpcProvider(new $J.default(te.formatRelayRpcUrl({sdkVersion:s8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Sr.isJsonRpcRequest(e)){if(!e.method.endsWith(n8))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(CZ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else Sr.isJsonRpcResponse(e)&&this.events.emit(ar.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ar.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Sr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Bn.payload,this.onPayloadHandler),this.provider.off(Bn.connect,this.onConnectHandler),this.provider.off(Bn.disconnect,this.onDisconnectHandler),this.provider.off(Bn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(ar.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await te.isOnline();te.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(ar.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},Ke.toMiliseconds(i8)))}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},xZ=Object.defineProperty,T6=Object.getOwnPropertySymbols,NZ=Object.prototype.hasOwnProperty,OZ=Object.prototype.propertyIsEnumerable,C6=(t,e,r)=>e in t?xZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x6=(t,e)=>{for(var r in e||(e={}))NZ.call(e,r)&&C6(t,r,e[r]);if(T6)for(var r of T6(e))OZ.call(e,r)&&C6(t,r,e[r]);return t},Bg=class extends Ln.IStore{constructor(e,r,n,i=hi,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=a8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!te.isUndefined(o)?this.map.set(this.getKey(o),o):te.isProposalStruct(o)?this.map.set(o.id,o):te.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=>KJ.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=x6(x6({},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=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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}=te.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}=te.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}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Lg=class{constructor(e,r){this.core=e,this.logger=r,this.name=d8,this.version=h8,this.events=new zJ.default,this.initialized=!1,this.storagePrefix=hi,this.ignoredPayloadTypes=[te.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=te.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=te.calcExpiry(Ke.FIVE_MINUTES),o={protocol:e8},a={topic:i,expiry:s,relay:o,active:!1},u=te.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}=te.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);let u=te.calcExpiry(Ke.FIVE_MINUTES),c={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,c),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(kl.create,c),this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o})),c},this.activate=async({topic:n})=>{this.isInitialized();let i=te.calcExpiry(Ke.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}=te.createDelayedPromise();this.events.once(te.engineEvent("pairing_ping",s),({error:c})=>{c?u(c):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",te.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Sr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=ou[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Sr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=ou[u.request.method].res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Sr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=ou[u.request.method]?ou[u.request.method].res:ou.unregistered_method.res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,te.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=>te.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){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;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(kl.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(()=>{Sr.isJsonRpcResult(i)?this.events.emit(te.engineEvent("pairing_ping",s),{}):Sr.isJsonRpcError(i)&&this.events.emit(te.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(kl.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=te.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(te.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!te.isValidParams(n)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!te.isValidUrl(n.uri)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}let s=te.parseUri(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(o)}if(!(s!=null&&s.symKey)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(o)}},this.isValidPing=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!te.isValidString(n,!1)){let{message:i}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(te.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=te.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new Bg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ar.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{Sr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Sr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(kr.expired,async e=>{let{topic:r}=te.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(kl.expire,{topic:r}))})}},Fg=class extends Ln.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new po.EventEmitter,this.name=p8,this.version=g8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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,expiry:te.calcExpiry(Ke.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(rn.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=Sr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(rn.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(rn.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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:Sr.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(rn.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=te.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(rn.created,e=>{let r=rn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.updated,e=>{let r=rn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.deleted,e=>{let r=rn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{Ke.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Mg=class extends Ln.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new po.EventEmitter,this.name=y8,this.version=m8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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(kr.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(kr.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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 te.formatTopicTarget(e);if(typeof e=="number")return te.formatIdTarget(e);let{message:r}=te.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(kr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=te.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Ke.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(kr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(kr.created,e=>{let r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.expired,e=>{let r=kr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.deleted,e=>{let r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ug=class extends Ln.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=Cg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||te.isReactNative()||!te.isBrowser())return;let i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=xg;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=this.getVerifyUrl(n?.verifyUrl),s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,xg)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(Ke.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(Cg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=Cg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},Ke.toMiliseconds(Ke.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||au;return w8.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${au}`),i=au),i},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=au,this.abortController=new AbortController,this.isDevEnv=te.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Ke.toMiliseconds(e))}},qg=class extends Ln.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=E8,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${v8}/${this.projectId}/clients`;await YJ.default(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=Qe.generateChildLogger(r,this.context)}},DZ=Object.defineProperty,N6=Object.getOwnPropertySymbols,PZ=Object.prototype.hasOwnProperty,RZ=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?DZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D6=(t,e)=>{for(var r in e||(e={}))PZ.call(e,r)&&O6(t,r,e[r]);if(N6)for(var r of N6(e))RZ.call(e,r)&&O6(t,r,e[r]);return t},Vg=class t extends Ln.ICore{constructor(e){super(e),this.protocol=Kb,this.version=G6,this.name=kg,this.events=new po.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||Yb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||j6.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Gl.HeartBeat,this.crypto=new Og(this,this.logger,e?.keychain),this.history=new Fg(this,this.logger),this.expirer=new Mg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new WJ.default(D6(D6({},Q6),e?.storageOptions)),this.relayer=new Rg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Lg(this,this.logger),this.verify=new Ug(this.projectId||"",this.logger),this.echoClient=new qg(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(u8,n),r}get context(){return Qe.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}}},BZ=Vg;Ee.CORE_CONTEXT=kg,Ee.CORE_DEFAULT=j6,Ee.CORE_PROTOCOL=Kb,Ee.CORE_STORAGE_OPTIONS=Q6,Ee.CORE_STORAGE_PREFIX=hi,Ee.CORE_VERSION=G6,Ee.CRYPTO_CLIENT_SEED=Qb,Ee.CRYPTO_CONTEXT=z6,Ee.CRYPTO_JWT_TTL=W6,Ee.Core=BZ,Ee.Crypto=Og,Ee.ECHO_CONTEXT=E8,Ee.ECHO_URL=v8,Ee.EXPIRER_CONTEXT=y8,Ee.EXPIRER_DEFAULT_TTL=wZ,Ee.EXPIRER_EVENTS=kr,Ee.EXPIRER_STORAGE_VERSION=m8,Ee.EchoClient=qg,Ee.Expirer=Mg,Ee.HISTORY_CONTEXT=p8,Ee.HISTORY_EVENTS=rn,Ee.HISTORY_STORAGE_VERSION=g8,Ee.JsonRpcHistory=Fg,Ee.KEYCHAIN_CONTEXT=$6,Ee.KEYCHAIN_STORAGE_VERSION=K6,Ee.KeyChain=Ng,Ee.MESSAGES_CONTEXT=Y6,Ee.MESSAGES_STORAGE_VERSION=J6,Ee.MessageTracker=Dg,Ee.PAIRING_CONTEXT=d8,Ee.PAIRING_DEFAULT_TTL=mZ,Ee.PAIRING_EVENTS=kl,Ee.PAIRING_RPC_OPTS=ou,Ee.PAIRING_STORAGE_VERSION=h8,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=f8,Ee.PUBLISHER_CONTEXT=Z6,Ee.PUBLISHER_DEFAULT_TTL=X6,Ee.Pairing=Lg,Ee.RELAYER_CONTEXT=r8,Ee.RELAYER_DEFAULT_LOGGER=t8,Ee.RELAYER_DEFAULT_PROTOCOL=e8,Ee.RELAYER_DEFAULT_RELAY_URL=Yb,Ee.RELAYER_EVENTS=ar,Ee.RELAYER_FAILOVER_RELAY_URL=zb,Ee.RELAYER_PROVIDER_EVENTS=Bn,Ee.RELAYER_RECONNECT_TIMEOUT=i8,Ee.RELAYER_SDK_VERSION=s8,Ee.RELAYER_STORAGE_OPTIONS=gZ,Ee.RELAYER_SUBSCRIBER_SUFFIX=n8,Ee.RELAYER_TRANSPORT_CUTOFF=o8,Ee.Relayer=Rg,Ee.STORE_STORAGE_VERSION=a8,Ee.SUBSCRIBER_CONTEXT=c8,Ee.SUBSCRIBER_DEFAULT_TTL=yZ,Ee.SUBSCRIBER_EVENTS=Gr,Ee.SUBSCRIBER_STORAGE_VERSION=l8,Ee.Store=Bg,Ee.Subscriber=Pg,Ee.TRUSTED_VERIFY_URLS=w8,Ee.VERIFY_CONTEXT=Cg,Ee.VERIFY_FALLBACK_SERVER=xg,Ee.VERIFY_SERVER=au,Ee.Verify=Ug,Ee.WALLETCONNECT_CLIENT_ID=u8,Ee.default=Vg});var P8=v(Ye=>{"use strict";l();Object.defineProperty(Ye,"__esModule",{value:!0});var Mn=A8(),Gg=h1(),_8=P1(),G=Dl(),S8=ti(),tt=Zs(),wt=(Ll(),ht(rr));function LZ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var FZ=LZ(S8),tI="wc",rI=2,nI="client",$g=`${tI}@${rI}:${nI}:`,jg={name:nI,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},MZ={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"},UZ={database:":memory:"},Jb="WALLETCONNECT_DEEPLINK_CHOICE",qZ={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},VZ="history",HZ="0.3",T8="proposal",kZ=tt.THIRTY_DAYS,C8="Proposal expired",x8="session",Wl=tt.SEVEN_DAYS,N8="engine",uu={wc_sessionPropose:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1115}}},Qg={min:tt.FIVE_MINUTES,max:tt.SEVEN_DAYS},Fn={idle:"IDLE",active:"ACTIVE"},O8="request",D8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],GZ=Object.defineProperty,jZ=Object.defineProperties,QZ=Object.getOwnPropertyDescriptors,b8=Object.getOwnPropertySymbols,zZ=Object.prototype.hasOwnProperty,WZ=Object.prototype.propertyIsEnumerable,I8=(t,e,r)=>e in t?GZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))zZ.call(e,r)&&I8(t,r,e[r]);if(b8)for(var r of b8(e))WZ.call(e,r)&&I8(t,r,e[r]);return t},zl=(t,e)=>jZ(t,QZ(e)),Xb=class extends _8.IEngine{constructor(e){super(e),this.name=N8,this.events=new FZ.default,this.initialized=!1,this.ignoredPayloadTypes=[G.TYPE_1],this.requestQueue={state:Fn.idle,queue:[]},this.sessionRequestQueue={state:Fn.idle,queue:[]},this.requestQueueDelay=tt.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(uu)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=zl(Er({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,c=i,f,d=!1;if(c&&(d=this.client.core.pairing.pairings.get(c).active),!c||!d){let{topic:M,uri:b}=await this.client.core.pairing.create();c=M,f=b}let g=await this.client.core.crypto.generateKeyPair(),m=Er({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Mn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:y,resolve:A,done:O}=G.createDelayedPromise(tt.FIVE_MINUTES,C8);if(this.events.once(G.engineEvent("session_connect"),async({error:M,session:b})=>{if(M)y(M);else if(b){b.self.publicKey=g;let S=zl(Er({},b),{requiredNamespaces:b.requiredNamespaces,optionalNamespaces:b.optionalNamespaces});await this.client.session.set(b.topic,S),await this.setExpiry(b.topic,b.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:b.peer.metadata}),A(S)}}),!c){let{message:M}=G.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(M)}let R=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:m}),z=G.calcExpiry(tt.FIVE_MINUTES);return await this.setProposal(R,Er({id:R,expiry:z},m)),{uri:f,approval:O}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await 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:c,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",G.isValidObject(f)||(f=G.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),m=c.publicKey,y=await this.client.core.crypto.generateSharedKey(g,m);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:c.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let A=Er({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:G.calcExpiry(Wl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(y),await this.sendRequest({topic:y,method:"wc_sessionSettle",params:A,throwOnFailedPublish:!0});let O=zl(Er({},A),{topic:y,pairingTopic:u,acknowledged:!1,self:A.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:g});return await this.client.session.set(y,O),await this.setExpiry(y,G.calcExpiry(Wl)),{topic:y,acknowledged:()=>new Promise(R=>setTimeout(()=>R(this.client.session.get(y)),500))}},this.reject=async r=>{await 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,G.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_update",s),({error:c})=>{c?u(c):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,G.calcExpiry(Wl)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=wt.payloadId(),{done:u,resolve:c,reject:f}=G.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(G.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):c(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await G.getDeepLink(this.client.core.storage,Jb);G.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;wt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):wt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();this.events.once(G.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=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:G.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>G.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(Jb).catch(s=>this.client.logger.warn(s)),this.getPendingSessionRequests().forEach(s=>{s.topic===r&&this.deletePendingSessionRequest(s.id,G.getSdkError("USER_DISCONNECTED"))})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,G.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.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Fn.idle)},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=uu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,G.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:c}=r,f=wt.formatJsonRpcRequest(i,s,u);if(G.isBrowser()&&D8.includes(i)){let m=G.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:m})}let d=await this.client.core.crypto.encode(n,f),g=uu[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),c?(g.internal=zl(Er({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(m=>this.client.logger.error(m)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=wt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),c=await this.client.core.history.get(i,n),f=uu[c.request.method].res;o?(f.internal=zl(Er({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=wt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=uu[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=>{G.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{G.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Fn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Fn.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Fn.idle},this.processRequest=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.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=G.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(Er({},n.params));let o=G.calcExpiry(tt.FIVE_MINUTES),a=Er({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=G.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:c})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(wt.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 c=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else wt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.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:c,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:m}=n.params,y=Er({topic:r,relay:o,expiry:u,namespaces:c,acknowledged:!0,pairingTopic:m,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(G.engineEvent("session_connect"),{session:y}),this.cleanupDuplicatePairings(y)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(G.engineEvent("session_approve",i),{})):wt.isJsonRpcError(n)&&(await this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(Er({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),G.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_update",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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,G.calcExpiry(Wl)),await this.sendResult({id:i,topic:r,result:!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;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_extend",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!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(()=>{wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_ping",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Mn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(Er({topic:r},s));let o=G.hashMessage(JSON.stringify(wt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),c={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(c),this.addSessionRequestToSessionRequestQueue(c),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Er({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),G.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Fn.idle,this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Fn.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Fn.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,wt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(G.isUndefined(n)||await this.isValidPairingTopic(n),!G.isValidRelays(a,!0)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!G.isUndefined(i)&&G.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!G.isUndefined(s)&&G.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=G.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!G.isValidParams(r))throw new Error(G.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=G.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let c=G.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!G.isValidString(s,!0)){let{message:f}=G.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!G.isValidParams(r)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!G.isValidErrorReason(i)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!G.isValidParams(r)){let{message:c}=G.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!G.isValidRelay(n)){let{message:c}=G.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let a=G.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=G.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(G.isExpired(o)){let{message:c}=G.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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=G.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=G.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(!G.isValidNamespacesChainId(a,s)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!G.isValidRequest(i)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!G.isValidNamespacesRequest(a,s,i.method)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!G.isValidRequestExpiry(o,Qg)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Qg.min} and ${Qg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!G.isValidParams(r)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!G.isValidResponse(s)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!G.isValidParams(r)){let{message:a}=G.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(!G.isValidNamespacesChainId(o,s)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!G.isValidEvent(i)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!G.isValidNamespacesEvent(o,s,i.name)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Mn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!G.isValidString(i,!1)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=G.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Mn.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);try{wt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):wt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Mn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=G.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,G.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}))})}registerPairingEvents(){this.client.core.pairing.events.on(Mn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=G.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=G.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(G.isValidString(e,!1)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!G.isValidId(e)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=G.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Zb=class extends Mn.Store{constructor(e,r){super(e,r,T8,$g),this.core=e,this.logger=r}},zg=class extends Mn.Store{constructor(e,r){super(e,r,x8,$g),this.core=e,this.logger=r}},eI=class extends Mn.Store{constructor(e,r){super(e,r,O8,$g,n=>n.id),this.core=e,this.logger=r}},Wg=class t extends _8.ISignClient{constructor(e){super(e),this.protocol=tI,this.version=rI,this.name=jg.name,this.events=new S8.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||jg.name,this.metadata=e?.metadata||G.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Gg.pino(Gg.getDefaultLoggerOptions({level:e?.logger||jg.logger}));this.core=e?.core||new Mn.Core(e),this.logger=Gg.generateChildLogger(r,this.name),this.session=new zg(this.core,this.logger),this.proposal=new Zb(this.core,this.logger),this.pendingRequest=new eI(this.core,this.logger),this.engine=new Xb(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Gg.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.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},$Z=zg,KZ=Wg;Ye.ENGINE_CONTEXT=N8,Ye.ENGINE_QUEUE_STATES=Fn,Ye.ENGINE_RPC_OPTS=uu,Ye.HISTORY_CONTEXT=VZ,Ye.HISTORY_EVENTS=qZ,Ye.HISTORY_STORAGE_VERSION=HZ,Ye.METHODS_TO_VERIFY=D8,Ye.PROPOSAL_CONTEXT=T8,Ye.PROPOSAL_EXPIRY=kZ,Ye.PROPOSAL_EXPIRY_MESSAGE=C8,Ye.REQUEST_CONTEXT=O8,Ye.SESSION_CONTEXT=x8,Ye.SESSION_EXPIRY=Wl,Ye.SESSION_REQUEST_EXPIRY_BOUNDARIES=Qg,Ye.SIGN_CLIENT_CONTEXT=nI,Ye.SIGN_CLIENT_DEFAULT=jg,Ye.SIGN_CLIENT_EVENTS=MZ,Ye.SIGN_CLIENT_PROTOCOL=tI,Ye.SIGN_CLIENT_STORAGE_OPTIONS=UZ,Ye.SIGN_CLIENT_STORAGE_PREFIX=$g,Ye.SIGN_CLIENT_VERSION=rI,Ye.SessionStore=$Z,Ye.SignClient=KZ,Ye.WALLETCONNECT_DEEPLINK_CHOICE=Jb,Ye.default=Wg});var Kg=v(os=>{"use strict";l();Object.defineProperty(os,"__esModule",{value:!0});os.OptionalOperation=os.Operation=void 0;var YZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(YZ=os.Operation||(os.Operation={}));var JZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(JZ=os.OptionalOperation||(os.OptionalOperation={}))});var iI=v(Un=>{"use strict";l();Object.defineProperty(Un,"__esModule",{value:!0});Un.WALLETCONNECT_SIGN_LOGIN_DELAY=Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Un.WALLETCONNECT_MULTIVERSX_METHODS=Un.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var R8=Kg();Un.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Un.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(R8.Operation);Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(R8.OptionalOperation);Un.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var aI=v(nn=>{"use strict";l();Object.defineProperty(nn,"__esModule",{value:!0});nn.WalletConnectV2ProviderErrorMessagesEnum=nn.ErrBadAddress=nn.ErrNotImplemented=nn.Err=void 0;var $l=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};nn.Err=$l;var sI=class extends $l{constructor(){super("Method not yet implemented")}};nn.ErrNotImplemented=sI;var oI=class extends $l{constructor(e,r){super(`Bad address: ${e}`,r)}};nn.ErrBadAddress=oI;var XZ;(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.unableToSign="WalletConnect could not sign the message",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",t.invalidGuardian="WalletConnect: Invalid Guardian"})(XZ=nn.WalletConnectV2ProviderErrorMessagesEnum||(nn.WalletConnectV2ProviderErrorMessagesEnum={}))});var cI=v(Yg=>{"use strict";l();Object.defineProperty(Yg,"__esModule",{value:!0});Yg.Logger=void 0;var uI=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Yg.Logger=uI});var B8=v(()=>{"use strict";l();global.Buffer||(global.Buffer=Vs().Buffer)});var F8=v(L8=>{"use strict";l();Object.defineProperty(L8,"__esModule",{value:!0})});var U8=v(M8=>{"use strict";l();Object.defineProperty(M8,"__esModule",{value:!0})});var q8=v(cu=>{"use strict";l();var ZZ=cu&&cu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cu,"__esModule",{value:!0});cu.RelayedTransactionV1Builder=void 0;var eee=ZZ(Yt()),lI=pt(),tee=Le(),ree=Yr(),nee=Yn(),fI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new tee.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new nee.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new ree.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new lI.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new lI.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new eee.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:h.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new lI.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?h.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?h.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};cu.RelayedTransactionV1Builder=fI});var V8=v(Jg=>{"use strict";l();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.Code=void 0;var iee=yE(),see=32,dI=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}computeHash(){let e=iee(see).update(this.valueOf()).digest();return h.Buffer.from(e)}};Jg.Code=dI});var k8=v(H8=>{"use strict";l();Object.defineProperty(H8,"__esModule",{value:!0})});var z8=v(fu=>{"use strict";l();Object.defineProperty(fu,"__esModule",{value:!0});fu.bech32m=fu.bech32=void 0;var Xg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",j8={};for(let t=0;t>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 G8(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=lu(e)^n>>5}e=lu(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=G8(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");c=lu(c)^g,f+=Xg.charAt(g)}for(let d=0;d<6;++d)c=lu(c);c^=e;for(let d=0;d<6;++d){let g=c>>(5-d)*5&31;f+=Xg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),c=o.toUpperCase();if(o!==u&&o!==c)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let m=G8(d);if(typeof m=="string")return m;let y=[];for(let A=0;A=g.length)&&y.push(R)}return m!==e?"Invalid checksum for "+o:{prefix:d,words:y}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:oee,fromWordsUnsafe:aee,fromWords:uee}}fu.bech32=Q8("bech32");fu.bech32m=Q8("bech32m")});var $8=v(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.TokenTransferProperties=jr.TransactionMetadataTransfer=jr.TransactionMetadata=jr.TransactionToDecode=jr.TransactionDecoder=void 0;var W8=z8(),pI=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new go;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Zg;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new go;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new go;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return h.Buffer.from(e).toString("base64")}base64Decode(e){return h.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new go;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=h.Buffer.from(e,"hex"),n=W8.bech32.toWords(r);return W8.bech32.encode("erd",n)}isAddressValid(e){return h.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return h.Buffer.from(e,"base64").toString("hex")}hexToString(e){return h.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};jr.TransactionDecoder=pI;var Zg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};jr.TransactionToDecode=Zg;var go=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};jr.TransactionMetadata=go;var gI=class{constructor(){this.value=BigInt(0)}};jr.TransactionMetadataTransfer=gI;var yI=class{};jr.TokenTransferProperties=yI});var mI=v(ey=>{"use strict";l();Object.defineProperty(ey,"__esModule",{value:!0});ey.ReturnCode=void 0;var ze=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};ey.ReturnCode=ze;ze.None=new ze("");ze.Ok=new ze("ok");ze.FunctionNotFound=new ze("function not found");ze.FunctionWrongSignature=new ze("wrong signature for function");ze.ContractNotFound=new ze("contract not found");ze.UserError=new ze("user error");ze.OutOfGas=new ze("out of gas");ze.AccountCollision=new ze("account collision");ze.OutOfFunds=new ze("out of funds");ze.CallStackOverFlow=new ze("call stack overflow");ze.ContractInvalid=new ze("contract invalid");ze.ExecutionFailed=new ze("execution failed");ze.Unknown=new ze("unknown")});var J8=v(ty=>{"use strict";l();Object.defineProperty(ty,"__esModule",{value:!0});ty.ResultsParser=void 0;var cee=$8(),K8=pt(),Y8=Le(),as=pa(),lee=na(),du=mI(),hu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(hu||(hu={}));var wI;(function(t){t.TooMuchGas="@too much gas provided for processing"})(wI||(wI={}));var fee={argsSerializer:new lee.ArgSerializer},EI=class{constructor(e){e=Object.assign(Object.assign({},fee),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new du.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new du.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return as.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return as.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return as.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return as.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return as.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return as.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return as.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return as.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new Y8.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new cee.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:du.ReturnCode.None,returnMessage:du.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:du.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(hu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(hu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(wI.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new K8.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(hu.OnWriteLog,u=>u.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new K8.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(hu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),c=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&c});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||h.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new Y8.ErrCannotParseContractResults("no return code");return{returnCode:du.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){var n,i;let s={},o=e.topics.map(m=>h.Buffer.from(m.valueOf())).slice(1),a=((n=e.dataPayload)===null||n===void 0?void 0:n.valueOf())||h.Buffer.from([]),u=((i=e.additionalData)===null||i===void 0?void 0:i.map(m=>h.Buffer.from(m.valueOf())))||[];u.length==0&&a.length>0&&u.push(h.Buffer.from(a));let c=r.inputs.filter(m=>m.indexed),f=this.argsSerializer.buffersToValues(o,c);for(let m=0;m!m.indexed),g=this.argsSerializer.buffersToValues(u,d);for(let m=0;m{"use strict";l();var dee=_t&&_t.__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]}),ur=_t&&_t.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dee(e,t,r)};Object.defineProperty(_t,"__esModule",{value:!0});ur(na(),_t);ur(V8(),_t);ur(Lw(),_t);ur(OE(),_t);ur(qc(),_t);ur(qE(),_t);ur(BE(),_t);ur(k8(),_t);ur(kE(),_t);ur(Vc(),_t);ur(J8(),_t);ur(mI(),_t);ur(Pv(),_t);ur(KE(),_t);ur(xt(),_t)});var Z8=v(ry=>{"use strict";l();Object.defineProperty(ry,"__esModule",{value:!0});ry.RelayedTransactionV2Builder=void 0;var X8=Le(),Kl=vI(),hee=Yr(),pee=Yn(),AI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new X8.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new X8.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Kl.ArgSerializer().valuesToString([new Kl.AddressValue(this.innerTransaction.getReceiver()),new Kl.U64Value(this.innerTransaction.getNonce().valueOf()),new Kl.BytesValue(this.innerTransaction.getData().valueOf()),new Kl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new pee.TransactionPayload(r),i=new hee.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};ry.RelayedTransactionV2Builder=AI});var II=v(lt=>{"use strict";l();var gee=lt&<.__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]}),yee=lt&<.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eL=lt&<.__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)&&gee(e,t,r);return yee(e,t),e},mee=lt&<.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lt,"__esModule",{value:!0});lt.addressToHex=lt.bufferToHex=lt.utf8ToHex=lt.bigIntToHex=lt.bigIntToBuffer=lt.bufferToBigInt=lt.stringToBuffer=void 0;var wee=mee(Yt()),Eee=pt(),bI=eL(Tc()),tL=eL(Md());function vee(t){return h.Buffer.from(t)}lt.stringToBuffer=vee;function Aee(t){return t.length==0?new wee.default(0):bI.bufferToBigInt(t)}lt.bufferToBigInt=Aee;function bee(t){return t==0?h.Buffer.from([]):bI.bigIntToBuffer(t)}lt.bigIntToBuffer=bee;function Iee(t){return t==0?"":bI.getHexMagnitudeOfBigInt(t)}lt.bigIntToHex=Iee;function _ee(t){let e=h.Buffer.from(t).toString("hex");return tL.zeroPadStringIfOddLength(e)}lt.utf8ToHex=_ee;function See(t){let e=t.toString("hex");return tL.zeroPadStringIfOddLength(e)}lt.bufferToHex=See;function Tee(t){return Eee.Address.fromBech32(t.toString()).pubkey().toString("hex")}lt.addressToHex=Tee});var nL=v(ny=>{"use strict";l();Object.defineProperty(ny,"__esModule",{value:!0});ny.TokenOperationsFactory=void 0;var _I=Os(),Cee=pa(),rL=xc(),xee=Yr(),Nee=Yn(),ne=II(),SI=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true"),this.falseAsHex=ne.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){Cee.Logger.info(` + Approved: ${g.toString()}`))}),o.forEach(d=>{n||(Zi(i[d].methods,s[d].methods)?Zi(i[d].events,s[d].events)||(n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=li("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function JK(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 s3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function XK(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:uo(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 ZK(t,e){return tg(t,!1)&&t<=e.max&&t>=e.min}function eY(){let t=ao();return new Promise(e=>{switch(t){case sr.browser:e(Y3());break;case sr.reactNative:e(J3());break;case sr.node:e(X3());break;default:e(!0)}})}function Y3(){return Nl()&&navigator?.onLine}async function J3(){return nu()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function X3(){return!0}function tY(t){switch(ao()){case sr.browser:Z3(t);break;case sr.reactNative:eB(t);break;case sr.node:break}}function Z3(t){!nu()&&Nl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function eB(t){nu()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var $A={},XA=class{static get(e){return $A[e]}static set(e,r){$A[e]=r}static delete(e){delete $A[e]}};V.BASE10=rb,V.BASE16=or,V.BASE64=$p,V.COLON=$$,V.DEFAULT_DEPTH=ob,V.EMPTY_SPACE=Kp,V.ENV_MAP=sr,V.INTERNAL_ERRORS=V3,V.MemoryStore=XA,V.ONE_THOUSAND=K$,V.REACT_NATIVE_PRODUCT=A3,V.RELAYER_DEFAULT_PROTOCOL=D3,V.SDK_ERRORS=q3,V.SDK_TYPE=I3,V.SLASH=b3,V.TYPE_0=nb,V.TYPE_1=ru,V.UTF8=Zp,V.appendToQueryString=_3,V.assertType=tK,V.buildApprovedNamespaces=BK,V.calcExpiry=hK,V.capitalize=aK,V.capitalizeWord=O3,V.createDelayedPromise=uK,V.createExpiringPromise=cK,V.decodeTypeByte=xl,V.decrypt=k$,V.deriveSymKey=U$,V.deserialize=sb,V.encodeTypeByte=w3,V.encrypt=H$,V.engineEvent=gK,V.enumify=oK,V.formatAccountId=d3,V.formatAccountWithChain=x$,V.formatChainId=f3,V.formatExpirerTarget=ub,V.formatIdTarget=fK,V.formatMessage=B$,V.formatMessageContext=rK,V.formatRelayParams=B3,V.formatRelayRpcUrl=Z$,V.formatTopicTarget=lK,V.formatUA=C3,V.formatUri=SK,V.generateKeyPair=F$,V.generateRandomBytes32=M$,V.getAccountsChains=uo,V.getAccountsFromNamespaces=O$,V.getAddressFromAccount=h3,V.getAddressesFromAccounts=N$,V.getAppMetadata=J$,V.getBrowserOnlineStatus=Y3,V.getBundleId=Y$,V.getChainFromAccount=p3,V.getChainsFromAccounts=g3,V.getChainsFromNamespace=Jp,V.getChainsFromNamespaces=D$,V.getChainsFromRequiredNamespaces=P$,V.getDeepLink=mK,V.getDidAddress=m3,V.getDidAddressSegments=Xp,V.getDidChainId=y3,V.getEnvironment=ao,V.getHttpUrl=eK,V.getInternalError=li,V.getJavascriptID=T3,V.getJavascriptOS=S3,V.getLastItems=N3,V.getNamespacedDidChainId=R$,V.getNamespacesChains=L3,V.getNamespacesEventsForChainId=M3,V.getNamespacesMethodsForChainId=F3,V.getNodeOnlineStatus=X3,V.getReactNativeOnlineStatus=J3,V.getRelayClientMetadata=X$,V.getRelayProtocolApi=EK,V.getRelayProtocolName=wK,V.getRequiredNamespacesFromNamespaces=RK,V.getSdkError=oo,V.getUniqueValues=tb,V.handleDeeplinkRedirect=yK,V.hasOverlap=Zi,V.hashKey=q$,V.hashMessage=V$,V.isBrowser=Nl,V.isCaipNamespace=cb,V.isConformingNamespaces=K3,V.isExpired=pK,V.isNode=ab,V.isOnline=eY,V.isProposalStruct=MK,V.isReactNative=nu,V.isSessionCompatible=LK,V.isSessionStruct=UK,V.isTypeOneEnvelope=j$,V.isUndefined=ts,V.isValidAccountId=H3,V.isValidAccounts=j3,V.isValidActions=z3,V.isValidArray=Ol,V.isValidChainId=Cl,V.isValidChains=k3,V.isValidController=qK,V.isValidErrorReason=jK,V.isValidEvent=WK,V.isValidId=kK,V.isValidNamespaceAccounts=Q3,V.isValidNamespaceActions=lb,V.isValidNamespaceChains=G3,V.isValidNamespaceMethodsOrEvents=JA,V.isValidNamespaces=W3,V.isValidNamespacesChainId=$K,V.isValidNamespacesEvent=YK,V.isValidNamespacesRequest=KK,V.isValidNumber=tg,V.isValidObject=eg,V.isValidParams=GK,V.isValidRelay=$3,V.isValidRelays=HK,V.isValidRequest=QK,V.isValidRequestExpiry=ZK,V.isValidRequiredNamespaces=VK,V.isValidResponse=zK,V.isValidString=_r,V.isValidUrl=FK,V.mapEntries=sK,V.mapToObj=nK,V.mergeArrays=es,V.normalizeNamespaces=YA,V.objToMap=iK,V.parseAccountId=eb,V.parseChainId=l3,V.parseContextNames=x3,V.parseExpirerTarget=dK,V.parseNamespaceKey=U3,V.parseRelayParams=P3,V.parseTopic=R3,V.parseUri=_K,V.serialize=E3,V.subscribeToBrowserNetworkChange=Z3,V.subscribeToNetworkChange=tY,V.subscribeToReactNativeNetworkChange=eB,V.validateDecoding=G$,V.validateEncoding=v3});var tB,rB,nB,iB,rg,Pl,fb,ng,rs,Rl,ig=he(()=>{l();tB="PARSE_ERROR",rB="INVALID_REQUEST",nB="METHOD_NOT_FOUND",iB="INVALID_PARAMS",rg="INTERNAL_ERROR",Pl="SERVER_ERROR",fb=[-32700,-32600,-32601,-32602,-32603],ng=[-32e3,-32099],rs={[tB]:{code:-32700,message:"Parse error"},[rB]:{code:-32600,message:"Invalid Request"},[nB]:{code:-32601,message:"Method not found"},[iB]:{code:-32602,message:"Invalid params"},[rg]:{code:-32603,message:"Internal error"},[Pl]:{code:-32e3,message:"Server error"}},Rl=Pl});function rY(t){return t<=ng[0]&&t>=ng[1]}function sg(t){return fb.includes(t)}function sB(t){return typeof t=="number"}function og(t){return Object.keys(rs).includes(t)?rs[t]:rs[Rl]}function ag(t){let e=Object.values(rs).find(r=>r.code===t);return e||rs[Rl]}function nY(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(!sB(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(sg(t.error.code)){let e=ag(t.error.code);if(e.message!==rs[Rl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function db(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var hb=he(()=>{l();ig()});var aB=A(ns=>{"use strict";l();Object.defineProperty(ns,"__esModule",{value:!0});ns.isBrowserCryptoAvailable=ns.getSubtleCrypto=ns.getBrowerCrypto=void 0;function pb(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}ns.getBrowerCrypto=pb;function oB(){let t=pb();return t.subtle||t.webkitSubtle}ns.getSubtleCrypto=oB;function iY(){return!!pb()&&!!oB()}ns.isBrowserCryptoAvailable=iY});var lB=A(is=>{"use strict";l();Object.defineProperty(is,"__esModule",{value:!0});is.isBrowser=is.isNode=is.isReactNative=void 0;function uB(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}is.isReactNative=uB;function cB(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}is.isNode=cB;function sY(){return!uB()&&!cB()}is.isBrowser=sY});var gb=A(ug=>{"use strict";l();Object.defineProperty(ug,"__esModule",{value:!0});var fB=(en(),ht(Zr));fB.__exportStar(aB(),ug);fB.__exportStar(lB(),ug)});var kt={};ft(kt,{isNodeJs:()=>hB});var dB,hB,pB=he(()=>{l();dB=be(gb());Qt(kt,be(gb()));hB=dB.isNode});function yb(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function mb(t=6){return BigInt(yb(t))}function wb(t,e,r){return{id:r||yb(),jsonrpc:"2.0",method:t,params:e}}function oY(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Eb(t,e,r){return{id:t,jsonrpc:"2.0",error:gB(e,r)}}function gB(t,e){return typeof t>"u"?og(rg):(typeof t=="string"&&(t=Object.assign(Object.assign({},og(Pl)),{message:t})),typeof e<"u"&&(t.data=e),sg(t.code)&&(t=ag(t.code)),t)}var yB=he(()=>{l();hb();ig()});function aY(t){return t.includes("*")?lg(t):!/\W/g.test(t)}function cg(t){return t==="*"}function lg(t){return cg(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function uY(t){return!cg(t)&&lg(t)&&!t.split("*")[0].trim()}function cY(t){return!cg(t)&&lg(t)&&!t.split("*")[1].trim()}var mB=he(()=>{l()});var wB=he(()=>{l()});var iu,vb=he(()=>{l();iu=class{}});var Ab,fg,Bl,EB=he(()=>{l();vb();Ab=class extends iu{constructor(e){super()}},fg=class extends iu{constructor(){super()}},Bl=class extends fg{constructor(e){super()}}});var vB=he(()=>{l()});var AB=he(()=>{l();wB();vb();EB();vB()});var bB=he(()=>{l();AB()});function dY(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function IB(t,e){let r=dY(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function hY(t){return IB(t,lY)}function dg(t){return IB(t,fY)}function bb(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var lY,fY,_B=he(()=>{l();lY="^https?:",fY="^wss?:"});function Ib(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function pY(t){return Ib(t)&&"method"in t}function _b(t){return Ib(t)&&(SB(t)||hg(t))}function SB(t){return"result"in t}function hg(t){return"error"in t}function gY(t){return"error"in t&&t.valid===!1}var TB=he(()=>{l()});var rr={};ft(rr,{DEFAULT_ERROR:()=>Rl,IBaseJsonRpcProvider:()=>fg,IEvents:()=>iu,IJsonRpcConnection:()=>Ab,IJsonRpcProvider:()=>Bl,INTERNAL_ERROR:()=>rg,INVALID_PARAMS:()=>iB,INVALID_REQUEST:()=>rB,METHOD_NOT_FOUND:()=>nB,PARSE_ERROR:()=>tB,RESERVED_ERROR_CODES:()=>fb,SERVER_ERROR:()=>Pl,SERVER_ERROR_CODE_RANGE:()=>ng,STANDARD_ERROR_MAP:()=>rs,formatErrorMessage:()=>gB,formatJsonRpcError:()=>Eb,formatJsonRpcRequest:()=>wb,formatJsonRpcResult:()=>oY,getBigIntRpcId:()=>mb,getError:()=>og,getErrorByCode:()=>ag,isHttpUrl:()=>hY,isJsonRpcError:()=>hg,isJsonRpcPayload:()=>Ib,isJsonRpcRequest:()=>pY,isJsonRpcResponse:()=>_b,isJsonRpcResult:()=>SB,isJsonRpcValidationInvalid:()=>gY,isLocalhostUrl:()=>bb,isNodeJs:()=>hB,isReservedErrorCode:()=>sg,isServerErrorCode:()=>rY,isValidDefaultRoute:()=>cg,isValidErrorCode:()=>sB,isValidLeadingWildcardRoute:()=>uY,isValidRoute:()=>aY,isValidTrailingWildcardRoute:()=>cY,isValidWildcardRoute:()=>lg,isWsUrl:()=>dg,parseConnectionError:()=>db,payloadId:()=>yb,validateJsonRpcError:()=>nY});var Ll=he(()=>{l();ig();hb();pB();Qt(rr,kt);yB();mB();bB();_B();TB()});var CB,pg,xB,Sb=he(()=>{l();CB=be(ti());Ll();pg=class extends Bl{constructor(e){super(e),this.events=new CB.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(wb(e.method,e.params||[],e.id||mb().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=>{hg(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),_b(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)}},xB=pg});var NB={};ft(NB,{JsonRpcProvider:()=>pg,default:()=>yY});var yY,OB=he(()=>{l();Sb();Sb();yY=xB});var PB=A((s0e,DB)=>{"use strict";l();DB.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var FB={};ft(FB,{WsConnection:()=>Tb,default:()=>Tb});var LB,mY,wY,RB,BB,EY,Tb,MB=he(()=>{l();LB=be(ti());nl();Ll();mY=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:PB(),wY=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",RB=t=>t.split("?")[0],BB=10,EY=mY(),Tb=class{constructor(e){if(this.url=e,this.events=new LB.EventEmitter,this.registering=!1,!dg(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){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(zi(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!dg(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=new URLSearchParams(e).get("origin"),s=(0,rr.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!bb(e)},o=new EY(e,[],s);wY()?o.onerror=a=>{let u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}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"?Qi(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=Eb(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return db(e,RB(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>BB&&this.events.setMaxListeners(BB)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${RB(this.url)}`));return this.events.emit("register_error",r),r}}});var w6=A((Fl,ou)=>{l();var vY=200,Mb="__lodash_hash_undefined__",bg=1,KB=2,YB=9007199254740991,gg="[object Arguments]",Ob="[object Array]",AY="[object AsyncFunction]",JB="[object Boolean]",XB="[object Date]",ZB="[object Error]",e6="[object Function]",bY="[object GeneratorFunction]",yg="[object Map]",t6="[object Number]",IY="[object Null]",su="[object Object]",UB="[object Promise]",_Y="[object Proxy]",r6="[object RegExp]",mg="[object Set]",n6="[object String]",SY="[object Symbol]",TY="[object Undefined]",Db="[object WeakMap]",i6="[object ArrayBuffer]",wg="[object DataView]",CY="[object Float32Array]",xY="[object Float64Array]",NY="[object Int8Array]",OY="[object Int16Array]",DY="[object Int32Array]",PY="[object Uint8Array]",RY="[object Uint8ClampedArray]",BY="[object Uint16Array]",LY="[object Uint32Array]",FY=/[\\^$.*+?()[\]{}|]/g,MY=/^\[object .+?Constructor\]$/,UY=/^(?:0|[1-9]\d*)$/,st={};st[CY]=st[xY]=st[NY]=st[OY]=st[DY]=st[PY]=st[RY]=st[BY]=st[LY]=!0;st[gg]=st[Ob]=st[i6]=st[JB]=st[wg]=st[XB]=st[ZB]=st[e6]=st[yg]=st[t6]=st[su]=st[r6]=st[mg]=st[n6]=st[Db]=!1;var s6=typeof global=="object"&&global&&global.Object===Object&&global,qY=typeof self=="object"&&self&&self.Object===Object&&self,fi=s6||qY||Function("return this")(),o6=typeof Fl=="object"&&Fl&&!Fl.nodeType&&Fl,qB=o6&&typeof ou=="object"&&ou&&!ou.nodeType&&ou,a6=qB&&qB.exports===o6,Cb=a6&&s6.process,VB=function(){try{return Cb&&Cb.binding&&Cb.binding("util")}catch{}}(),HB=VB&&VB.isTypedArray;function VY(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function yJ(t,e){var r=this.__data__,n=_g(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}di.prototype.clear=dJ;di.prototype.delete=hJ;di.prototype.get=pJ;di.prototype.has=gJ;di.prototype.set=yJ;function fo(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,d=!0,g=r&KB?new vg:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=YB}function y6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ql(t){return t!=null&&typeof t=="object"}var m6=HB?jY(HB):RJ;function WJ(t){return QJ(t)?NJ(t):BJ(t)}function $J(){return[]}function KJ(){return!1}ou.exports=zJ});var Ub=A((f0e,E6)=>{l();E6.exports=function(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],o=[],a={},u=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return s},entries:function(){return o},get:function(f){return a[f.toLowerCase()]},has:function(f){return f.toLowerCase()in a}}}};for(var c in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(f,d,g){s.push(d=d.toLowerCase()),o.push([d,g]),a[d]=a[d]?a[d]+","+g:g}),r(u())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(c,e.headers[c]);i.send(e.body||null)})}});var A6=A((h0e,v6)=>{l();v6.exports=self.fetch||(self.fetch=Ub().default||Ub())});var x8=A(Ee=>{"use strict";l();Object.defineProperty(Ee,"__esModule",{value:!0});var po=ti(),YJ=(V2(),ht(q2)),Gl=nD(),Qe=m1(),Ln=F1(),b6=(nl(),ht(M2)),JJ=(VP(),ht(qP)),te=Dl(),XJ=(HA(),ht(VA)),Ke=Zs(),ZJ=(OB(),ht(NB)),Sr=(Ll(),ht(rr)),eX=(MB(),ht(FB)),tX=w6(),rX=A6();function jl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function nX(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 iX=jl(po),sX=jl(YJ),Tg=nX(JJ),oX=jl(eX),aX=jl(tX),uX=jl(rX);function cX(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,E=new Uint8Array(M);R!==z;){for(var S=y[R],N=0,_=M-1;(S!==0||N>>0,E[_]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");O=N,R++}for(var T=M-O;T!==M&&E[T]===0;)T++;for(var B=u.repeat(b);T>>0,M=new Uint8Array(z);y[b];){var E=r[y.charCodeAt(b)];if(E===255)return;for(var S=0,N=z-1;(E!==0||S>>0,M[N]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");R=S,b++}if(y[b]!==" "){for(var _=z-R;_!==z&&M[_]===0;)_++;for(var T=new Uint8Array(O+(z-_)),B=O;_!==z;)T[B++]=M[_++];return T}}}function m(y){var b=g(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:m}}var lX=cX,fX=lX,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")},dX=t=>new TextEncoder().encode(t),hX=t=>new TextDecoder().decode(t),Hb=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")}},kb=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)}},Gb=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 Gb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),jb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Hb(e,r,n),this.decoder=new kb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Hg=({name:t,prefix:e,encode:r,decode:n})=>new jb(t,e,r,n),Ql=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=fX(r,e);return Hg({prefix:t,name:e,encode:n,decode:s=>q6(i(s))})},pX=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},gX=(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<Hg({prefix:e,name:t,encode(i){return gX(i,n,r)},decode(i){return pX(i,n,r,t)}}),yX=Hg({prefix:"\0",name:"identity",encode:t=>hX(t),decode:t=>dX(t)}),mX=Object.freeze({__proto__:null,identity:yX}),wX=zt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),EX=Object.freeze({__proto__:null,base2:wX}),vX=zt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),AX=Object.freeze({__proto__:null,base8:vX}),bX=Ql({prefix:"9",name:"base10",alphabet:"0123456789"}),IX=Object.freeze({__proto__:null,base10:bX}),_X=zt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),SX=zt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),TX=Object.freeze({__proto__:null,base16:_X,base16upper:SX}),CX=zt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xX=zt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),NX=zt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),OX=zt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),DX=zt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),PX=zt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),RX=zt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),BX=zt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),LX=zt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),FX=Object.freeze({__proto__:null,base32:CX,base32upper:xX,base32pad:NX,base32padupper:OX,base32hex:DX,base32hexupper:PX,base32hexpad:RX,base32hexpadupper:BX,base32z:LX}),MX=Ql({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),UX=Ql({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),qX=Object.freeze({__proto__:null,base36:MX,base36upper:UX}),VX=Ql({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),HX=Ql({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),kX=Object.freeze({__proto__:null,base58btc:VX,base58flickr:HX}),GX=zt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),jX=zt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),QX=zt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),zX=zt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),WX=Object.freeze({__proto__:null,base64:GX,base64pad:jX,base64url:QX,base64urlpad:zX}),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}"),$X=H6.reduce((t,e,r)=>(t[r]=e,t),[]),KX=H6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function YX(t){return t.reduce((e,r)=>(e+=$X[r],e),"")}function JX(t){let e=[];for(let r of t){let n=KX[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var XX=Hg({prefix:"\u{1F680}",name:"base256emoji",encode:YX,decode:JX}),ZX=Object.freeze({__proto__:null,base256emoji:XX}),eZ=k6,I6=128,tZ=127,rZ=~tZ,nZ=Math.pow(2,31);function k6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=nZ;)e[r++]=t&255|I6,t/=128;for(;t&rZ;)e[r++]=t&255|I6,t>>>=7;return e[r]=t|0,k6.bytes=r-n+1,e}var iZ=Qb,sZ=128,_6=127;function Qb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Qb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&_6)<=sZ);return Qb.bytes=s-n,r}var oZ=Math.pow(2,7),aZ=Math.pow(2,14),uZ=Math.pow(2,21),cZ=Math.pow(2,28),lZ=Math.pow(2,35),fZ=Math.pow(2,42),dZ=Math.pow(2,49),hZ=Math.pow(2,56),pZ=Math.pow(2,63),gZ=function(t){return t(G6.encode(t,e,r),e),T6=t=>G6.encodingLength(t),zb=(t,e)=>{let r=e.byteLength,n=T6(t),i=n+T6(r),s=new Uint8Array(i+r);return S6(t,s,0),S6(r,s,n),s.set(e,i),new Wb(t,r,e,s)},Wb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},j6=({name:t,code:e,encode:r})=>new $b(t,e,r),$b=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?zb(this.code,r):r.then(n=>zb(this.code,n))}else throw Error("Unknown type, must be binary type")}},Q6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),mZ=j6({name:"sha2-256",code:18,encode:Q6("SHA-256")}),wZ=j6({name:"sha2-512",code:19,encode:Q6("SHA-512")}),EZ=Object.freeze({__proto__:null,sha256:mZ,sha512:wZ}),z6=0,vZ="identity",W6=q6,AZ=t=>zb(z6,W6(t)),bZ={code:z6,name:vZ,encode:W6,digest:AZ},IZ=Object.freeze({__proto__:null,identity:bZ});new TextEncoder,new TextDecoder;var C6={...mX,...EX,...AX,...IX,...TX,...FX,...qX,...kX,...WX,...ZX};({...EZ,...IZ});function $6(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function _Z(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?$6(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function K6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var x6=K6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),qb=K6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=_Z(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}=te.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Og=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=Z6,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=Tg.generateKeyPair(i);return Tg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=te.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=Tg.generateKeyPair(s),a=te.generateRandomBytes32(),u=e8;return await Tg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=te.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||te.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=te.validateEncoding(o),u=b6.safeJsonStringify(s);if(te.isTypeOneEnvelope(a)){let g=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(g,m)}let c=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return te.encrypt({type:f,symKey:c,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=te.validateDecoding(s,o);if(te.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,c=a.senderPublicKey;i=await this.generateSharedKey(u,c)}try{let u=this.getSymKey(i),c=te.decrypt({symKey:u,encoded:s});return b6.safeJsonParse(c)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=te.deserialize(i);return te.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=te.deserialize(i);return s.senderPublicKey?XJ.toString(s.senderPublicKey,te.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new Ng(this.core,this.logger)}get context(){return Qe.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(Kb)}catch{e=te.generateRandomBytes32(),await this.keychain.set(Kb,e)}return TZ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Dg=class extends Ln.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=n8,this.version=i8,this.initialized=!1,this.storagePrefix=hi,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=te.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=te.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,te.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?te.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Jb=class extends Ln.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new po.EventEmitter,this.name=o8,this.queue=new Map,this.publishTimeout=Ke.toMiliseconds(Ke.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||s8,u=te.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,d=s?.id||Sr.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:c,tag:f,id:d}},m=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await te.createExpiringPromise(this.rpcPublish(n,i,a,u,c,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(ar.publish,g)}catch(y){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),y;return}finally{clearTimeout(m)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},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=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,c,f,d;let g={method:te.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return te.isUndefined((u=g.params)==null?void 0:u.prompt)&&((c=g.params)==null||delete c.prompt),te.isUndefined((f=g.params)==null?void 0:f.tag)&&((d=g.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){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(Gl.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ar.connection_stalled);return}this.checkQueue()}),this.relayer.on(ar.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},Xb=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())}},DZ=Object.defineProperty,PZ=Object.defineProperties,RZ=Object.getOwnPropertyDescriptors,N6=Object.getOwnPropertySymbols,BZ=Object.prototype.hasOwnProperty,LZ=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?DZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hl=(t,e)=>{for(var r in e||(e={}))BZ.call(e,r)&&O6(t,r,e[r]);if(N6)for(var r of N6(e))LZ.call(e,r)&&O6(t,r,e[r]);return t},Vb=(t,e)=>PZ(t,RZ(e)),Pg=class extends Ln.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new Xb,this.events=new po.EventEmitter,this.name=y8,this.version=m8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),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=te.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 Ke.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)>=w8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!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.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+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=te.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=te.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:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}return te.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:te.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 te.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(ar.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:te.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,Vb(Hl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Hl({},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,Hl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Gr.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}=te.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(Gr.deleted,Vb(Hl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Gr.sync)}async reset(){if(this.cached.length){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}=te.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);te.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>Vb(Hl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(ar.connect,async()=>{await this.onConnect()}),this.relayer.on(ar.disconnect,()=>{this.onDisconnect()}),this.events.on(Gr.created,async e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Gr.deleted,async e=>{let r=Gr.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}=te.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)})}},FZ=Object.defineProperty,D6=Object.getOwnPropertySymbols,MZ=Object.prototype.hasOwnProperty,UZ=Object.prototype.propertyIsEnumerable,P6=(t,e,r)=>e in t?FZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qZ=(t,e)=>{for(var r in e||(e={}))MZ.call(e,r)&&P6(t,r,e[r]);if(D6)for(var r of D6(e))UZ.call(e,r)&&P6(t,r,e[r]);return t},Rg=class extends Ln.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new po.EventEmitter,this.name=c8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,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.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(ar.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ar.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Bn.payload,this.onPayloadHandler),this.provider.on(Bn.connect,this.onConnectHandler),this.provider.on(Bn.disconnect,this.onDisconnectHandler),this.provider.on(Bn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||u8})),this.messages=new Dg(this.logger,e.core),this.subscriber=new Pg(this,this.logger),this.publisher=new Jb(this,this.logger),this.relayUrl=e?.relayUrl||eI,this.projectId=e.projectId,this.bundleId=te.getBundleId(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Yb}...`),await this.restartTransport(Yb)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},h8)}get context(){return Qe.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){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Gr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Gr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}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.hasExperiencedNetworkDisruption&&this.connected?await te.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Gr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await te.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Bn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await te.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ZJ.JsonRpcProvider(new oX.default(te.formatRelayRpcUrl({sdkVersion:d8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Sr.isJsonRpcRequest(e)){if(!e.method.endsWith(l8))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(qZ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else Sr.isJsonRpcResponse(e)&&this.events.emit(ar.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ar.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Sr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Bn.payload,this.onPayloadHandler),this.provider.off(Bn.connect,this.onConnectHandler),this.provider.off(Bn.disconnect,this.onDisconnectHandler),this.provider.off(Bn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(ar.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await te.isOnline();te.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(ar.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},Ke.toMiliseconds(f8)))}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},VZ=Object.defineProperty,R6=Object.getOwnPropertySymbols,HZ=Object.prototype.hasOwnProperty,kZ=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?VZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L6=(t,e)=>{for(var r in e||(e={}))HZ.call(e,r)&&B6(t,r,e[r]);if(R6)for(var r of R6(e))kZ.call(e,r)&&B6(t,r,e[r]);return t},Bg=class extends Ln.IStore{constructor(e,r,n,i=hi,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=p8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!te.isUndefined(o)?this.map.set(this.getKey(o),o):te.isProposalStruct(o)?this.map.set(o.id,o):te.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=>aX.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=L6(L6({},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=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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}=te.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}=te.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}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Lg=class{constructor(e,r){this.core=e,this.logger=r,this.name=E8,this.version=v8,this.events=new iX.default,this.initialized=!1,this.storagePrefix=hi,this.ignoredPayloadTypes=[te.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=te.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=te.calcExpiry(Ke.FIVE_MINUTES),o={protocol:a8},a={topic:i,expiry:s,relay:o,active:!1},u=te.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}=te.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);let u=te.calcExpiry(Ke.FIVE_MINUTES),c={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,c),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(kl.create,c),this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o})),c},this.activate=async({topic:n})=>{this.isInitialized();let i=te.calcExpiry(Ke.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}=te.createDelayedPromise();this.events.once(te.engineEvent("pairing_ping",s),({error:c})=>{c?u(c):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",te.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Sr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=uu[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Sr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=uu[u.request.method].res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Sr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=uu[u.request.method]?uu[u.request.method].res:uu.unregistered_method.res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,te.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=>te.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){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;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(kl.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(()=>{Sr.isJsonRpcResult(i)?this.events.emit(te.engineEvent("pairing_ping",s),{}):Sr.isJsonRpcError(i)&&this.events.emit(te.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(kl.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=te.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(te.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!te.isValidParams(n)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!te.isValidUrl(n.uri)){let{message:o}=te.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}let s=te.parseUri(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(o)}if(!(s!=null&&s.symKey)){let{message:o}=te.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(o)}},this.isValidPing=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!te.isValidParams(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!te.isValidString(n,!1)){let{message:i}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(te.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=te.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new Bg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ar.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{Sr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Sr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(kr.expired,async e=>{let{topic:r}=te.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(kl.expire,{topic:r}))})}},Fg=class extends Ln.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new po.EventEmitter,this.name=A8,this.version=b8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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,expiry:te.calcExpiry(Ke.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(rn.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=Sr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(rn.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(rn.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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:Sr.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(rn.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=te.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(rn.created,e=>{let r=rn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.updated,e=>{let r=rn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(rn.deleted,e=>{let r=rn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{Ke.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Mg=class extends Ln.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new po.EventEmitter,this.name=I8,this.version=_8,this.cached=[],this.initialized=!1,this.storagePrefix=hi,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(kr.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(kr.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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+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 te.formatTopicTarget(e);if(typeof e=="number")return te.formatIdTarget(e);let{message:r}=te.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(kr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=te.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}=te.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Ke.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(kr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Gl.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(kr.created,e=>{let r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.expired,e=>{let r=kr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(kr.deleted,e=>{let r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ug=class extends Ln.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=Cg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||te.isReactNative()||!te.isBrowser())return;let i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=xg;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=this.getVerifyUrl(n?.verifyUrl),s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,xg)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(Ke.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(Cg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=Cg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},Ke.toMiliseconds(Ke.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||cu;return S8.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${cu}`),i=cu),i},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=cu,this.abortController=new AbortController,this.isDevEnv=te.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Ke.toMiliseconds(e))}},qg=class extends Ln.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=T8,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${C8}/${this.projectId}/clients`;await uX.default(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=Qe.generateChildLogger(r,this.context)}},GZ=Object.defineProperty,F6=Object.getOwnPropertySymbols,jZ=Object.prototype.hasOwnProperty,QZ=Object.prototype.propertyIsEnumerable,M6=(t,e,r)=>e in t?GZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U6=(t,e)=>{for(var r in e||(e={}))jZ.call(e,r)&&M6(t,r,e[r]);if(F6)for(var r of F6(e))QZ.call(e,r)&&M6(t,r,e[r]);return t},Vg=class t extends Ln.ICore{constructor(e){super(e),this.protocol=Zb,this.version=Y6,this.name=kg,this.events=new po.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||eI,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||J6.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Gl.HeartBeat,this.crypto=new Og(this,this.logger,e?.keychain),this.history=new Fg(this,this.logger),this.expirer=new Mg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new sX.default(U6(U6({},X6),e?.storageOptions)),this.relayer=new Rg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Lg(this,this.logger),this.verify=new Ug(this.projectId||"",this.logger),this.echoClient=new qg(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(g8,n),r}get context(){return Qe.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}}},zZ=Vg;Ee.CORE_CONTEXT=kg,Ee.CORE_DEFAULT=J6,Ee.CORE_PROTOCOL=Zb,Ee.CORE_STORAGE_OPTIONS=X6,Ee.CORE_STORAGE_PREFIX=hi,Ee.CORE_VERSION=Y6,Ee.CRYPTO_CLIENT_SEED=Kb,Ee.CRYPTO_CONTEXT=Z6,Ee.CRYPTO_JWT_TTL=e8,Ee.Core=zZ,Ee.Crypto=Og,Ee.ECHO_CONTEXT=T8,Ee.ECHO_URL=C8,Ee.EXPIRER_CONTEXT=I8,Ee.EXPIRER_DEFAULT_TTL=OZ,Ee.EXPIRER_EVENTS=kr,Ee.EXPIRER_STORAGE_VERSION=_8,Ee.EchoClient=qg,Ee.Expirer=Mg,Ee.HISTORY_CONTEXT=A8,Ee.HISTORY_EVENTS=rn,Ee.HISTORY_STORAGE_VERSION=b8,Ee.JsonRpcHistory=Fg,Ee.KEYCHAIN_CONTEXT=t8,Ee.KEYCHAIN_STORAGE_VERSION=r8,Ee.KeyChain=Ng,Ee.MESSAGES_CONTEXT=n8,Ee.MESSAGES_STORAGE_VERSION=i8,Ee.MessageTracker=Dg,Ee.PAIRING_CONTEXT=E8,Ee.PAIRING_DEFAULT_TTL=NZ,Ee.PAIRING_EVENTS=kl,Ee.PAIRING_RPC_OPTS=uu,Ee.PAIRING_STORAGE_VERSION=v8,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=w8,Ee.PUBLISHER_CONTEXT=o8,Ee.PUBLISHER_DEFAULT_TTL=s8,Ee.Pairing=Lg,Ee.RELAYER_CONTEXT=c8,Ee.RELAYER_DEFAULT_LOGGER=u8,Ee.RELAYER_DEFAULT_PROTOCOL=a8,Ee.RELAYER_DEFAULT_RELAY_URL=eI,Ee.RELAYER_EVENTS=ar,Ee.RELAYER_FAILOVER_RELAY_URL=Yb,Ee.RELAYER_PROVIDER_EVENTS=Bn,Ee.RELAYER_RECONNECT_TIMEOUT=f8,Ee.RELAYER_SDK_VERSION=d8,Ee.RELAYER_STORAGE_OPTIONS=CZ,Ee.RELAYER_SUBSCRIBER_SUFFIX=l8,Ee.RELAYER_TRANSPORT_CUTOFF=h8,Ee.Relayer=Rg,Ee.STORE_STORAGE_VERSION=p8,Ee.SUBSCRIBER_CONTEXT=y8,Ee.SUBSCRIBER_DEFAULT_TTL=xZ,Ee.SUBSCRIBER_EVENTS=Gr,Ee.SUBSCRIBER_STORAGE_VERSION=m8,Ee.Store=Bg,Ee.Subscriber=Pg,Ee.TRUSTED_VERIFY_URLS=S8,Ee.VERIFY_CONTEXT=Cg,Ee.VERIFY_FALLBACK_SERVER=xg,Ee.VERIFY_SERVER=cu,Ee.Verify=Ug,Ee.WALLETCONNECT_CLIENT_ID=g8,Ee.default=Vg});var q8=A(Ye=>{"use strict";l();Object.defineProperty(Ye,"__esModule",{value:!0});var Mn=x8(),Gg=m1(),D8=F1(),G=Dl(),P8=ti(),tt=Zs(),wt=(Ll(),ht(rr));function WZ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var $Z=WZ(P8),sI="wc",oI=2,aI="client",$g=`${sI}@${oI}:${aI}:`,jg={name:aI,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},KZ={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"},YZ={database:":memory:"},tI="WALLETCONNECT_DEEPLINK_CHOICE",JZ={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},XZ="history",ZZ="0.3",R8="proposal",eee=tt.THIRTY_DAYS,B8="Proposal expired",L8="session",Wl=tt.SEVEN_DAYS,F8="engine",lu={wc_sessionPropose:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:tt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:tt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:tt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:tt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:tt.THIRTY_SECONDS,prompt:!1,tag:1115}}},Qg={min:tt.FIVE_MINUTES,max:tt.SEVEN_DAYS},Fn={idle:"IDLE",active:"ACTIVE"},M8="request",U8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],tee=Object.defineProperty,ree=Object.defineProperties,nee=Object.getOwnPropertyDescriptors,N8=Object.getOwnPropertySymbols,iee=Object.prototype.hasOwnProperty,see=Object.prototype.propertyIsEnumerable,O8=(t,e,r)=>e in t?tee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))iee.call(e,r)&&O8(t,r,e[r]);if(N8)for(var r of N8(e))see.call(e,r)&&O8(t,r,e[r]);return t},zl=(t,e)=>ree(t,nee(e)),rI=class extends D8.IEngine{constructor(e){super(e),this.name=F8,this.events=new $Z.default,this.initialized=!1,this.ignoredPayloadTypes=[G.TYPE_1],this.requestQueue={state:Fn.idle,queue:[]},this.sessionRequestQueue={state:Fn.idle,queue:[]},this.requestQueueDelay=tt.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(lu)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=zl(Er({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,c=i,f,d=!1;if(c&&(d=this.client.core.pairing.pairings.get(c).active),!c||!d){let{topic:M,uri:E}=await this.client.core.pairing.create();c=M,f=E}let g=await this.client.core.crypto.generateKeyPair(),m=Er({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Mn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:y,resolve:b,done:O}=G.createDelayedPromise(tt.FIVE_MINUTES,B8);if(this.events.once(G.engineEvent("session_connect"),async({error:M,session:E})=>{if(M)y(M);else if(E){E.self.publicKey=g;let S=zl(Er({},E),{requiredNamespaces:E.requiredNamespaces,optionalNamespaces:E.optionalNamespaces});await this.client.session.set(E.topic,S),await this.setExpiry(E.topic,E.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:E.peer.metadata}),b(S)}}),!c){let{message:M}=G.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(M)}let R=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:m}),z=G.calcExpiry(tt.FIVE_MINUTES);return await this.setProposal(R,Er({id:R,expiry:z},m)),{uri:f,approval:O}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await 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:c,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",G.isValidObject(f)||(f=G.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),m=c.publicKey,y=await this.client.core.crypto.generateSharedKey(g,m);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:c.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let b=Er({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:G.calcExpiry(Wl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(y),await this.sendRequest({topic:y,method:"wc_sessionSettle",params:b,throwOnFailedPublish:!0});let O=zl(Er({},b),{topic:y,pairingTopic:u,acknowledged:!1,self:b.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:g});return await this.client.session.set(y,O),await this.setExpiry(y,G.calcExpiry(Wl)),{topic:y,acknowledged:()=>new Promise(R=>setTimeout(()=>R(this.client.session.get(y)),500))}},this.reject=async r=>{await 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,G.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_update",s),({error:c})=>{c?u(c):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,G.calcExpiry(Wl)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=wt.payloadId(),{done:u,resolve:c,reject:f}=G.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(G.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):c(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await G.getDeepLink(this.client.core.storage,tI);G.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;wt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):wt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=G.createDelayedPromise();this.events.once(G.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=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:G.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>G.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(tI).catch(s=>this.client.logger.warn(s)),this.getPendingSessionRequests().forEach(s=>{s.topic===r&&this.deletePendingSessionRequest(s.id,G.getSdkError("USER_DISCONNECTED"))})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,G.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.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Fn.idle)},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=lu.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,G.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:c}=r,f=wt.formatJsonRpcRequest(i,s,u);if(G.isBrowser()&&U8.includes(i)){let m=G.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:m})}let d=await this.client.core.crypto.encode(n,f),g=lu[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),c?(g.internal=zl(Er({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(m=>this.client.logger.error(m)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=wt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),c=await this.client.core.history.get(i,n),f=lu[c.request.method].res;o?(f.internal=zl(Er({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=wt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=lu[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=>{G.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{G.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Fn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Fn.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Fn.idle},this.processRequest=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.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=G.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(Er({},n.params));let o=G.calcExpiry(tt.FIVE_MINUTES),a=Er({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=G.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:c})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(wt.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 c=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else wt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.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:c,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:m}=n.params,y=Er({topic:r,relay:o,expiry:u,namespaces:c,acknowledged:!0,pairingTopic:m,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(G.engineEvent("session_connect"),{session:y}),this.cleanupDuplicatePairings(y)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(G.engineEvent("session_approve",i),{})):wt.isJsonRpcError(n)&&(await this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(Er({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),G.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_update",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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,G.calcExpiry(Wl)),await this.sendResult({id:i,topic:r,result:!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;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_extend",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!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(()=>{wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_ping",i),{}):wt.isJsonRpcError(n)&&this.events.emit(G.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}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Mn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(Er({topic:r},s));let o=G.hashMessage(JSON.stringify(wt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),c={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(c),this.addSessionRequestToSessionRequestQueue(c),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;wt.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):wt.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=G.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Er({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),G.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Fn.idle,this.processSessionRequestQueue()},tt.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Fn.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Fn.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,wt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(G.isUndefined(n)||await this.isValidPairingTopic(n),!G.isValidRelays(a,!0)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!G.isUndefined(i)&&G.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!G.isUndefined(s)&&G.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=G.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!G.isValidParams(r))throw new Error(G.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=G.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let c=G.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!G.isValidString(s,!0)){let{message:f}=G.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!G.isValidParams(r)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!G.isValidErrorReason(i)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!G.isValidParams(r)){let{message:c}=G.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!G.isValidRelay(n)){let{message:c}=G.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let a=G.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=G.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(G.isExpired(o)){let{message:c}=G.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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=G.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=G.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!G.isValidParams(r)){let{message:u}=G.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(!G.isValidNamespacesChainId(a,s)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!G.isValidRequest(i)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!G.isValidNamespacesRequest(a,s,i.method)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!G.isValidRequestExpiry(o,Qg)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Qg.min} and ${Qg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!G.isValidParams(r)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!G.isValidResponse(s)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!G.isValidParams(r)){let{message:a}=G.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(!G.isValidNamespacesChainId(o,s)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!G.isValidEvent(i)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!G.isValidNamespacesEvent(o,s,i.name)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Mn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!G.isValidString(i,!1)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=G.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Mn.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);try{wt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):wt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Mn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=G.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,G.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}))})}registerPairingEvents(){this.client.core.pairing.events.on(Mn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=G.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=G.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(G.isValidString(e,!1)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!G.isValidId(e)){let{message:r}=G.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}=G.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=G.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},nI=class extends Mn.Store{constructor(e,r){super(e,r,R8,$g),this.core=e,this.logger=r}},zg=class extends Mn.Store{constructor(e,r){super(e,r,L8,$g),this.core=e,this.logger=r}},iI=class extends Mn.Store{constructor(e,r){super(e,r,M8,$g,n=>n.id),this.core=e,this.logger=r}},Wg=class t extends D8.ISignClient{constructor(e){super(e),this.protocol=sI,this.version=oI,this.name=jg.name,this.events=new P8.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||jg.name,this.metadata=e?.metadata||G.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Gg.pino(Gg.getDefaultLoggerOptions({level:e?.logger||jg.logger}));this.core=e?.core||new Mn.Core(e),this.logger=Gg.generateChildLogger(r,this.name),this.session=new zg(this.core,this.logger),this.proposal=new nI(this.core,this.logger),this.pendingRequest=new iI(this.core,this.logger),this.engine=new rI(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Gg.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.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},oee=zg,aee=Wg;Ye.ENGINE_CONTEXT=F8,Ye.ENGINE_QUEUE_STATES=Fn,Ye.ENGINE_RPC_OPTS=lu,Ye.HISTORY_CONTEXT=XZ,Ye.HISTORY_EVENTS=JZ,Ye.HISTORY_STORAGE_VERSION=ZZ,Ye.METHODS_TO_VERIFY=U8,Ye.PROPOSAL_CONTEXT=R8,Ye.PROPOSAL_EXPIRY=eee,Ye.PROPOSAL_EXPIRY_MESSAGE=B8,Ye.REQUEST_CONTEXT=M8,Ye.SESSION_CONTEXT=L8,Ye.SESSION_EXPIRY=Wl,Ye.SESSION_REQUEST_EXPIRY_BOUNDARIES=Qg,Ye.SIGN_CLIENT_CONTEXT=aI,Ye.SIGN_CLIENT_DEFAULT=jg,Ye.SIGN_CLIENT_EVENTS=KZ,Ye.SIGN_CLIENT_PROTOCOL=sI,Ye.SIGN_CLIENT_STORAGE_OPTIONS=YZ,Ye.SIGN_CLIENT_STORAGE_PREFIX=$g,Ye.SIGN_CLIENT_VERSION=oI,Ye.SessionStore=oee,Ye.SignClient=aee,Ye.WALLETCONNECT_DEEPLINK_CHOICE=tI,Ye.default=Wg});var Kg=A(as=>{"use strict";l();Object.defineProperty(as,"__esModule",{value:!0});as.OptionalOperation=as.Operation=void 0;var uee;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(uee=as.Operation||(as.Operation={}));var cee;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(cee=as.OptionalOperation||(as.OptionalOperation={}))});var uI=A(Un=>{"use strict";l();Object.defineProperty(Un,"__esModule",{value:!0});Un.WALLETCONNECT_SIGN_LOGIN_DELAY=Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Un.WALLETCONNECT_MULTIVERSX_METHODS=Un.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var V8=Kg();Un.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Un.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(V8.Operation);Un.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(V8.OptionalOperation);Un.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var fI=A(nn=>{"use strict";l();Object.defineProperty(nn,"__esModule",{value:!0});nn.WalletConnectV2ProviderErrorMessagesEnum=nn.ErrBadAddress=nn.ErrNotImplemented=nn.Err=void 0;var $l=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};nn.Err=$l;var cI=class extends $l{constructor(){super("Method not yet implemented")}};nn.ErrNotImplemented=cI;var lI=class extends $l{constructor(e,r){super(`Bad address: ${e}`,r)}};nn.ErrBadAddress=lI;var lee;(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.unableToSign="WalletConnect could not sign the message",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",t.invalidGuardian="WalletConnect: Invalid Guardian"})(lee=nn.WalletConnectV2ProviderErrorMessagesEnum||(nn.WalletConnectV2ProviderErrorMessagesEnum={}))});var hI=A(Yg=>{"use strict";l();Object.defineProperty(Yg,"__esModule",{value:!0});Yg.Logger=void 0;var dI=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Yg.Logger=dI});var H8=A(()=>{"use strict";l();global.Buffer||(global.Buffer=Vs().Buffer)});var G8=A(k8=>{"use strict";l();Object.defineProperty(k8,"__esModule",{value:!0})});var Q8=A(j8=>{"use strict";l();Object.defineProperty(j8,"__esModule",{value:!0})});var z8=A(fu=>{"use strict";l();var fee=fu&&fu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fu,"__esModule",{value:!0});fu.RelayedTransactionV1Builder=void 0;var dee=fee(Yt()),pI=pt(),hee=Le(),pee=Yr(),gee=Yn(),gI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new hee.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new gee.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new pee.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new pI.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new pI.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new dee.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:h.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new pI.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?h.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?h.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};fu.RelayedTransactionV1Builder=gI});var W8=A(Jg=>{"use strict";l();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.Code=void 0;var yee=gE(),mee=32,yI=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}computeHash(){let e=yee(mee).update(this.valueOf()).digest();return h.Buffer.from(e)}};Jg.Code=yI});var J8=A(hu=>{"use strict";l();Object.defineProperty(hu,"__esModule",{value:!0});hu.bech32m=hu.bech32=void 0;var Xg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",K8={};for(let t=0;t>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 $8(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=du(e)^n>>5}e=du(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=$8(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");c=du(c)^g,f+=Xg.charAt(g)}for(let d=0;d<6;++d)c=du(c);c^=e;for(let d=0;d<6;++d){let g=c>>(5-d)*5&31;f+=Xg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),c=o.toUpperCase();if(o!==u&&o!==c)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let m=$8(d);if(typeof m=="string")return m;let y=[];for(let b=0;b=g.length)&&y.push(R)}return m!==e?"Invalid checksum for "+o:{prefix:d,words:y}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:wee,fromWordsUnsafe:Eee,fromWords:vee}}hu.bech32=Y8("bech32");hu.bech32m=Y8("bech32m")});var Z8=A(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.TokenTransferProperties=jr.TransactionMetadataTransfer=jr.TransactionMetadata=jr.TransactionToDecode=jr.TransactionDecoder=void 0;var X8=J8(),wI=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new go;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Zg;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new go;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new go;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return h.Buffer.from(e).toString("base64")}base64Decode(e){return h.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new go;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=h.Buffer.from(e,"hex"),n=X8.bech32.toWords(r);return X8.bech32.encode("erd",n)}isAddressValid(e){return h.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return h.Buffer.from(e,"base64").toString("hex")}hexToString(e){return h.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};jr.TransactionDecoder=wI;var Zg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};jr.TransactionToDecode=Zg;var go=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};jr.TransactionMetadata=go;var EI=class{constructor(){this.value=BigInt(0)}};jr.TransactionMetadataTransfer=EI;var vI=class{};jr.TokenTransferProperties=vI});var AI=A(ey=>{"use strict";l();Object.defineProperty(ey,"__esModule",{value:!0});ey.ReturnCode=void 0;var ze=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};ey.ReturnCode=ze;ze.None=new ze("");ze.Ok=new ze("ok");ze.FunctionNotFound=new ze("function not found");ze.FunctionWrongSignature=new ze("wrong signature for function");ze.ContractNotFound=new ze("contract not found");ze.UserError=new ze("user error");ze.OutOfGas=new ze("out of gas");ze.AccountCollision=new ze("account collision");ze.OutOfFunds=new ze("out of funds");ze.CallStackOverFlow=new ze("call stack overflow");ze.ContractInvalid=new ze("contract invalid");ze.ExecutionFailed=new ze("execution failed");ze.Unknown=new ze("unknown")});var rL=A(ty=>{"use strict";l();Object.defineProperty(ty,"__esModule",{value:!0});ty.ResultsParser=void 0;var Aee=Z8(),eL=pt(),tL=Le(),us=pa(),bee=na(),pu=AI(),gu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(gu||(gu={}));var bI;(function(t){t.TooMuchGas="@too much gas provided for processing"})(bI||(bI={}));var Iee={argsSerializer:new bee.ArgSerializer},II=class{constructor(e){e=Object.assign(Object.assign({},Iee),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new pu.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new pu.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return us.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return us.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return us.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return us.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return us.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return us.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return us.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return us.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new tL.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new Aee.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:pu.ReturnCode.None,returnMessage:pu.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:pu.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(gu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(gu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(bI.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new eL.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(gu.OnWriteLog,u=>u.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new eL.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(gu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),c=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&c});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||h.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new tL.ErrCannotParseContractResults("no return code");return{returnCode:pu.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){var n,i;let s={},o=e.topics.map(m=>h.Buffer.from(m.valueOf())).slice(1),a=((n=e.dataPayload)===null||n===void 0?void 0:n.valueOf())||h.Buffer.from([]),u=((i=e.additionalData)===null||i===void 0?void 0:i.map(m=>h.Buffer.from(m.valueOf())))||[];u.length==0&&a.length>0&&u.push(h.Buffer.from(a));let c=r.inputs.filter(m=>m.indexed),f=this.argsSerializer.buffersToValues(o,c);for(let m=0;m!m.indexed),g=this.argsSerializer.buffersToValues(u,d);for(let m=0;m{"use strict";l();var _ee=_t&&_t.__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]}),ur=_t&&_t.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_ee(e,t,r)};Object.defineProperty(_t,"__esModule",{value:!0});ur(na(),_t);ur(W8(),_t);ur(Bw(),_t);ur(NE(),_t);ur(qc(),_t);ur(UE(),_t);ur(RE(),_t);ur(Rv(),_t);ur(HE(),_t);ur(Vc(),_t);ur(rL(),_t);ur(AI(),_t);ur(Dv(),_t);ur($E(),_t);ur(xt(),_t)});var iL=A(ry=>{"use strict";l();Object.defineProperty(ry,"__esModule",{value:!0});ry.RelayedTransactionV2Builder=void 0;var nL=Le(),Kl=_I(),See=Yr(),Tee=Yn(),SI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new nL.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new nL.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Kl.ArgSerializer().valuesToString([new Kl.AddressValue(this.innerTransaction.getReceiver()),new Kl.U64Value(this.innerTransaction.getNonce().valueOf()),new Kl.BytesValue(this.innerTransaction.getData().valueOf()),new Kl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new Tee.TransactionPayload(r),i=new See.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};ry.RelayedTransactionV2Builder=SI});var CI=A(lt=>{"use strict";l();var Cee=lt&<.__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]}),xee=lt&<.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sL=lt&<.__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)&&Cee(e,t,r);return xee(e,t),e},Nee=lt&<.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lt,"__esModule",{value:!0});lt.addressToHex=lt.bufferToHex=lt.utf8ToHex=lt.bigIntToHex=lt.bigIntToBuffer=lt.bufferToBigInt=lt.stringToBuffer=void 0;var Oee=Nee(Yt()),Dee=pt(),TI=sL(Tc()),oL=sL(Md());function Pee(t){return h.Buffer.from(t)}lt.stringToBuffer=Pee;function Ree(t){return t.length==0?new Oee.default(0):TI.bufferToBigInt(t)}lt.bufferToBigInt=Ree;function Bee(t){return t==0?h.Buffer.from([]):TI.bigIntToBuffer(t)}lt.bigIntToBuffer=Bee;function Lee(t){return t==0?"":TI.getHexMagnitudeOfBigInt(t)}lt.bigIntToHex=Lee;function Fee(t){let e=h.Buffer.from(t).toString("hex");return oL.zeroPadStringIfOddLength(e)}lt.utf8ToHex=Fee;function Mee(t){let e=t.toString("hex");return oL.zeroPadStringIfOddLength(e)}lt.bufferToHex=Mee;function Uee(t){return Dee.Address.fromBech32(t.toString()).pubkey().toString("hex")}lt.addressToHex=Uee});var uL=A(ny=>{"use strict";l();Object.defineProperty(ny,"__esModule",{value:!0});ny.TokenOperationsFactory=void 0;var xI=Os(),qee=pa(),aL=xc(),Vee=Yr(),Hee=Yn(),ne=CI(),NI=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true"),this.falseAsHex=ne.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){qee.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex(e.tokenType),ne.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleLocalMint?[ne.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ne.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ne.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ne.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ne.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.initialQuantity),ne.utf8ToHex(e.name),ne.bigIntToHex(e.royalties),ne.utf8ToHex(e.hash),ne.bufferToHex(e.attributes),...e.uris.map(ne.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:a,dataParts:u}){let c=this.buildTransactionPayload(u),f=o||this.computeGasLimit(c,a),d=new rL.TransactionVersion(_I.TRANSACTION_VERSION_DEFAULT),g=new rL.TransactionOptions(_I.TRANSACTION_OPTIONS_DEFAULT);return new xee.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:c,version:d,options:g})}buildTransactionPayload(e){let r=e.join(_I.ARGUMENTS_SEPARATOR);return new Nee.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};ny.TokenOperationsFactory=SI});var iL=v(iy=>{"use strict";l();Object.defineProperty(iy,"__esModule",{value:!0});iy.TokenOperationsFactoryConfig=void 0;var Oee=pt(),TI=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=Oee.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};iy.TokenOperationsFactoryConfig=TI});var oL=v(sy=>{"use strict";l();Object.defineProperty(sy,"__esModule",{value:!0});sy.TokenOperationsOutcomeParser=void 0;var Dee=pt(),CI=Le(),sL=II(),xI=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=h.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new CI.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new CI.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new CI.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return sL.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return sL.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return Dee.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};sy.TokenOperationsOutcomeParser=xI});var aL=v(pi=>{"use strict";l();var Pee=pi&&pi.__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]}),NI=pi&&pi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pee(e,t,r)};Object.defineProperty(pi,"__esModule",{value:!0});NI(nL(),pi);NI(iL(),pi);NI(oL(),pi)});var uL=v(rt=>{"use strict";l();var Ree=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]}),Dt=rt&&rt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ree(e,t,r)};Object.defineProperty(rt,"__esModule",{value:!0});B8();Dt(ha(),rt);Dt(pt(),rt);Dt(CE(),rt);Dt(Le(),rt);Dt(IE(),rt);Dt(F8(),rt);Dt(U8(),rt);Dt(pa(),rt);Dt(xc(),rt);Dt(q8(),rt);Dt(Z8(),rt);Dt(Wh(),rt);Dt(vI(),rt);Dt(aL(),rt);Dt(Hm(),rt);Dt(Yr(),rt);Dt(Yn(),rt);Dt(Ih(),rt);Dt(AE(),rt);Dt(br(),rt)});var pL=v(Pt=>{"use strict";l();var Bee=Pt&&Pt.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.sleep=Pt.getMetadata=Pt.applyTransactionSignature=Pt.getAddressFromSession=Pt.addressIsValid=Pt.getConnectionParams=Pt.getCurrentTopic=Pt.getCurrentSession=void 0;var fL=uL(),cL=Rc(),Lee=Dl(),oy=iI(),gi=aI(),OI=cI(),lL=Kg();function dL(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(hL(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw OI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Pt.getCurrentSession=dL;function Fee(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=dL(t,e);if(!r?.topic)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Pt.getCurrentTopic=Fee;function hL(t,e){var r,n,i;let s=[...oy.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(lL.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(lL.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${oy.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Pt.getConnectionParams=hL;function Mee(t){try{return!fL.Address.fromBech32(t).isEmpty()}catch{return!1}}Pt.addressIsValid=Mee;function Uee(t){let e=t.namespaces[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Pt.getAddressFromSession=Uee;function qee({transaction:t,response:e}){if(!e)throw OI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw OI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(fL.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new cL.Signature(r)),n&&t.applyGuardianSignature(new cL.Signature(n)),t}Pt.applyTransactionSignature=qee;function Vee(t){if(t)return Object.assign(Object.assign({},t),{url:Lee.getAppMetadata().url})}Pt.getMetadata=Vee;function Hee(t){return Bee(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}Pt.sleep=Hee});var Yl=v(vr=>{"use strict";l();var St=vr&&vr.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},kee=vr&&vr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vr,"__esModule",{value:!0});vr.WalletConnectV2Provider=vr.OptionalOperation=vr.Operation=vr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var Gee=Rc(),jee=kee(P8()),DI=Dl(),yo=iI(),we=aI();Object.defineProperty(vr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return we.WalletConnectV2ProviderErrorMessagesEnum}});var Fe=cI(),us=Kg();Object.defineProperty(vr,"Operation",{enumerable:!0,get:function(){return us.Operation}});Object.defineProperty(vr,"OptionalOperation",{enumerable:!0,get:function(){return us.OptionalOperation}});var Wt=pL(),PI=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,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.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return St(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Wt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield jee.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(we.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){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Wt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Fe.Logger.error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return St(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(we.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){yield Wt.sleep(yo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Wt.getAddressFromSession(n),o=n.namespaces[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(us.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?us.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:us.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Wt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:DI.getSdkError("USER_DISCONNECTED")});else{let r=Wt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:DI.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.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 St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:us.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new Gee.Signature(n))}catch{throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:us.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Wt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:us.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Wt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Wt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return St(this,void 0,void 0,function*(){return e?Wt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Fe.Logger.error(`${we.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return St(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Wt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.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&&Wt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.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:c}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>St(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>St(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Fe.Logger.error(we.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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Wt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,c;return St(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(!DI.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(c=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||c===void 0?void 0:c.unsubscribe(d.topic)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};vr.WalletConnectV2Provider=PI});var yL=v((tme,gL)=>{"use strict";l();gL.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 EL=v((nme,wL)=>{"use strict";l();var mL=typeof Symbol<"u"&&Symbol,Qee=yL();wL.exports=function(){return typeof mL!="function"||typeof Symbol!="function"||typeof mL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Qee()}});var bL=v((sme,AL)=>{"use strict";l();var vL={foo:{}},zee=Object;AL.exports=function(){return{__proto__:vL}.foo===vL.foo&&!({__proto__:null}instanceof zee)}});var SL=v((ame,_L)=>{"use strict";l();var Wee="Function.prototype.bind called on incompatible ",$ee=Object.prototype.toString,Kee=Math.max,Yee="[object Function]",IL=function(e,r){for(var n=[],i=0;i{"use strict";l();var Zee=SL();TL.exports=Function.prototype.bind||Zee});var xL=v((fme,CL)=>{"use strict";l();var ete=Function.prototype.call,tte=Object.prototype.hasOwnProperty,rte=ay();CL.exports=rte.call(ete,tte)});var cs=v((hme,RL)=>{"use strict";l();var Re,mu=SyntaxError,PL=Function,yu=TypeError,RI=function(t){try{return PL('"use strict"; return ('+t+").constructor;")()}catch{}},mo=Object.getOwnPropertyDescriptor;if(mo)try{mo({},"")}catch{mo=null}var BI=function(){throw new yu},nte=mo?function(){try{return arguments.callee,BI}catch{try{return mo(arguments,"callee").get}catch{return BI}}}():BI,pu=EL()(),ite=bL()(),kt=Object.getPrototypeOf||(ite?function(t){return t.__proto__}:null),gu={},ste=typeof Uint8Array>"u"||!kt?Re:kt(Uint8Array),wo={"%AggregateError%":typeof AggregateError>"u"?Re:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Re:ArrayBuffer,"%ArrayIteratorPrototype%":pu&&kt?kt([][Symbol.iterator]()):Re,"%AsyncFromSyncIteratorPrototype%":Re,"%AsyncFunction%":gu,"%AsyncGenerator%":gu,"%AsyncGeneratorFunction%":gu,"%AsyncIteratorPrototype%":gu,"%Atomics%":typeof Atomics>"u"?Re:Atomics,"%BigInt%":typeof BigInt>"u"?Re:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Re:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Re:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Re:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Re:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Re:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Re:FinalizationRegistry,"%Function%":PL,"%GeneratorFunction%":gu,"%Int8Array%":typeof Int8Array>"u"?Re:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Re:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Re:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":pu&&kt?kt(kt([][Symbol.iterator]())):Re,"%JSON%":typeof JSON=="object"?JSON:Re,"%Map%":typeof Map>"u"?Re:Map,"%MapIteratorPrototype%":typeof Map>"u"||!pu||!kt?Re:kt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Re:Promise,"%Proxy%":typeof Proxy>"u"?Re:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Re:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Re:Set,"%SetIteratorPrototype%":typeof Set>"u"||!pu||!kt?Re:kt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Re:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":pu&&kt?kt(""[Symbol.iterator]()):Re,"%Symbol%":pu?Symbol:Re,"%SyntaxError%":mu,"%ThrowTypeError%":nte,"%TypedArray%":ste,"%TypeError%":yu,"%Uint8Array%":typeof Uint8Array>"u"?Re:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Re:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Re:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Re:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Re:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Re:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Re:WeakSet};if(kt)try{null.error}catch(t){NL=kt(kt(t)),wo["%Error.prototype%"]=NL}var NL,ote=function t(e){var r;if(e==="%AsyncFunction%")r=RI("async function () {}");else if(e==="%GeneratorFunction%")r=RI("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=RI("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&kt&&(r=kt(i.prototype))}return wo[e]=r,r},OL={"%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=ay(),uy=xL(),ate=Jl.call(Function.call,Array.prototype.concat),ute=Jl.call(Function.apply,Array.prototype.splice),DL=Jl.call(Function.call,String.prototype.replace),cy=Jl.call(Function.call,String.prototype.slice),cte=Jl.call(Function.call,RegExp.prototype.exec),lte=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,fte=/\\(\\)?/g,dte=function(e){var r=cy(e,0,1),n=cy(e,-1);if(r==="%"&&n!=="%")throw new mu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new mu("invalid intrinsic syntax, expected opening `%`");var i=[];return DL(e,lte,function(s,o,a,u){i[i.length]=a?DL(u,fte,"$1"):o||s}),i},hte=function(e,r){var n=e,i;if(uy(OL,n)&&(i=OL[n],n="%"+i[0]+"%"),uy(wo,n)){var s=wo[n];if(s===gu&&(s=ote(n)),typeof s>"u"&&!r)throw new yu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new mu("intrinsic "+e+" does not exist!")};RL.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new yu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new yu('"allowMissing" argument must be a boolean');if(cte(/^%?[^%]*%?$/,e)===null)throw new mu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=dte(e),i=n.length>0?n[0]:"",s=hte("%"+i+"%",r),o=s.name,a=s.value,u=!1,c=s.alias;c&&(i=c[0],ute(n,ate([0,1],c)));for(var f=1,d=!0;f=n.length){var A=mo(a,g);d=!!A,d&&"get"in A&&!("originalValue"in A.get)?a=A.get:a=a[g]}else d=uy(a,g),a=a[g];d&&!u&&(wo[o]=a)}}return a}});var MI=v((gme,BL)=>{"use strict";l();var pte=cs(),LI=pte("%Object.defineProperty%",!0),FI=function(){if(LI)try{return LI({},"a",{value:1}),!0}catch{return!1}return!1};FI.hasArrayLengthDefineBug=function(){if(!FI())return null;try{return LI([],"length",{value:1}).length!==1}catch{return!0}};BL.exports=FI});var UI=v((mme,LL)=>{"use strict";l();var gte=cs(),ly=gte("%Object.getOwnPropertyDescriptor%",!0);if(ly)try{ly([],"length")}catch{ly=null}LL.exports=ly});var UL=v((Eme,ML)=>{"use strict";l();var yte=MI()(),qI=cs(),Xl=yte&&qI("%Object.defineProperty%",!0);if(Xl)try{Xl({},"a",{value:1})}catch{Xl=!1}var mte=qI("%SyntaxError%"),wu=qI("%TypeError%"),FL=UI();ML.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new wu("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new wu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new wu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new wu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new wu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new wu("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!FL&&FL(e,r);if(Xl)Xl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new mte("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var jL=v((Ame,GL)=>{"use strict";l();var kL=cs(),qL=UL(),wte=MI()(),VL=UI(),HL=kL("%TypeError%"),Ete=kL("%Math.floor%");GL.exports=function(e,r){if(typeof e!="function")throw new HL("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Ete(r)!==r)throw new HL("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&VL){var o=VL(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(wte?qL(e,"length",r,!0,!0):qL(e,"length",r)),e}});var KL=v((Ime,fy)=>{"use strict";l();var VI=ay(),Eu=cs(),vte=jL(),Ate=Eu("%TypeError%"),zL=Eu("%Function.prototype.apply%"),WL=Eu("%Function.prototype.call%"),$L=Eu("%Reflect.apply%",!0)||VI.call(WL,zL),Zl=Eu("%Object.defineProperty%",!0),bte=Eu("%Math.max%");if(Zl)try{Zl({},"a",{value:1})}catch{Zl=null}fy.exports=function(e){if(typeof e!="function")throw new Ate("a function is required");var r=$L(VI,WL,arguments);return vte(r,1+bte(0,e.length-(arguments.length-1)),!0)};var QL=function(){return $L(VI,zL,arguments)};Zl?Zl(fy.exports,"apply",{value:QL}):fy.exports.apply=QL});var ZL=v((Sme,XL)=>{"use strict";l();var YL=cs(),JL=KL(),Ite=JL(YL("String.prototype.indexOf"));XL.exports=function(e,r){var n=YL(e,!!r);return typeof n=="function"&&Ite(e,".prototype.")>-1?JL(n):n}});var eF=v(()=>{l()});var vF=v((Ome,EF)=>{l();var YI=typeof Map=="function"&&Map.prototype,HI=Object.getOwnPropertyDescriptor&&YI?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,hy=YI&&HI&&typeof HI.get=="function"?HI.get:null,tF=YI&&Map.prototype.forEach,JI=typeof Set=="function"&&Set.prototype,kI=Object.getOwnPropertyDescriptor&&JI?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,py=JI&&kI&&typeof kI.get=="function"?kI.get:null,rF=JI&&Set.prototype.forEach,_te=typeof WeakMap=="function"&&WeakMap.prototype,tf=_te?WeakMap.prototype.has:null,Ste=typeof WeakSet=="function"&&WeakSet.prototype,rf=Ste?WeakSet.prototype.has:null,Tte=typeof WeakRef=="function"&&WeakRef.prototype,nF=Tte?WeakRef.prototype.deref:null,Cte=Boolean.prototype.valueOf,xte=Object.prototype.toString,Nte=Function.prototype.toString,Ote=String.prototype.match,XI=String.prototype.slice,fs=String.prototype.replace,Dte=String.prototype.toUpperCase,iF=String.prototype.toLowerCase,hF=RegExp.prototype.test,sF=Array.prototype.concat,qn=Array.prototype.join,Pte=Array.prototype.slice,oF=Math.floor,QI=typeof BigInt=="function"?BigInt.prototype.valueOf:null,GI=Object.getOwnPropertySymbols,zI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,vu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",nr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===vu||!0)?Symbol.toStringTag:null,pF=Object.prototype.propertyIsEnumerable,aF=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function uF(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||hF.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-oF(-t):oF(t);if(n!==t){var i=String(n),s=XI.call(e,i.length+1);return fs.call(i,r,"$&_")+"."+fs.call(fs.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fs.call(e,r,"$&_")}var WI=eF(),cF=WI.custom,lF=yF(cF)?cF:null;EF.exports=function t(e,r,n,i){var s=r||{};if(ls(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ls(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=ls(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(ls(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(ls(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 wF(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?uF(e,u):u}if(typeof e=="bigint"){var c=String(e)+"n";return a?uF(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return $I(e)?"[Array]":"[Object]";var d=Yte(s,n);if(typeof i>"u")i=[];else if(mF(i,e)>=0)return"[Circular]";function g(j,K,me){if(K&&(i=Pte.call(i),i.push(K)),me){var ce={depth:s.depth};return ls(s,"quoteStyle")&&(ce.quoteStyle=s.quoteStyle),t(j,ce,n+1,i)}return t(j,s,n+1,i)}if(typeof e=="function"&&!fF(e)){var m=Hte(e),y=dy(e,g);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(y.length>0?" { "+qn.call(y,", ")+" }":"")}if(yF(e)){var A=vu?fs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):zI.call(e);return typeof e=="object"&&!vu?ef(A):A}if(Wte(e)){for(var O="<"+iF.call(String(e.nodeName)),R=e.attributes||[],z=0;z",O}if($I(e)){if(e.length===0)return"[]";var M=dy(e,g);return d&&!Kte(M)?"["+KI(M,d)+"]":"[ "+qn.call(M,", ")+" ]"}if(Lte(e)){var b=dy(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!pF.call(e,"cause")?"{ ["+String(e)+"] "+qn.call(sF.call("[cause]: "+g(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+qn.call(b,", ")+" }"}if(typeof e=="object"&&o){if(lF&&typeof e[lF]=="function"&&WI)return WI(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(kte(e)){var S=[];return tF&&tF.call(e,function(j,K){S.push(g(K,e,!0)+" => "+g(j,e))}),dF("Map",hy.call(e),S,d)}if(Qte(e)){var N=[];return rF&&rF.call(e,function(j){N.push(g(j,e))}),dF("Set",py.call(e),N,d)}if(Gte(e))return jI("WeakMap");if(zte(e))return jI("WeakSet");if(jte(e))return jI("WeakRef");if(Mte(e))return ef(g(Number(e)));if(qte(e))return ef(g(QI.call(e)));if(Ute(e))return ef(Cte.call(e));if(Fte(e))return ef(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Bte(e)&&!fF(e)){var _=dy(e,g),T=aF?aF(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",X=!T&&nr&&Object(e)===e&&nr in e?XI.call(ds(e),8,-1):B?"Object":"",Q=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=Q+(X||B?"["+qn.call(sF.call([],X||[],B||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+KI(_,d)+"}":H+"{ "+qn.call(_,", ")+" }"}return String(e)};function gF(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Rte(t){return fs.call(String(t),/"/g,""")}function $I(t){return ds(t)==="[object Array]"&&(!nr||!(typeof t=="object"&&nr in t))}function Bte(t){return ds(t)==="[object Date]"&&(!nr||!(typeof t=="object"&&nr in t))}function fF(t){return ds(t)==="[object RegExp]"&&(!nr||!(typeof t=="object"&&nr in t))}function Lte(t){return ds(t)==="[object Error]"&&(!nr||!(typeof t=="object"&&nr in t))}function Fte(t){return ds(t)==="[object String]"&&(!nr||!(typeof t=="object"&&nr in t))}function Mte(t){return ds(t)==="[object Number]"&&(!nr||!(typeof t=="object"&&nr in t))}function Ute(t){return ds(t)==="[object Boolean]"&&(!nr||!(typeof t=="object"&&nr in t))}function yF(t){if(vu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!zI)return!1;try{return zI.call(t),!0}catch{}return!1}function qte(t){if(!t||typeof t!="object"||!QI)return!1;try{return QI.call(t),!0}catch{}return!1}var Vte=Object.prototype.hasOwnProperty||function(t){return t in this};function ls(t,e){return Vte.call(t,e)}function ds(t){return xte.call(t)}function Hte(t){if(t.name)return t.name;var e=Ote.call(Nte.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function mF(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 wF(XI.call(t,0,e.maxStringLength),e)+n}var i=fs.call(fs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$te);return gF(i,"single",e)}function $te(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":"")+Dte.call(e.toString(16))}function ef(t){return"Object("+t+")"}function jI(t){return t+" { ? }"}function dF(t,e,r,n){var i=n?KI(r,n):qn.call(r,", ");return t+" ("+e+") {"+i+"}"}function Kte(t){for(var e=0;e=0)return!1;return!0}function Yte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=qn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:qn.call(Array(e+1),r)}}function KI(t,e){if(t.length===0)return"";var r=` +Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.numDecimals),ne.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ne.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex(e.tokenType),ne.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleLocalMint?[ne.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ne.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ne.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ne.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ne.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.initialQuantity),ne.utf8ToHex(e.name),ne.bigIntToHex(e.royalties),ne.utf8ToHex(e.hash),ne.bufferToHex(e.attributes),...e.uris.map(ne.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:a,dataParts:u}){let c=this.buildTransactionPayload(u),f=o||this.computeGasLimit(c,a),d=new aL.TransactionVersion(xI.TRANSACTION_VERSION_DEFAULT),g=new aL.TransactionOptions(xI.TRANSACTION_OPTIONS_DEFAULT);return new Vee.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:c,version:d,options:g})}buildTransactionPayload(e){let r=e.join(xI.ARGUMENTS_SEPARATOR);return new Hee.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};ny.TokenOperationsFactory=NI});var cL=A(iy=>{"use strict";l();Object.defineProperty(iy,"__esModule",{value:!0});iy.TokenOperationsFactoryConfig=void 0;var kee=pt(),OI=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=kee.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};iy.TokenOperationsFactoryConfig=OI});var fL=A(sy=>{"use strict";l();Object.defineProperty(sy,"__esModule",{value:!0});sy.TokenOperationsOutcomeParser=void 0;var Gee=pt(),DI=Le(),lL=CI(),PI=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=h.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new DI.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new DI.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new DI.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return lL.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return lL.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return Gee.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};sy.TokenOperationsOutcomeParser=PI});var dL=A(pi=>{"use strict";l();var jee=pi&&pi.__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]}),RI=pi&&pi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jee(e,t,r)};Object.defineProperty(pi,"__esModule",{value:!0});RI(uL(),pi);RI(cL(),pi);RI(fL(),pi)});var hL=A(rt=>{"use strict";l();var Qee=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]}),Dt=rt&&rt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qee(e,t,r)};Object.defineProperty(rt,"__esModule",{value:!0});H8();Dt(ha(),rt);Dt(pt(),rt);Dt(TE(),rt);Dt(Le(),rt);Dt(bE(),rt);Dt(G8(),rt);Dt(Q8(),rt);Dt(pa(),rt);Dt(xc(),rt);Dt(z8(),rt);Dt(iL(),rt);Dt(Wh(),rt);Dt(_I(),rt);Dt(dL(),rt);Dt(Vm(),rt);Dt(Yr(),rt);Dt(Yn(),rt);Dt(Ih(),rt);Dt(vE(),rt);Dt(br(),rt)});var EL=A(Pt=>{"use strict";l();var zee=Pt&&Pt.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.sleep=Pt.getMetadata=Pt.applyTransactionSignature=Pt.getAddressFromSession=Pt.addressIsValid=Pt.getConnectionParams=Pt.getCurrentTopic=Pt.getCurrentSession=void 0;var yL=hL(),pL=Rc(),Wee=Dl(),oy=uI(),gi=fI(),BI=hI(),gL=Kg();function mL(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(wL(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw BI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Pt.getCurrentSession=mL;function $ee(t,e){if(!e)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=mL(t,e);if(!r?.topic)throw new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Pt.getCurrentTopic=$ee;function wL(t,e){var r,n,i;let s=[...oy.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(gL.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(gL.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${oy.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Pt.getConnectionParams=wL;function Kee(t){try{return!yL.Address.fromBech32(t).isEmpty()}catch{return!1}}Pt.addressIsValid=Kee;function Yee(t){let e=t.namespaces[oy.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Pt.getAddressFromSession=Yee;function Jee({transaction:t,response:e}){if(!e)throw BI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw BI.Logger.error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(gi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(yL.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new pL.Signature(r)),n&&t.applyGuardianSignature(new pL.Signature(n)),t}Pt.applyTransactionSignature=Jee;function Xee(t){if(t)return Object.assign(Object.assign({},t),{url:Wee.getAppMetadata().url})}Pt.getMetadata=Xee;function Zee(t){return zee(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}Pt.sleep=Zee});var Yl=A(vr=>{"use strict";l();var St=vr&&vr.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},ete=vr&&vr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vr,"__esModule",{value:!0});vr.WalletConnectV2Provider=vr.OptionalOperation=vr.Operation=vr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var tte=Rc(),rte=ete(q8()),LI=Dl(),yo=uI(),we=fI();Object.defineProperty(vr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return we.WalletConnectV2ProviderErrorMessagesEnum}});var Fe=hI(),cs=Kg();Object.defineProperty(vr,"Operation",{enumerable:!0,get:function(){return cs.Operation}});Object.defineProperty(vr,"OptionalOperation",{enumerable:!0,get:function(){return cs.OptionalOperation}});var Wt=EL(),FI=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,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.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return St(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Wt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield rte.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(we.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){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Wt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Fe.Logger.error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:we.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return St(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(we.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){yield Wt.sleep(yo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Wt.getAddressFromSession(n),o=n.namespaces[yo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(cs.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?cs.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:cs.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Wt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:LI.getSdkError("USER_DISCONNECTED")});else{let r=Wt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:LI.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.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 St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:cs.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new tte.Signature(n))}catch{throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:cs.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Wt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:cs.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Wt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${yo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Wt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Wt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return St(this,void 0,void 0,function*(){return e?Wt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Fe.Logger.error(`${we.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return St(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Wt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return St(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(we.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&&Wt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.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:c}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>St(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>St(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Fe.Logger.error(we.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{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return St(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(we.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Wt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,c;return St(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(!LI.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(c=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||c===void 0?void 0:c.unsubscribe(d.topic)}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Fe.Logger.error(we.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};vr.WalletConnectV2Provider=FI});var AL=A((dme,vL)=>{"use strict";l();vL.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 _L=A((pme,IL)=>{"use strict";l();var bL=typeof Symbol<"u"&&Symbol,nte=AL();IL.exports=function(){return typeof bL!="function"||typeof Symbol!="function"||typeof bL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:nte()}});var CL=A((yme,TL)=>{"use strict";l();var SL={foo:{}},ite=Object;TL.exports=function(){return{__proto__:SL}.foo===SL.foo&&!({__proto__:null}instanceof ite)}});var OL=A((wme,NL)=>{"use strict";l();var ste="Function.prototype.bind called on incompatible ",ote=Object.prototype.toString,ate=Math.max,ute="[object Function]",xL=function(e,r){for(var n=[],i=0;i{"use strict";l();var fte=OL();DL.exports=Function.prototype.bind||fte});var RL=A((bme,PL)=>{"use strict";l();var dte=Function.prototype.call,hte=Object.prototype.hasOwnProperty,pte=ay();PL.exports=pte.call(dte,hte)});var ls=A((_me,UL)=>{"use strict";l();var Re,Eu=SyntaxError,ML=Function,wu=TypeError,MI=function(t){try{return ML('"use strict"; return ('+t+").constructor;")()}catch{}},mo=Object.getOwnPropertyDescriptor;if(mo)try{mo({},"")}catch{mo=null}var UI=function(){throw new wu},gte=mo?function(){try{return arguments.callee,UI}catch{try{return mo(arguments,"callee").get}catch{return UI}}}():UI,yu=_L()(),yte=CL()(),Gt=Object.getPrototypeOf||(yte?function(t){return t.__proto__}:null),mu={},mte=typeof Uint8Array>"u"||!Gt?Re:Gt(Uint8Array),wo={"%AggregateError%":typeof AggregateError>"u"?Re:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Re:ArrayBuffer,"%ArrayIteratorPrototype%":yu&&Gt?Gt([][Symbol.iterator]()):Re,"%AsyncFromSyncIteratorPrototype%":Re,"%AsyncFunction%":mu,"%AsyncGenerator%":mu,"%AsyncGeneratorFunction%":mu,"%AsyncIteratorPrototype%":mu,"%Atomics%":typeof Atomics>"u"?Re:Atomics,"%BigInt%":typeof BigInt>"u"?Re:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Re:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Re:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Re:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Re:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Re:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Re:FinalizationRegistry,"%Function%":ML,"%GeneratorFunction%":mu,"%Int8Array%":typeof Int8Array>"u"?Re:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Re:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Re:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":yu&&Gt?Gt(Gt([][Symbol.iterator]())):Re,"%JSON%":typeof JSON=="object"?JSON:Re,"%Map%":typeof Map>"u"?Re:Map,"%MapIteratorPrototype%":typeof Map>"u"||!yu||!Gt?Re:Gt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Re:Promise,"%Proxy%":typeof Proxy>"u"?Re:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Re:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Re:Set,"%SetIteratorPrototype%":typeof Set>"u"||!yu||!Gt?Re:Gt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Re:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":yu&&Gt?Gt(""[Symbol.iterator]()):Re,"%Symbol%":yu?Symbol:Re,"%SyntaxError%":Eu,"%ThrowTypeError%":gte,"%TypedArray%":mte,"%TypeError%":wu,"%Uint8Array%":typeof Uint8Array>"u"?Re:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Re:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Re:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Re:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Re:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Re:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Re:WeakSet};if(Gt)try{null.error}catch(t){BL=Gt(Gt(t)),wo["%Error.prototype%"]=BL}var BL,wte=function t(e){var r;if(e==="%AsyncFunction%")r=MI("async function () {}");else if(e==="%GeneratorFunction%")r=MI("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=MI("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Gt&&(r=Gt(i.prototype))}return wo[e]=r,r},LL={"%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=ay(),uy=RL(),Ete=Jl.call(Function.call,Array.prototype.concat),vte=Jl.call(Function.apply,Array.prototype.splice),FL=Jl.call(Function.call,String.prototype.replace),cy=Jl.call(Function.call,String.prototype.slice),Ate=Jl.call(Function.call,RegExp.prototype.exec),bte=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ite=/\\(\\)?/g,_te=function(e){var r=cy(e,0,1),n=cy(e,-1);if(r==="%"&&n!=="%")throw new Eu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Eu("invalid intrinsic syntax, expected opening `%`");var i=[];return FL(e,bte,function(s,o,a,u){i[i.length]=a?FL(u,Ite,"$1"):o||s}),i},Ste=function(e,r){var n=e,i;if(uy(LL,n)&&(i=LL[n],n="%"+i[0]+"%"),uy(wo,n)){var s=wo[n];if(s===mu&&(s=wte(n)),typeof s>"u"&&!r)throw new wu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Eu("intrinsic "+e+" does not exist!")};UL.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new wu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new wu('"allowMissing" argument must be a boolean');if(Ate(/^%?[^%]*%?$/,e)===null)throw new Eu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=_te(e),i=n.length>0?n[0]:"",s=Ste("%"+i+"%",r),o=s.name,a=s.value,u=!1,c=s.alias;c&&(i=c[0],vte(n,Ete([0,1],c)));for(var f=1,d=!0;f=n.length){var b=mo(a,g);d=!!b,d&&"get"in b&&!("originalValue"in b.get)?a=b.get:a=a[g]}else d=uy(a,g),a=a[g];d&&!u&&(wo[o]=a)}}return a}});var HI=A((Tme,qL)=>{"use strict";l();var Tte=ls(),qI=Tte("%Object.defineProperty%",!0),VI=function(){if(qI)try{return qI({},"a",{value:1}),!0}catch{return!1}return!1};VI.hasArrayLengthDefineBug=function(){if(!VI())return null;try{return qI([],"length",{value:1}).length!==1}catch{return!0}};qL.exports=VI});var kI=A((xme,VL)=>{"use strict";l();var Cte=ls(),ly=Cte("%Object.getOwnPropertyDescriptor%",!0);if(ly)try{ly([],"length")}catch{ly=null}VL.exports=ly});var GL=A((Ome,kL)=>{"use strict";l();var xte=HI()(),GI=ls(),Xl=xte&&GI("%Object.defineProperty%",!0);if(Xl)try{Xl({},"a",{value:1})}catch{Xl=!1}var Nte=GI("%SyntaxError%"),vu=GI("%TypeError%"),HL=kI();kL.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new vu("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new vu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new vu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new vu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new vu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new vu("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!HL&&HL(e,r);if(Xl)Xl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new Nte("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var KL=A((Pme,$L)=>{"use strict";l();var WL=ls(),jL=GL(),Ote=HI()(),QL=kI(),zL=WL("%TypeError%"),Dte=WL("%Math.floor%");$L.exports=function(e,r){if(typeof e!="function")throw new zL("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Dte(r)!==r)throw new zL("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&QL){var o=QL(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Ote?jL(e,"length",r,!0,!0):jL(e,"length",r)),e}});var eF=A((Bme,fy)=>{"use strict";l();var jI=ay(),Au=ls(),Pte=KL(),Rte=Au("%TypeError%"),JL=Au("%Function.prototype.apply%"),XL=Au("%Function.prototype.call%"),ZL=Au("%Reflect.apply%",!0)||jI.call(XL,JL),Zl=Au("%Object.defineProperty%",!0),Bte=Au("%Math.max%");if(Zl)try{Zl({},"a",{value:1})}catch{Zl=null}fy.exports=function(e){if(typeof e!="function")throw new Rte("a function is required");var r=ZL(jI,XL,arguments);return Pte(r,1+Bte(0,e.length-(arguments.length-1)),!0)};var YL=function(){return ZL(jI,JL,arguments)};Zl?Zl(fy.exports,"apply",{value:YL}):fy.exports.apply=YL});var iF=A((Fme,nF)=>{"use strict";l();var tF=ls(),rF=eF(),Lte=rF(tF("String.prototype.indexOf"));nF.exports=function(e,r){var n=tF(e,!!r);return typeof n=="function"&&Lte(e,".prototype.")>-1?rF(n):n}});var sF=A(()=>{l()});var SF=A((Hme,_F)=>{l();var e_=typeof Map=="function"&&Map.prototype,QI=Object.getOwnPropertyDescriptor&&e_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,hy=e_&&QI&&typeof QI.get=="function"?QI.get:null,oF=e_&&Map.prototype.forEach,t_=typeof Set=="function"&&Set.prototype,zI=Object.getOwnPropertyDescriptor&&t_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,py=t_&&zI&&typeof zI.get=="function"?zI.get:null,aF=t_&&Set.prototype.forEach,Fte=typeof WeakMap=="function"&&WeakMap.prototype,tf=Fte?WeakMap.prototype.has:null,Mte=typeof WeakSet=="function"&&WeakSet.prototype,rf=Mte?WeakSet.prototype.has:null,Ute=typeof WeakRef=="function"&&WeakRef.prototype,uF=Ute?WeakRef.prototype.deref:null,qte=Boolean.prototype.valueOf,Vte=Object.prototype.toString,Hte=Function.prototype.toString,kte=String.prototype.match,r_=String.prototype.slice,ds=String.prototype.replace,Gte=String.prototype.toUpperCase,cF=String.prototype.toLowerCase,wF=RegExp.prototype.test,lF=Array.prototype.concat,qn=Array.prototype.join,jte=Array.prototype.slice,fF=Math.floor,KI=typeof BigInt=="function"?BigInt.prototype.valueOf:null,WI=Object.getOwnPropertySymbols,YI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,bu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",nr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===bu||!0)?Symbol.toStringTag:null,EF=Object.prototype.propertyIsEnumerable,dF=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function hF(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||wF.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-fF(-t):fF(t);if(n!==t){var i=String(n),s=r_.call(e,i.length+1);return ds.call(i,r,"$&_")+"."+ds.call(ds.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ds.call(e,r,"$&_")}var JI=sF(),pF=JI.custom,gF=AF(pF)?pF:null;_F.exports=function t(e,r,n,i){var s=r||{};if(fs(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fs(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=fs(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(fs(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(fs(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 IF(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?hF(e,u):u}if(typeof e=="bigint"){var c=String(e)+"n";return a?hF(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return XI(e)?"[Array]":"[Object]";var d=ure(s,n);if(typeof i>"u")i=[];else if(bF(i,e)>=0)return"[Circular]";function g(j,K,me){if(K&&(i=jte.call(i),i.push(K)),me){var ce={depth:s.depth};return fs(s,"quoteStyle")&&(ce.quoteStyle=s.quoteStyle),t(j,ce,n+1,i)}return t(j,s,n+1,i)}if(typeof e=="function"&&!yF(e)){var m=Zte(e),y=dy(e,g);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(y.length>0?" { "+qn.call(y,", ")+" }":"")}if(AF(e)){var b=bu?ds.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):YI.call(e);return typeof e=="object"&&!bu?ef(b):b}if(sre(e)){for(var O="<"+cF.call(String(e.nodeName)),R=e.attributes||[],z=0;z",O}if(XI(e)){if(e.length===0)return"[]";var M=dy(e,g);return d&&!are(M)?"["+ZI(M,d)+"]":"[ "+qn.call(M,", ")+" ]"}if(Wte(e)){var E=dy(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!EF.call(e,"cause")?"{ ["+String(e)+"] "+qn.call(lF.call("[cause]: "+g(e.cause),E),", ")+" }":E.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+qn.call(E,", ")+" }"}if(typeof e=="object"&&o){if(gF&&typeof e[gF]=="function"&&JI)return JI(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ere(e)){var S=[];return oF&&oF.call(e,function(j,K){S.push(g(K,e,!0)+" => "+g(j,e))}),mF("Map",hy.call(e),S,d)}if(nre(e)){var N=[];return aF&&aF.call(e,function(j){N.push(g(j,e))}),mF("Set",py.call(e),N,d)}if(tre(e))return $I("WeakMap");if(ire(e))return $I("WeakSet");if(rre(e))return $I("WeakRef");if(Kte(e))return ef(g(Number(e)));if(Jte(e))return ef(g(KI.call(e)));if(Yte(e))return ef(qte.call(e));if($te(e))return ef(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!zte(e)&&!yF(e)){var _=dy(e,g),T=dF?dF(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",X=!T&&nr&&Object(e)===e&&nr in e?r_.call(hs(e),8,-1):B?"Object":"",Q=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=Q+(X||B?"["+qn.call(lF.call([],X||[],B||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+ZI(_,d)+"}":H+"{ "+qn.call(_,", ")+" }"}return String(e)};function vF(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Qte(t){return ds.call(String(t),/"/g,""")}function XI(t){return hs(t)==="[object Array]"&&(!nr||!(typeof t=="object"&&nr in t))}function zte(t){return hs(t)==="[object Date]"&&(!nr||!(typeof t=="object"&&nr in t))}function yF(t){return hs(t)==="[object RegExp]"&&(!nr||!(typeof t=="object"&&nr in t))}function Wte(t){return hs(t)==="[object Error]"&&(!nr||!(typeof t=="object"&&nr in t))}function $te(t){return hs(t)==="[object String]"&&(!nr||!(typeof t=="object"&&nr in t))}function Kte(t){return hs(t)==="[object Number]"&&(!nr||!(typeof t=="object"&&nr in t))}function Yte(t){return hs(t)==="[object Boolean]"&&(!nr||!(typeof t=="object"&&nr in t))}function AF(t){if(bu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!YI)return!1;try{return YI.call(t),!0}catch{}return!1}function Jte(t){if(!t||typeof t!="object"||!KI)return!1;try{return KI.call(t),!0}catch{}return!1}var Xte=Object.prototype.hasOwnProperty||function(t){return t in this};function fs(t,e){return Xte.call(t,e)}function hs(t){return Vte.call(t)}function Zte(t){if(t.name)return t.name;var e=kte.call(Hte.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function bF(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 IF(r_.call(t,0,e.maxStringLength),e)+n}var i=ds.call(ds.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ore);return vF(i,"single",e)}function ore(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":"")+Gte.call(e.toString(16))}function ef(t){return"Object("+t+")"}function $I(t){return t+" { ? }"}function mF(t,e,r,n){var i=n?ZI(r,n):qn.call(r,", ");return t+" ("+e+") {"+i+"}"}function are(t){for(var e=0;e=0)return!1;return!0}function ure(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=qn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:qn.call(Array(e+1),r)}}function ZI(t,e){if(t.length===0)return"";var r=` `+e.prev+e.base;return r+qn.call(t,","+r)+` -`+e.prev}function dy(t,e){var r=$I(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";l();var ZI=cs(),Au=ZL(),Jte=vF(),Xte=ZI("%TypeError%"),gy=ZI("%WeakMap%",!0),yy=ZI("%Map%",!0),Zte=Au("WeakMap.prototype.get",!0),ere=Au("WeakMap.prototype.set",!0),tre=Au("WeakMap.prototype.has",!0),rre=Au("Map.prototype.get",!0),nre=Au("Map.prototype.set",!0),ire=Au("Map.prototype.has",!0),e_=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},sre=function(t,e){var r=e_(t,e);return r&&r.value},ore=function(t,e,r){var n=e_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},are=function(t,e){return!!e_(t,e)};AF.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Xte("Side channel does not contain "+Jte(s))},get:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Zte(e,s)}else if(yy){if(r)return rre(r,s)}else if(n)return sre(n,s)},has:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return tre(e,s)}else if(yy){if(r)return ire(r,s)}else if(n)return are(n,s);return!1},set:function(s,o){gy&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new gy),ere(e,s,o)):yy?(r||(r=new yy),nre(r,s,o)):(n||(n={key:{},next:null}),ore(n,s,o))}};return i}});var my=v((Bme,IF)=>{"use strict";l();var ure=String.prototype.replace,cre=/%20/g,t_={RFC1738:"RFC1738",RFC3986:"RFC3986"};IF.exports={default:t_.RFC3986,formatters:{RFC1738:function(t){return ure.call(t,cre,"+")},RFC3986:function(t){return String(t)}},RFC1738:t_.RFC1738,RFC3986:t_.RFC3986}});var n_=v((Fme,SF)=>{"use strict";l();var lre=my(),r_=Object.prototype.hasOwnProperty,Eo=Array.isArray,Vn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),fre=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Eo(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===lre.RFC1738&&(c===40||c===41)){a+=o.charAt(u);continue}if(c<128){a=a+Vn[c];continue}if(c<2048){a=a+(Vn[192|c>>6]+Vn[128|c&63]);continue}if(c<55296||c>=57344){a=a+(Vn[224|c>>12]+Vn[128|c>>6&63]+Vn[128|c&63]);continue}u+=1,c=65536+((c&1023)<<10|o.charCodeAt(u)&1023),a+=Vn[240|c>>18]+Vn[128|c>>12&63]+Vn[128|c>>6&63]+Vn[128|c&63]}return a},yre=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";l();var xF=bF(),s_=n_(),nf=my(),Are=Object.prototype.hasOwnProperty,TF={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},vo=Array.isArray,bre=String.prototype.split,Ire=Array.prototype.push,NF=function(t,e){Ire.apply(t,vo(e)?e:[e])},_re=Date.prototype.toISOString,CF=nf.default,$t={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:s_.encode,encodeValuesOnly:!1,format:CF,formatter:nf.formatters[CF],indices:!1,serializeDate:function(e){return _re.call(e)},skipNulls:!1,strictNullHandling:!1},Sre=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},i_={},Tre=function t(e,r,n,i,s,o,a,u,c,f,d,g,m,y,A){for(var O=e,R=A,z=0,M=!1;(R=R.get(i_))!==void 0&&!M;){var b=R.get(e);if(z+=1,typeof b<"u"){if(b===z)throw new RangeError("Cyclic object value");M=!0}typeof R.get(i_)>"u"&&(z=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&vo(O)&&(O=s_.maybeMap(O,function(ie){return ie instanceof Date?f(ie):ie})),O===null){if(i)return o&&!m?o(r,$t.encoder,y,"key",d):r;O=""}if(Sre(O)||s_.isBuffer(O)){if(o){var S=m?r:o(r,$t.encoder,y,"key",d);if(n==="comma"&&m){for(var N=bre.call(String(O),","),_="",T=0;T"u")return B;var X;if(n==="comma"&&vo(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(vo(a))X=a;else{var Q=Object.keys(O);X=u?Q.sort(u):Q}for(var H=0;H"u"?$t.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:$t.charsetSentinel,delimiter:typeof e.delimiter>"u"?$t.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:$t.encode,encoder:typeof e.encoder=="function"?e.encoder:$t.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:$t.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:$t.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:$t.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:$t.strictNullHandling}};OF.exports=function(t,e){var r=t,n=Cre(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):vo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in TF?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=TF[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=xF(),f=0;f0?m+g:""}});var BF=v((Vme,RF)=>{"use strict";l();var bu=n_(),o_=Object.prototype.hasOwnProperty,xre=Array.isArray,Gt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:bu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Nre=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},PF=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Ore="utf8=%26%2310003%3B",Dre="utf8=%E2%9C%93",Pre=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,c=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(y=xre(y)?[y]:y),o_.call(n,m)?n[m]=bu.combine(n[m],y):n[m]=y}return n},Rre=function(t,e,r,n){for(var i=n?e:PF(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,c=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(c)&&a!==u&&String(c)===u&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Bre=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),c=u?s.slice(0,u.index):s,f=[];if(c){if(!n.plainObjects&&o_.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Gt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Gt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Gt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Gt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Gt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Gt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Gt.comma,decoder:typeof e.decoder=="function"?e.decoder:Gt.decoder,delimiter:typeof e.delimiter=="string"||bu.isRegExp(e.delimiter)?e.delimiter:Gt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Gt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Gt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Gt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Gt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Gt.strictNullHandling}};RF.exports=function(t,e){var r=Lre(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Pre(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";l();var Fre=DF(),Mre=BF(),Ure=my();LF.exports={formats:Ure,parse:Mre,stringify:Fre}});var a_=v(Ge=>{"use strict";l();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Ge.WALLET_PROVIDER_CALLBACK_PARAM=Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL=Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL=Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL=Ge.WALLET_PROVIDER_DISCONNECT_URL=Ge.WALLET_PROVIDER_CONNECT_URL=Ge.XALIAS_PROVIDER_TESTNET=Ge.XALIAS_PROVIDER_DEVNET=Ge.XALIAS_PROVIDER_MAINNET=Ge.WALLET_PROVIDER_TESTNET=Ge.WALLET_PROVIDER_DEVNET=Ge.WALLET_PROVIDER_MAINNET=void 0;Ge.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";Ge.XALIAS_PROVIDER_MAINNET="https://xalias.com";Ge.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";Ge.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";Ge.WALLET_PROVIDER_CONNECT_URL="hook/login";Ge.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";Ge.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var MF=v(Iu=>{"use strict";l();Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ErrCannotSignedMessage=Iu.ErrCannotGetSignedTransactions=void 0;var u_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};Iu.ErrCannotGetSignedTransactions=u_;var c_=class extends Error{constructor(){super("Cannot get signed message")}};Iu.ErrCannotSignedMessage=c_});var UF=v(wy=>{"use strict";l();Object.defineProperty(wy,"__esModule",{value:!0});wy.PlainSignedTransaction=void 0;var l_=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.signature="",Object.assign(this,e)}};wy.PlainSignedTransaction=l_});var _u=v(gs=>{"use strict";l();var hs=gs&&gs.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},qre=gs&&gs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gs,"__esModule",{value:!0});gs.WalletProvider=void 0;var f_=qre(FF()),ps=a_(),d_=MF(),Vre=UF(),h_=class t{constructor(e){this.walletUrl=e}login(e){return hs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ps.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return hs(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 hs(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return hs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ps.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return hs(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ps.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=f_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new d_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return hs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ps.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return hs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ps.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return hs(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=f_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ps.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ps.WALLET_PROVIDER_CALLBACK_PARAM]===ps.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new d_.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new d_.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let a=t.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}};gs.WalletProvider=h_});var wM=v((Xme,mM)=>{"use strict";l();function YF(t,e){return function(){return t.apply(e,arguments)}}var{toString:Hre}=Object.prototype,{getPrototypeOf:S_}=Object,by=(t=>e=>{let r=Hre.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),kn=t=>(t=t.toLowerCase(),e=>by(e)===t),Iy=t=>e=>typeof e===t,{isArray:xu}=Array,of=Iy("undefined");function kre(t){return t!==null&&!of(t)&&t.constructor!==null&&!of(t.constructor)&&Qr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var JF=kn("ArrayBuffer");function Gre(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&JF(t.buffer),e}var jre=Iy("string"),Qr=Iy("function"),XF=Iy("number"),_y=t=>t!==null&&typeof t=="object",Qre=t=>t===!0||t===!1,Ey=t=>{if(by(t)!=="object")return!1;let e=S_(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},zre=kn("Date"),Wre=kn("File"),$re=kn("Blob"),Kre=kn("FileList"),Yre=t=>_y(t)&&Qr(t.pipe),Jre=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Qr(t.append)&&((e=by(t))==="formdata"||e==="object"&&Qr(t.toString)&&t.toString()==="[object FormData]"))},Xre=kn("URLSearchParams"),Zre=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function af(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),xu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var eM=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,tM=t=>!of(t)&&t!==eM;function w_(){let{caseless:t}=tM(this)&&this||{},e={},r=(n,i)=>{let s=t&&ZF(e,i)||i;Ey(e[s])&&Ey(n)?e[s]=w_(e[s],n):Ey(n)?e[s]=w_({},n):xu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(af(e,(i,s)=>{r&&Qr(i)?t[s]=YF(i,r):t[s]=i},{allOwnKeys:n}),t),tne=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rne=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},nne=(t,e,r,n)=>{let i,s,o,a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&S_(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ine=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},sne=t=>{if(!t)return null;if(xu(t))return t;let e=t.length;if(!XF(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},one=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&S_(Uint8Array)),ane=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},une=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},cne=kn("HTMLFormElement"),lne=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),qF=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),fne=kn("RegExp"),rM=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};af(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},dne=t=>{rM(t,(e,r)=>{if(Qr(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(Qr(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},hne=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return xu(t)?n(t):n(String(t).split(e)),r},pne=()=>{},gne=(t,e)=>(t=+t,Number.isFinite(t)?t:e),p_="abcdefghijklmnopqrstuvwxyz",VF="0123456789",nM={DIGIT:VF,ALPHA:p_,ALPHA_DIGIT:p_+p_.toUpperCase()+VF},yne=(t=16,e=nM.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function mne(t){return!!(t&&Qr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var wne=t=>{let e=new Array(10),r=(n,i)=>{if(_y(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=xu(n)?[]:{};return af(n,(o,a)=>{let u=r(o,i+1);!of(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},Ene=kn("AsyncFunction"),vne=t=>t&&(_y(t)||Qr(t))&&Qr(t.then)&&Qr(t.catch),Y={isArray:xu,isArrayBuffer:JF,isBuffer:kre,isFormData:Jre,isArrayBufferView:Gre,isString:jre,isNumber:XF,isBoolean:Qre,isObject:_y,isPlainObject:Ey,isUndefined:of,isDate:zre,isFile:Wre,isBlob:$re,isRegExp:fne,isFunction:Qr,isStream:Yre,isURLSearchParams:Xre,isTypedArray:one,isFileList:Kre,forEach:af,merge:w_,extend:ene,trim:Zre,stripBOM:tne,inherits:rne,toFlatObject:nne,kindOf:by,kindOfTest:kn,endsWith:ine,toArray:sne,forEachEntry:ane,matchAll:une,isHTMLForm:cne,hasOwnProperty:qF,hasOwnProp:qF,reduceDescriptors:rM,freezeMethods:dne,toObjectSet:hne,toCamelCase:lne,noop:pne,toFiniteNumber:gne,findKey:ZF,global:eM,isContextDefined:tM,ALPHABET:nM,generateString:yne,isSpecCompliantForm:mne,toJSONObject:wne,isAsyncFn:Ene,isThenable:vne};function Me(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Y.inherits(Me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Y.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var iM=Me.prototype,sM={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{sM[t]={value:t}});Object.defineProperties(Me,sM);Object.defineProperty(iM,"isAxiosError",{value:!0});Me.from=(t,e,r,n,i,s)=>{let o=Object.create(iM);return Y.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),Me.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var Ane=null;function E_(t){return Y.isPlainObject(t)||Y.isArray(t)}function oM(t){return Y.endsWith(t,"[]")?t.slice(0,-2):t}function HF(t,e,r){return t?t.concat(e).map(function(i,s){return i=oM(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function bne(t){return Y.isArray(t)&&!t.some(E_)}var Ine=Y.toFlatObject(Y,{},null,function(e){return/^is[A-Z]/.test(e)});function Sy(t,e,r){if(!Y.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Y.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(A,O){return!Y.isUndefined(O[A])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Y.isSpecCompliantForm(e);if(!Y.isFunction(i))throw new TypeError("visitor must be a function");function c(y){if(y===null)return"";if(Y.isDate(y))return y.toISOString();if(!u&&Y.isBlob(y))throw new Me("Blob is not supported. Use a Buffer instead.");return Y.isArrayBuffer(y)||Y.isTypedArray(y)?u&&typeof Blob=="function"?new Blob([y]):h.Buffer.from(y):y}function f(y,A,O){let R=y;if(y&&!O&&typeof y=="object"){if(Y.endsWith(A,"{}"))A=n?A:A.slice(0,-2),y=JSON.stringify(y);else if(Y.isArray(y)&&bne(y)||(Y.isFileList(y)||Y.endsWith(A,"[]"))&&(R=Y.toArray(y)))return A=oM(A),R.forEach(function(M,b){!(Y.isUndefined(M)||M===null)&&e.append(o===!0?HF([A],b,s):o===null?A:A+"[]",c(M))}),!1}return E_(y)?!0:(e.append(HF(O,A,s),c(y)),!1)}let d=[],g=Object.assign(Ine,{defaultVisitor:f,convertValue:c,isVisitable:E_});function m(y,A){if(!Y.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+A.join("."));d.push(y),Y.forEach(y,function(R,z){(!(Y.isUndefined(R)||R===null)&&i.call(e,R,Y.isString(z)?z.trim():z,A,g))===!0&&m(R,A?A.concat(z):[z])}),d.pop()}}if(!Y.isObject(t))throw new TypeError("data must be an object");return m(t),e}function kF(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function T_(t,e){this._pairs=[],t&&Sy(t,this,e)}var aM=T_.prototype;aM.append=function(e,r){this._pairs.push([e,r])};aM.toString=function(e){let r=e?function(n){return e.call(this,n,kF)}:kF;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function _ne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function uM(t,e,r){if(!e)return t;let n=r&&r.encode||_ne,i=r&&r.serialize,s;if(i?s=i(e,r):s=Y.isURLSearchParams(e)?e.toString():new T_(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var v_=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Y.forEach(this.handlers,function(n){n!==null&&e(n)})}},GF=v_,cM={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Sne=typeof URLSearchParams<"u"?URLSearchParams:T_,Tne=typeof FormData<"u"?FormData:null,Cne=typeof Blob<"u"?Blob:null,xne={isBrowser:!0,classes:{URLSearchParams:Sne,FormData:Tne,Blob:Cne},protocols:["http","https","file","blob","url","data"]},lM=typeof window<"u"&&typeof document<"u",Nne=(t=>lM&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),One=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dne=Object.freeze({__proto__:null,hasBrowserEnv:lM,hasStandardBrowserWebWorkerEnv:One,hasStandardBrowserEnv:Nne}),Hn={...Dne,...xne};function Pne(t,e){return Sy(t,new Hn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Hn.isNode&&Y.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Rne(t){return Y.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Bne(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&Y.isArray(i)?i.length:o,u?(Y.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Y.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Y.isArray(i[o])&&(i[o]=Bne(i[o])),!a)}if(Y.isFormData(t)&&Y.isFunction(t.entries)){let r={};return Y.forEachEntry(t,(n,i)=>{e(Rne(n),i,r,0)}),r}return null}function Lne(t,e,r){if(Y.isString(t))try{return(e||JSON.parse)(t),Y.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var C_={transitional:cM,adapter:["xhr","http"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Y.isObject(e);if(s&&Y.isHTMLForm(e)&&(e=new FormData(e)),Y.isFormData(e))return i&&i?JSON.stringify(fM(e)):e;if(Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e))return e;if(Y.isArrayBufferView(e))return e.buffer;if(Y.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Pne(e,this.formSerializer).toString();if((a=Y.isFileList(e))||n.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return Sy(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Lne(e)):e}],transformResponse:[function(e){let r=this.transitional||C_.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&Y.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Me.from(a,Me.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hn.classes.FormData,Blob:Hn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(["delete","get","head","post","put","patch"],t=>{C_.headers[t]={}});var x_=C_,Fne=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Mne=t=>{let e={},r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&Fne[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},jF=Symbol("internals");function sf(t){return t&&String(t).trim().toLowerCase()}function vy(t){return t===!1||t==null?t:Y.isArray(t)?t.map(vy):String(t)}function Une(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var qne=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function g_(t,e,r,n,i){if(Y.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Y.isString(e)){if(Y.isString(n))return e.indexOf(n)!==-1;if(Y.isRegExp(n))return n.test(e)}}function Vne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Hne(t,e){let r=Y.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Su=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(a,u,c){let f=sf(u);if(!f)throw new Error("header name must be a non-empty string");let d=Y.findKey(i,f);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||u]=vy(a))}let o=(a,u)=>Y.forEach(a,(c,f)=>s(c,f,u));return Y.isPlainObject(e)||e instanceof this.constructor?o(e,r):Y.isString(e)&&(e=e.trim())&&!qne(e)?o(Mne(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return Une(i);if(Y.isFunction(r))return r.call(this,i,n);if(Y.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||g_(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=sf(o),o){let a=Y.findKey(n,o);a&&(!r||g_(n,n[a],a,r))&&(delete n[a],i=!0)}}return Y.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||g_(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return Y.forEach(this,(i,s)=>{let o=Y.findKey(n,s);if(o){r[o]=vy(i),delete r[s];return}let a=e?Vne(s):String(s).trim();a!==s&&delete r[s],r[a]=vy(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return Y.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Y.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[jF]=this[jF]={accessors:{}}).accessors,i=this.prototype;function s(o){let a=sf(o);n[a]||(Hne(i,o),n[a]=!0)}return Y.isArray(e)?e.forEach(s):s(e),this}};Su.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Y.reduceDescriptors(Su.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});Y.freezeMethods(Su);var yi=Su;function y_(t,e){let r=this||x_,n=e||r,i=yi.from(n.headers),s=n.data;return Y.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function dM(t){return!!(t&&t.__CANCEL__)}function uf(t,e,r){Me.call(this,t??"canceled",Me.ERR_CANCELED,e,r),this.name="CanceledError"}Y.inherits(uf,Me,{__CANCEL__:!0});function kne(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Me("Request failed with status code "+r.status,[Me.ERR_BAD_REQUEST,Me.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var Gne=Hn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];Y.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&o.push("path="+n),Y.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function jne(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Qne(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function hM(t,e){return t&&!jne(e)?Qne(t,e):e}var zne=Hn.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let a=Y.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function Wne(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function $ne(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){let c=Date.now(),f=n[s];o||(o=c),r[i]=u,n[i]=c;let d=s,g=0;for(;d!==i;)g+=r[d++],d=d%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o{let s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,u=n(a),c=s<=o;r=s;let f={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&c?(o-s)/u:void 0,event:i};f[e?"download":"upload"]=!0,t(f)}}var Kne=typeof XMLHttpRequest<"u",Yne=Kne&&function(t){return new Promise(function(r,n){let i=t.data,s=yi.from(t.headers).normalize(),{responseType:o,withXSRFToken:a}=t,u;function c(){t.cancelToken&&t.cancelToken.unsubscribe(u),t.signal&&t.signal.removeEventListener("abort",u)}let f;if(Y.isFormData(i)){if(Hn.hasStandardBrowserEnv||Hn.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((f=s.getContentType())!==!1){let[A,...O]=f?f.split(";").map(R=>R.trim()).filter(Boolean):[];s.setContentType([A||"multipart/form-data",...O].join("; "))}}let d=new XMLHttpRequest;if(t.auth){let A=t.auth.username||"",O=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(A+":"+O))}let g=hM(t.baseURL,t.url);d.open(t.method.toUpperCase(),uM(g,t.params,t.paramsSerializer),!0),d.timeout=t.timeout;function m(){if(!d)return;let A=yi.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),R={data:!o||o==="text"||o==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:A,config:t,request:d};kne(function(M){r(M),c()},function(M){n(M),c()},R),d=null}if("onloadend"in d?d.onloadend=m:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(m)},d.onabort=function(){d&&(n(new Me("Request aborted",Me.ECONNABORTED,t,d)),d=null)},d.onerror=function(){n(new Me("Network Error",Me.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let O=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",R=t.transitional||cM;t.timeoutErrorMessage&&(O=t.timeoutErrorMessage),n(new Me(O,R.clarifyTimeoutError?Me.ETIMEDOUT:Me.ECONNABORTED,t,d)),d=null},Hn.hasStandardBrowserEnv&&(a&&Y.isFunction(a)&&(a=a(t)),a||a!==!1&&zne(g))){let A=t.xsrfHeaderName&&t.xsrfCookieName&&Gne.read(t.xsrfCookieName);A&&s.set(t.xsrfHeaderName,A)}i===void 0&&s.setContentType(null),"setRequestHeader"in d&&Y.forEach(s.toJSON(),function(O,R){d.setRequestHeader(R,O)}),Y.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),o&&o!=="json"&&(d.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&d.addEventListener("progress",QF(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",QF(t.onUploadProgress)),(t.cancelToken||t.signal)&&(u=A=>{d&&(n(!A||A.type?new uf(null,t,d):A),d.abort(),d=null)},t.cancelToken&&t.cancelToken.subscribe(u),t.signal&&(t.signal.aborted?u():t.signal.addEventListener("abort",u)));let y=Wne(g);if(y&&Hn.protocols.indexOf(y)===-1){n(new Me("Unsupported protocol "+y+":",Me.ERR_BAD_REQUEST,t));return}d.send(i||null)})},A_={http:Ane,xhr:Yne};Y.forEach(A_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var zF=t=>`- ${t}`,Jne=t=>Y.isFunction(t)||t===null||t===!1,pM={getAdapter:t=>{t=Y.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : -`+s.map(zF).join(` -`):" "+zF(s[0]):"as no adapter specified";throw new Me("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:A_};function m_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new uf(null,t)}function WF(t){return m_(t),t.headers=yi.from(t.headers),t.data=y_.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),pM.getAdapter(t.adapter||x_.adapter)(t).then(function(n){return m_(t),n.data=y_.call(t,t.transformResponse,n),n.headers=yi.from(n.headers),n},function(n){return dM(n)||(m_(t),n&&n.response&&(n.response.data=y_.call(t,t.transformResponse,n.response),n.response.headers=yi.from(n.response.headers))),Promise.reject(n)})}var $F=t=>t instanceof yi?t.toJSON():t;function Tu(t,e){e=e||{};let r={};function n(c,f,d){return Y.isPlainObject(c)&&Y.isPlainObject(f)?Y.merge.call({caseless:d},c,f):Y.isPlainObject(f)?Y.merge({},f):Y.isArray(f)?f.slice():f}function i(c,f,d){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c,d)}else return n(c,f,d)}function s(c,f){if(!Y.isUndefined(f))return n(void 0,f)}function o(c,f){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c)}else return n(void 0,f)}function a(c,f,d){if(d in e)return n(c,f);if(d in t)return n(void 0,c)}let u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,f)=>i($F(c),$F(f),!0)};return Y.forEach(Object.keys(Object.assign({},t,e)),function(f){let d=u[f]||i,g=d(t[f],e[f],f);Y.isUndefined(g)&&d!==a||(r[f]=g)}),r}var gM="1.6.5",N_={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{N_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var KF={};N_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+gM+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new Me(i(o," has been removed"+(r?" in "+r:"")),Me.ERR_DEPRECATED);return r&&!KF[o]&&(KF[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Xne(t,e,r){if(typeof t!="object")throw new Me("options must be an object",Me.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new Me("option "+s+" must be "+u,Me.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Me("Unknown option "+s,Me.ERR_BAD_OPTION)}}var b_={assertOptions:Xne,validators:N_},ys=b_.validators,Cu=class{constructor(e){this.defaults=e,this.interceptors={request:new GF,response:new GF}}request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Tu(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&b_.assertOptions(n,{silentJSONParsing:ys.transitional(ys.boolean),forcedJSONParsing:ys.transitional(ys.boolean),clarifyTimeoutError:ys.transitional(ys.boolean)},!1),i!=null&&(Y.isFunction(i)?r.paramsSerializer={serialize:i}:b_.assertOptions(i,{encode:ys.function,serialize:ys.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Y.merge(s.common,s[r.method]);s&&Y.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),r.headers=yi.concat(o,s);let a=[],u=!0;this.interceptors.request.forEach(function(A){typeof A.runWhen=="function"&&A.runWhen(r)===!1||(u=u&&A.synchronous,a.unshift(A.fulfilled,A.rejected))});let c=[];this.interceptors.response.forEach(function(A){c.push(A.fulfilled,A.rejected)});let f,d=0,g;if(!u){let y=[WF.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,c),g=y.length,f=Promise.resolve(r);d{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new uf(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Zne=I_;function eie(t){return function(r){return t.apply(null,r)}}function tie(t){return Y.isObject(t)&&t.isAxiosError===!0}var __={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(__).forEach(([t,e])=>{__[e]=t});var rie=__;function yM(t){let e=new Ay(t),r=YF(Ay.prototype.request,e);return Y.extend(r,Ay.prototype,e,{allOwnKeys:!0}),Y.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return yM(Tu(t,i))},r}var Rt=yM(x_);Rt.Axios=Ay;Rt.CanceledError=uf;Rt.CancelToken=Zne;Rt.isCancel=dM;Rt.VERSION=gM;Rt.toFormData=Sy;Rt.AxiosError=Me;Rt.Cancel=Rt.CanceledError;Rt.all=function(e){return Promise.all(e)};Rt.spread=eie;Rt.isAxiosError=tie;Rt.mergeConfig=Tu;Rt.AxiosHeaders=yi;Rt.formToJSON=t=>fM(Y.isHTMLForm(t)?new FormData(t):t);Rt.getAdapter=pM.getAdapter;Rt.HttpStatusCode=rie;Rt.default=Rt;mM.exports=Rt});var EM=v(Ty=>{"use strict";l();Object.defineProperty(Ty,"__esModule",{value:!0});Ty.NativeAuthClientConfig=void 0;var O_=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Ty.NativeAuthClientConfig=O_});var P_=v(Nu=>{"use strict";l();var Ao=Nu&&Nu.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.NativeAuthClient=void 0;var nie=wM(),iie=EM(),D_=class{constructor(e){this.config=Object.assign(new iie.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Ao(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return Ao(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Ao(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return Ao(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return Ao(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return Ao(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(h.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return Ao(this,void 0,void 0,function*(){return yield nie.default.get(e,{headers:this.config.extraRequestHeaders})})}};Nu.NativeAuthClient=D_});var _M=v(Oy=>{"use strict";l();Object.defineProperty(Oy,"__esModule",{value:!0});Oy.TransactionStatus=void 0;var R_=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("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}};Oy.TransactionStatus=R_});var Pu=v(jt=>{"use strict";l();var sie=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]}),oie=jt&&jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aie=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)&&sie(e,t,r);return oie(e,t),e};Object.defineProperty(jt,"__esModule",{value:!0});jt.zeroPadStringIfOddLength=jt.isPaddedHex=jt.numberToPaddedHex=jt.Nonce=jt.Address=void 0;var SM=aie(rw()),uie="erd",B_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=SM.toWords(e),n=SM.encode(uie,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};jt.Address=B_;var L_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return TM(this.value)}};jt.Nonce=L_;function TM(t){let e=t.toString(16);return CM(e)}jt.numberToPaddedHex=TM;function cie(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}jt.isPaddedHex=cie;function CM(t){return t=t||"",t.length%2==1?"0"+t:t}jt.zeroPadStringIfOddLength=CM});var NM=v(Dy=>{"use strict";l();Object.defineProperty(Dy,"__esModule",{value:!0});Dy.TransactionReceipt=void 0;var xM=Pu(),F_=class t{constructor(){this.value="",this.sender=new xM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new xM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Dy.TransactionReceipt=F_});var OM=v(Gn=>{"use strict";l();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ErrContractQuery=Gn.ErrNetworkProvider=Gn.ErrUnexpectedCondition=Gn.Err=void 0;var Ru=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Gn.Err=Ru;var M_=class extends Ru{constructor(e){super(`Unexpected condition: [${e}]`)}};Gn.ErrUnexpectedCondition=M_;var U_=class extends Ru{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Gn.ErrNetworkProvider=U_;var q_=class extends Ru{constructor(e){super(e.message.replace("executeQuery:",""))}};Gn.ErrContractQuery=q_});var PM=v(ms=>{"use strict";l();Object.defineProperty(ms,"__esModule",{value:!0});ms.TransactionEventTopic=ms.TransactionEventData=ms.TransactionEvent=void 0;var DM=Pu(),V_=class t{constructor(e){this.address=new DM.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new Bu(h.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new DM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Py(n)),r.dataPayload=Bu.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(Bu.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};ms.TransactionEvent=V_;var Bu=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(h.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ms.TransactionEventData=Bu;var Py=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}};ms.TransactionEventTopic=Py});var k_=v(Ry=>{"use strict";l();Object.defineProperty(Ry,"__esModule",{value:!0});Ry.TransactionLogs=void 0;var lie=OM(),RM=Pu(),fie=PM(),H_=class t{constructor(e){this.address=new RM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new RM.Address(e.address),r.events=(e.events||[]).map(n=>fie.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new lie.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}};Ry.TransactionLogs=H_});var LM=v(Lu=>{"use strict";l();Object.defineProperty(Lu,"__esModule",{value:!0});Lu.ContractResultItem=Lu.ContractResults=void 0;var BM=k_(),By=Pu(),G_=class t{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=>cf.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>cf.fromApiHttpResponse(n));return new t(r)}};Lu.ContractResults=G_;var cf=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new By.Address(""),this.sender=new By.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new BM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new By.Address(e.receiver),r.sender=new By.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=BM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Lu.ContractResultItem=cf});var FM=v(ws=>{"use strict";l();var die=ws&&ws.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ws,"__esModule",{value:!0});ws.EsdtContractAddress=ws.MaxUint64AsBigNumber=void 0;var hie=die(Yt()),pie=Pu();ws.MaxUint64AsBigNumber=new hie.default("18446744073709551615");ws.EsdtContractAddress=new pie.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var MM=v(Fu=>{"use strict";l();var gie=Fu&&Fu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ContractQueryResponse=void 0;var yie=gie(Yt()),mie=FM(),j_=class t{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 yie.default(e.gasRemaining||e.GasRemaining||0),o=mie.MaxUint64AsBigNumber.minus(s).toNumber();return new t({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()}}};Fu.ContractQueryResponse=j_});var UM=v(Ly=>{"use strict";l();Object.defineProperty(Ly,"__esModule",{value:!0});Ly.ContractQueryRequest=void 0;var Q_=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}};Ly.ContractQueryRequest=Q_});var $M=v((cEe,WM)=>{l();WM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Es=v(bo=>{l();var z_,wie=[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];bo.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};bo.getSymbolTotalCodewords=function(e){return wie[e]};bo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};bo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');z_=e};bo.isKanjiModeEnabled=function(){return typeof z_<"u"};bo.toSJIS=function(e){return z_(e)}});var Uy=v(zr=>{l();zr.L={bit:1};zr.M={bit:0};zr.Q={bit:3};zr.H={bit:2};function Eie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return zr.L;case"m":case"medium":return zr.M;case"q":case"quartile":return zr.Q;case"h":case"high":return zr.H;default:throw new Error("Unknown EC Level: "+t)}}zr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};zr.from=function(e,r){if(zr.isValid(e))return e;try{return Eie(e)}catch{return r}}});var JM=v((gEe,YM)=>{l();function KM(){this.buffer=[],this.length=0}KM.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++}};YM.exports=KM});var ZM=v((mEe,XM)=>{l();function lf(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)}lf.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};lf.prototype.get=function(t,e){return this.data[t*this.size+e]};lf.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};lf.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};XM.exports=lf});var eU=v(qy=>{l();var vie=Es().getSymbolSize;qy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=vie(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{l();var Aie=Es().getSymbolSize,tU=7;rU.getPositions=function(e){let r=Aie(e);return[[0,0],[r-tU,0],[0,r-tU]]}});var iU=v(nt=>{l();nt.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Io={N1:3,N2:3,N3:40,N4:10};nt.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};nt.from=function(e){return nt.isValid(e)?parseInt(e,10):void 0};nt.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Io.N1+(i-5)),o=f,i=1),f=e.get(c,u),f===a?s++:(s>=5&&(n+=Io.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Io.N1+(i-5)),s>=5&&(n+=Io.N1+(s-5))}return n};nt.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*Io.N3};nt.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{l();var vs=Uy(),Vy=[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],Hy=[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];W_.getBlocksCount=function(e,r){switch(r){case vs.L:return Vy[(e-1)*4+0];case vs.M:return Vy[(e-1)*4+1];case vs.Q:return Vy[(e-1)*4+2];case vs.H:return Vy[(e-1)*4+3];default:return}};W_.getTotalCodewordsCount=function(e,r){switch(r){case vs.L:return Hy[(e-1)*4+0];case vs.M:return Hy[(e-1)*4+1];case vs.Q:return Hy[(e-1)*4+2];case vs.H:return Hy[(e-1)*4+3];default:return}}});var sU=v(Gy=>{l();var ff=new Uint8Array(512),ky=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ff[r]=e,ky[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ff[r]=ff[r-255]})();Gy.log=function(e){if(e<1)throw new Error("log("+e+")");return ky[e]};Gy.exp=function(e){return ff[e]};Gy.mul=function(e,r){return e===0||r===0?0:ff[ky[e]+ky[r]]}});var oU=v(df=>{l();var K_=sU();df.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{l();var aU=oU();function Y_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}Y_.prototype.initialize=function(e){this.degree=e,this.genPoly=aU.generateECPolynomial(this.degree)};Y_.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=aU.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};uU.exports=Y_});var J_=v(lU=>{l();lU.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var X_=v(wi=>{l();var fU="[0-9]+",Iie="[A-Z $%*+\\-./:]+",hf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";hf=hf.replace(/u/g,"\\u");var _ie="(?:(?![A-Z0-9 $%*+\\-./:]|"+hf+`)(?:.|[\r -]))+`;wi.KANJI=new RegExp(hf,"g");wi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");wi.BYTE=new RegExp(_ie,"g");wi.NUMERIC=new RegExp(fU,"g");wi.ALPHANUMERIC=new RegExp(Iie,"g");var Sie=new RegExp("^"+hf+"$"),Tie=new RegExp("^"+fU+"$"),Cie=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");wi.testKanji=function(e){return Sie.test(e)};wi.testNumeric=function(e){return Tie.test(e)};wi.testAlphanumeric=function(e){return Cie.test(e)}});var As=v(Bt=>{l();var xie=J_(),Z_=X_();Bt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Bt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Bt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Bt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Bt.MIXED={bit:-1};Bt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!xie.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Bt.getBestModeForData=function(e){return Z_.testNumeric(e)?Bt.NUMERIC:Z_.testAlphanumeric(e)?Bt.ALPHANUMERIC:Z_.testKanji(e)?Bt.KANJI:Bt.BYTE};Bt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Bt.isValid=function(e){return e&&e.bit&&e.ccBits};function Nie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Bt.NUMERIC;case"alphanumeric":return Bt.ALPHANUMERIC;case"kanji":return Bt.KANJI;case"byte":return Bt.BYTE;default:throw new Error("Unknown mode: "+t)}}Bt.from=function(e,r){if(Bt.isValid(e))return e;try{return Nie(e)}catch{return r}}});var yU=v(_o=>{l();var jy=Es(),Oie=$_(),dU=Uy(),bs=As(),eS=J_(),pU=7973,hU=jy.getBCHDigit(pU);function Die(t,e,r){for(let n=1;n<=40;n++)if(e<=_o.getCapacity(n,r,t))return n}function gU(t,e){return bs.getCharCountIndicator(t,e)+4}function Pie(t,e){let r=0;return t.forEach(function(n){let i=gU(n.mode,e);r+=i+n.getBitsLength()}),r}function Rie(t,e){for(let r=1;r<=40;r++)if(Pie(t,r)<=_o.getCapacity(r,e,bs.MIXED))return r}_o.from=function(e,r){return eS.isValid(e)?parseInt(e,10):r};_o.getCapacity=function(e,r,n){if(!eS.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=bs.BYTE);let i=jy.getSymbolTotalCodewords(e),s=Oie.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===bs.MIXED)return o;let a=o-gU(n,e);switch(n){case bs.NUMERIC:return Math.floor(a/10*3);case bs.ALPHANUMERIC:return Math.floor(a/11*2);case bs.KANJI:return Math.floor(a/13);case bs.BYTE:default:return Math.floor(a/8)}};_o.getBestVersionForData=function(e,r){let n,i=dU.from(r,dU.M);if(Array.isArray(e)){if(e.length>1)return Rie(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Die(n.mode,n.getLength(),i)};_o.getEncodedBits=function(e){if(!eS.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;jy.getBCHDigit(r)-hU>=0;)r^=pU<{l();var tS=Es(),wU=1335,Bie=21522,mU=tS.getBCHDigit(wU);EU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;tS.getBCHDigit(i)-mU>=0;)i^=wU<{l();var Lie=As();function Mu(t){this.mode=Lie.NUMERIC,this.data=t.toString()}Mu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Mu.prototype.getLength=function(){return this.data.length};Mu.prototype.getBitsLength=function(){return Mu.getBitsLength(this.data.length)};Mu.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))};AU.exports=Mu});var _U=v((QEe,IU)=>{l();var Fie=As(),rS=["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 Uu(t){this.mode=Fie.ALPHANUMERIC,this.data=t}Uu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Uu.prototype.getLength=function(){return this.data.length};Uu.prototype.getBitsLength=function(){return Uu.getBitsLength(this.data.length)};Uu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=rS.indexOf(this.data[r])*45;n+=rS.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(rS.indexOf(this.data[r]),6)};IU.exports=Uu});var TU=v((WEe,SU)=>{"use strict";l();SU.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 xU=v((KEe,CU)=>{l();var Mie=TU(),Uie=As();function qu(t){this.mode=Uie.BYTE,typeof t=="string"&&(t=Mie(t)),this.data=new Uint8Array(t)}qu.getBitsLength=function(e){return e*8};qu.prototype.getLength=function(){return this.data.length};qu.prototype.getBitsLength=function(){return qu.getBitsLength(this.data.length)};qu.prototype.write=function(t){for(let e=0,r=this.data.length;e{l();var qie=As(),Vie=Es();function Vu(t){this.mode=qie.KANJI,this.data=t}Vu.getBitsLength=function(e){return e*13};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.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)}};NU.exports=Vu});var DU=v((ZEe,nS)=>{"use strict";l();var pf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=pf.PriorityQueue.make();s.push(e,0);for(var o,a,u,c,f,d,g,m,y;!s.empty();){o=s.pop(),a=o.value,c=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=c+d,m=i[u],y=typeof i[u]>"u",(y||m>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var A=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(A)}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=pf.single_source_shortest_paths(t,e,r);return pf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=pf.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 nS<"u"&&(nS.exports=pf)});var qU=v(Hu=>{l();var je=As(),BU=bU(),LU=_U(),FU=xU(),MU=OU(),gf=X_(),Qy=Es(),Hie=DU();function PU(t){return unescape(encodeURIComponent(t)).length}function yf(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 UU(t){let e=yf(gf.NUMERIC,je.NUMERIC,t),r=yf(gf.ALPHANUMERIC,je.ALPHANUMERIC,t),n,i;return Qy.isKanjiModeEnabled()?(n=yf(gf.BYTE,je.BYTE,t),i=yf(gf.KANJI,je.KANJI,t)):(n=yf(gf.BYTE_KANJI,je.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 iS(t,e){switch(e){case je.NUMERIC:return BU.getBitsLength(t);case je.ALPHANUMERIC:return LU.getBitsLength(t);case je.KANJI:return MU.getBitsLength(t);case je.BYTE:return FU.getBitsLength(t)}}function kie(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 Gie(t){let e=[];for(let r=0;r{l();var Wy=Es(),sS=Uy(),Qie=JM(),zie=ZM(),Wie=eU(),$ie=nU(),uS=iU(),cS=$_(),Kie=cU(),zy=yU(),Yie=vU(),Jie=As(),oS=qU();function Xie(t,e){let r=t.size,n=$ie.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 Zie(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 aS(t,e,r){let n=t.size,i=Yie.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 rse(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 c=!1;o>>s&1)===1),t.set(i,a-u,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function nse(t,e,r){let n=new Qie;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Jie.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Wy.getSymbolTotalCodewords(t),s=cS.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";l();var n_=ls(),Iu=iF(),cre=SF(),lre=n_("%TypeError%"),gy=n_("%WeakMap%",!0),yy=n_("%Map%",!0),fre=Iu("WeakMap.prototype.get",!0),dre=Iu("WeakMap.prototype.set",!0),hre=Iu("WeakMap.prototype.has",!0),pre=Iu("Map.prototype.get",!0),gre=Iu("Map.prototype.set",!0),yre=Iu("Map.prototype.has",!0),i_=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},mre=function(t,e){var r=i_(t,e);return r&&r.value},wre=function(t,e,r){var n=i_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Ere=function(t,e){return!!i_(t,e)};TF.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new lre("Side channel does not contain "+cre(s))},get:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return fre(e,s)}else if(yy){if(r)return pre(r,s)}else if(n)return mre(n,s)},has:function(s){if(gy&&s&&(typeof s=="object"||typeof s=="function")){if(e)return hre(e,s)}else if(yy){if(r)return yre(r,s)}else if(n)return Ere(n,s);return!1},set:function(s,o){gy&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new gy),dre(e,s,o)):yy?(r||(r=new yy),gre(r,s,o)):(n||(n={key:{},next:null}),wre(n,s,o))}};return i}});var my=A((Qme,xF)=>{"use strict";l();var vre=String.prototype.replace,Are=/%20/g,s_={RFC1738:"RFC1738",RFC3986:"RFC3986"};xF.exports={default:s_.RFC3986,formatters:{RFC1738:function(t){return vre.call(t,Are,"+")},RFC3986:function(t){return String(t)}},RFC1738:s_.RFC1738,RFC3986:s_.RFC3986}});var a_=A((Wme,OF)=>{"use strict";l();var bre=my(),o_=Object.prototype.hasOwnProperty,Eo=Array.isArray,Vn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Ire=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Eo(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===bre.RFC1738&&(c===40||c===41)){a+=o.charAt(u);continue}if(c<128){a=a+Vn[c];continue}if(c<2048){a=a+(Vn[192|c>>6]+Vn[128|c&63]);continue}if(c<55296||c>=57344){a=a+(Vn[224|c>>12]+Vn[128|c>>6&63]+Vn[128|c&63]);continue}u+=1,c=65536+((c&1023)<<10|o.charCodeAt(u)&1023),a+=Vn[240|c>>18]+Vn[128|c>>12&63]+Vn[128|c>>6&63]+Vn[128|c&63]}return a},xre=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";l();var RF=CF(),c_=a_(),nf=my(),Rre=Object.prototype.hasOwnProperty,DF={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},vo=Array.isArray,Bre=String.prototype.split,Lre=Array.prototype.push,BF=function(t,e){Lre.apply(t,vo(e)?e:[e])},Fre=Date.prototype.toISOString,PF=nf.default,$t={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:c_.encode,encodeValuesOnly:!1,format:PF,formatter:nf.formatters[PF],indices:!1,serializeDate:function(e){return Fre.call(e)},skipNulls:!1,strictNullHandling:!1},Mre=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},u_={},Ure=function t(e,r,n,i,s,o,a,u,c,f,d,g,m,y,b){for(var O=e,R=b,z=0,M=!1;(R=R.get(u_))!==void 0&&!M;){var E=R.get(e);if(z+=1,typeof E<"u"){if(E===z)throw new RangeError("Cyclic object value");M=!0}typeof R.get(u_)>"u"&&(z=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&vo(O)&&(O=c_.maybeMap(O,function(ie){return ie instanceof Date?f(ie):ie})),O===null){if(i)return o&&!m?o(r,$t.encoder,y,"key",d):r;O=""}if(Mre(O)||c_.isBuffer(O)){if(o){var S=m?r:o(r,$t.encoder,y,"key",d);if(n==="comma"&&m){for(var N=Bre.call(String(O),","),_="",T=0;T"u")return B;var X;if(n==="comma"&&vo(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(vo(a))X=a;else{var Q=Object.keys(O);X=u?Q.sort(u):Q}for(var H=0;H"u"?$t.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:$t.charsetSentinel,delimiter:typeof e.delimiter>"u"?$t.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:$t.encode,encoder:typeof e.encoder=="function"?e.encoder:$t.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:$t.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:$t.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:$t.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:$t.strictNullHandling}};LF.exports=function(t,e){var r=t,n=qre(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):vo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in DF?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=DF[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=RF(),f=0;f0?m+g:""}});var qF=A((Jme,UF)=>{"use strict";l();var _u=a_(),l_=Object.prototype.hasOwnProperty,Vre=Array.isArray,jt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:_u.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Hre=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},MF=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},kre="utf8=%26%2310003%3B",Gre="utf8=%E2%9C%93",jre=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,c=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(y=Vre(y)?[y]:y),l_.call(n,m)?n[m]=_u.combine(n[m],y):n[m]=y}return n},Qre=function(t,e,r,n){for(var i=n?e:MF(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,c=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(c)&&a!==u&&String(c)===u&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},zre=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),c=u?s.slice(0,u.index):s,f=[];if(c){if(!n.plainObjects&&l_.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?jt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?jt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:jt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:jt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:jt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:jt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:jt.comma,decoder:typeof e.decoder=="function"?e.decoder:jt.decoder,delimiter:typeof e.delimiter=="string"||_u.isRegExp(e.delimiter)?e.delimiter:jt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:jt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:jt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:jt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:jt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:jt.strictNullHandling}};UF.exports=function(t,e){var r=Wre(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?jre(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";l();var $re=FF(),Kre=qF(),Yre=my();VF.exports={formats:Yre,parse:Kre,stringify:$re}});var f_=A(Ge=>{"use strict";l();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Ge.WALLET_PROVIDER_CALLBACK_PARAM=Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL=Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL=Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL=Ge.WALLET_PROVIDER_DISCONNECT_URL=Ge.WALLET_PROVIDER_CONNECT_URL=Ge.XALIAS_PROVIDER_TESTNET=Ge.XALIAS_PROVIDER_DEVNET=Ge.XALIAS_PROVIDER_MAINNET=Ge.WALLET_PROVIDER_TESTNET=Ge.WALLET_PROVIDER_DEVNET=Ge.WALLET_PROVIDER_MAINNET=void 0;Ge.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";Ge.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";Ge.XALIAS_PROVIDER_MAINNET="https://xalias.com";Ge.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";Ge.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";Ge.WALLET_PROVIDER_CONNECT_URL="hook/login";Ge.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Ge.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Ge.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Ge.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";Ge.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";Ge.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Ge.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var kF=A(Su=>{"use strict";l();Object.defineProperty(Su,"__esModule",{value:!0});Su.ErrCannotSignedMessage=Su.ErrCannotGetSignedTransactions=void 0;var d_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};Su.ErrCannotGetSignedTransactions=d_;var h_=class extends Error{constructor(){super("Cannot get signed message")}};Su.ErrCannotSignedMessage=h_});var GF=A(wy=>{"use strict";l();Object.defineProperty(wy,"__esModule",{value:!0});wy.PlainSignedTransaction=void 0;var p_=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.signature="",Object.assign(this,e)}};wy.PlainSignedTransaction=p_});var Tu=A(ys=>{"use strict";l();var ps=ys&&ys.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},Jre=ys&&ys.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ys,"__esModule",{value:!0});ys.WalletProvider=void 0;var g_=Jre(HF()),gs=f_(),y_=kF(),Xre=GF(),m_=class t{constructor(e){this.walletUrl=e}login(e){return ps(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:gs.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return ps(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 ps(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return ps(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:gs.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return ps(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:gs.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=g_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new y_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return ps(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(gs.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return ps(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(gs.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return ps(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=g_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(gs.WALLET_PROVIDER_CALLBACK_PARAM)&&e[gs.WALLET_PROVIDER_CALLBACK_PARAM]===gs.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new y_.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new y_.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let a=t.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}};ys.WalletProvider=m_});var IM=A((cwe,bM)=>{"use strict";l();function tM(t,e){return function(){return t.apply(e,arguments)}}var{toString:Zre}=Object.prototype,{getPrototypeOf:N_}=Object,by=(t=>e=>{let r=Zre.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),kn=t=>(t=t.toLowerCase(),e=>by(e)===t),Iy=t=>e=>typeof e===t,{isArray:Ou}=Array,of=Iy("undefined");function ene(t){return t!==null&&!of(t)&&t.constructor!==null&&!of(t.constructor)&&Qr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var rM=kn("ArrayBuffer");function tne(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&rM(t.buffer),e}var rne=Iy("string"),Qr=Iy("function"),nM=Iy("number"),_y=t=>t!==null&&typeof t=="object",nne=t=>t===!0||t===!1,Ey=t=>{if(by(t)!=="object")return!1;let e=N_(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ine=kn("Date"),sne=kn("File"),one=kn("Blob"),ane=kn("FileList"),une=t=>_y(t)&&Qr(t.pipe),cne=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Qr(t.append)&&((e=by(t))==="formdata"||e==="object"&&Qr(t.toString)&&t.toString()==="[object FormData]"))},lne=kn("URLSearchParams"),fne=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function af(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var sM=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,oM=t=>!of(t)&&t!==sM;function b_(){let{caseless:t}=oM(this)&&this||{},e={},r=(n,i)=>{let s=t&&iM(e,i)||i;Ey(e[s])&&Ey(n)?e[s]=b_(e[s],n):Ey(n)?e[s]=b_({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(af(e,(i,s)=>{r&&Qr(i)?t[s]=tM(i,r):t[s]=i},{allOwnKeys:n}),t),hne=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),pne=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},gne=(t,e,r,n)=>{let i,s,o,a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&N_(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},yne=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},mne=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!nM(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},wne=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&N_(Uint8Array)),Ene=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},vne=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Ane=kn("HTMLFormElement"),bne=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),jF=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ine=kn("RegExp"),aM=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};af(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},_ne=t=>{aM(t,(e,r)=>{if(Qr(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(Qr(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Sne=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},Tne=()=>{},Cne=(t,e)=>(t=+t,Number.isFinite(t)?t:e),w_="abcdefghijklmnopqrstuvwxyz",QF="0123456789",uM={DIGIT:QF,ALPHA:w_,ALPHA_DIGIT:w_+w_.toUpperCase()+QF},xne=(t=16,e=uM.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function Nne(t){return!!(t&&Qr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var One=t=>{let e=new Array(10),r=(n,i)=>{if(_y(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=Ou(n)?[]:{};return af(n,(o,a)=>{let u=r(o,i+1);!of(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},Dne=kn("AsyncFunction"),Pne=t=>t&&(_y(t)||Qr(t))&&Qr(t.then)&&Qr(t.catch),Y={isArray:Ou,isArrayBuffer:rM,isBuffer:ene,isFormData:cne,isArrayBufferView:tne,isString:rne,isNumber:nM,isBoolean:nne,isObject:_y,isPlainObject:Ey,isUndefined:of,isDate:ine,isFile:sne,isBlob:one,isRegExp:Ine,isFunction:Qr,isStream:une,isURLSearchParams:lne,isTypedArray:wne,isFileList:ane,forEach:af,merge:b_,extend:dne,trim:fne,stripBOM:hne,inherits:pne,toFlatObject:gne,kindOf:by,kindOfTest:kn,endsWith:yne,toArray:mne,forEachEntry:Ene,matchAll:vne,isHTMLForm:Ane,hasOwnProperty:jF,hasOwnProp:jF,reduceDescriptors:aM,freezeMethods:_ne,toObjectSet:Sne,toCamelCase:bne,noop:Tne,toFiniteNumber:Cne,findKey:iM,global:sM,isContextDefined:oM,ALPHABET:uM,generateString:xne,isSpecCompliantForm:Nne,toJSONObject:One,isAsyncFn:Dne,isThenable:Pne};function Me(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Y.inherits(Me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Y.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var cM=Me.prototype,lM={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{lM[t]={value:t}});Object.defineProperties(Me,lM);Object.defineProperty(cM,"isAxiosError",{value:!0});Me.from=(t,e,r,n,i,s)=>{let o=Object.create(cM);return Y.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),Me.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var Rne=null;function I_(t){return Y.isPlainObject(t)||Y.isArray(t)}function fM(t){return Y.endsWith(t,"[]")?t.slice(0,-2):t}function zF(t,e,r){return t?t.concat(e).map(function(i,s){return i=fM(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function Bne(t){return Y.isArray(t)&&!t.some(I_)}var Lne=Y.toFlatObject(Y,{},null,function(e){return/^is[A-Z]/.test(e)});function Sy(t,e,r){if(!Y.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Y.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,O){return!Y.isUndefined(O[b])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Y.isSpecCompliantForm(e);if(!Y.isFunction(i))throw new TypeError("visitor must be a function");function c(y){if(y===null)return"";if(Y.isDate(y))return y.toISOString();if(!u&&Y.isBlob(y))throw new Me("Blob is not supported. Use a Buffer instead.");return Y.isArrayBuffer(y)||Y.isTypedArray(y)?u&&typeof Blob=="function"?new Blob([y]):h.Buffer.from(y):y}function f(y,b,O){let R=y;if(y&&!O&&typeof y=="object"){if(Y.endsWith(b,"{}"))b=n?b:b.slice(0,-2),y=JSON.stringify(y);else if(Y.isArray(y)&&Bne(y)||(Y.isFileList(y)||Y.endsWith(b,"[]"))&&(R=Y.toArray(y)))return b=fM(b),R.forEach(function(M,E){!(Y.isUndefined(M)||M===null)&&e.append(o===!0?zF([b],E,s):o===null?b:b+"[]",c(M))}),!1}return I_(y)?!0:(e.append(zF(O,b,s),c(y)),!1)}let d=[],g=Object.assign(Lne,{defaultVisitor:f,convertValue:c,isVisitable:I_});function m(y,b){if(!Y.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+b.join("."));d.push(y),Y.forEach(y,function(R,z){(!(Y.isUndefined(R)||R===null)&&i.call(e,R,Y.isString(z)?z.trim():z,b,g))===!0&&m(R,b?b.concat(z):[z])}),d.pop()}}if(!Y.isObject(t))throw new TypeError("data must be an object");return m(t),e}function WF(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function O_(t,e){this._pairs=[],t&&Sy(t,this,e)}var dM=O_.prototype;dM.append=function(e,r){this._pairs.push([e,r])};dM.toString=function(e){let r=e?function(n){return e.call(this,n,WF)}:WF;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Fne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function hM(t,e,r){if(!e)return t;let n=r&&r.encode||Fne,i=r&&r.serialize,s;if(i?s=i(e,r):s=Y.isURLSearchParams(e)?e.toString():new O_(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var __=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Y.forEach(this.handlers,function(n){n!==null&&e(n)})}},$F=__,pM={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mne=typeof URLSearchParams<"u"?URLSearchParams:O_,Une=typeof FormData<"u"?FormData:null,qne=typeof Blob<"u"?Blob:null,Vne={isBrowser:!0,classes:{URLSearchParams:Mne,FormData:Une,Blob:qne},protocols:["http","https","file","blob","url","data"]},gM=typeof window<"u"&&typeof document<"u",Hne=(t=>gM&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),kne=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gne=Object.freeze({__proto__:null,hasBrowserEnv:gM,hasStandardBrowserWebWorkerEnv:kne,hasStandardBrowserEnv:Hne}),Hn={...Gne,...Vne};function jne(t,e){return Sy(t,new Hn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Hn.isNode&&Y.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Qne(t){return Y.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function zne(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&Y.isArray(i)?i.length:o,u?(Y.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Y.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Y.isArray(i[o])&&(i[o]=zne(i[o])),!a)}if(Y.isFormData(t)&&Y.isFunction(t.entries)){let r={};return Y.forEachEntry(t,(n,i)=>{e(Qne(n),i,r,0)}),r}return null}function Wne(t,e,r){if(Y.isString(t))try{return(e||JSON.parse)(t),Y.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var D_={transitional:pM,adapter:["xhr","http"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Y.isObject(e);if(s&&Y.isHTMLForm(e)&&(e=new FormData(e)),Y.isFormData(e))return i&&i?JSON.stringify(yM(e)):e;if(Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e))return e;if(Y.isArrayBufferView(e))return e.buffer;if(Y.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return jne(e,this.formSerializer).toString();if((a=Y.isFileList(e))||n.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return Sy(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Wne(e)):e}],transformResponse:[function(e){let r=this.transitional||D_.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&Y.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Me.from(a,Me.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hn.classes.FormData,Blob:Hn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(["delete","get","head","post","put","patch"],t=>{D_.headers[t]={}});var P_=D_,$ne=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Kne=t=>{let e={},r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&$ne[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},KF=Symbol("internals");function sf(t){return t&&String(t).trim().toLowerCase()}function vy(t){return t===!1||t==null?t:Y.isArray(t)?t.map(vy):String(t)}function Yne(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var Jne=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function E_(t,e,r,n,i){if(Y.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Y.isString(e)){if(Y.isString(n))return e.indexOf(n)!==-1;if(Y.isRegExp(n))return n.test(e)}}function Xne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Zne(t,e){let r=Y.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Cu=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(a,u,c){let f=sf(u);if(!f)throw new Error("header name must be a non-empty string");let d=Y.findKey(i,f);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||u]=vy(a))}let o=(a,u)=>Y.forEach(a,(c,f)=>s(c,f,u));return Y.isPlainObject(e)||e instanceof this.constructor?o(e,r):Y.isString(e)&&(e=e.trim())&&!Jne(e)?o(Kne(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return Yne(i);if(Y.isFunction(r))return r.call(this,i,n);if(Y.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=sf(e),e){let n=Y.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||E_(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=sf(o),o){let a=Y.findKey(n,o);a&&(!r||E_(n,n[a],a,r))&&(delete n[a],i=!0)}}return Y.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||E_(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return Y.forEach(this,(i,s)=>{let o=Y.findKey(n,s);if(o){r[o]=vy(i),delete r[s];return}let a=e?Xne(s):String(s).trim();a!==s&&delete r[s],r[a]=vy(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return Y.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Y.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[KF]=this[KF]={accessors:{}}).accessors,i=this.prototype;function s(o){let a=sf(o);n[a]||(Zne(i,o),n[a]=!0)}return Y.isArray(e)?e.forEach(s):s(e),this}};Cu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Y.reduceDescriptors(Cu.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});Y.freezeMethods(Cu);var yi=Cu;function v_(t,e){let r=this||P_,n=e||r,i=yi.from(n.headers),s=n.data;return Y.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function mM(t){return!!(t&&t.__CANCEL__)}function uf(t,e,r){Me.call(this,t??"canceled",Me.ERR_CANCELED,e,r),this.name="CanceledError"}Y.inherits(uf,Me,{__CANCEL__:!0});function eie(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Me("Request failed with status code "+r.status,[Me.ERR_BAD_REQUEST,Me.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var tie=Hn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];Y.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&o.push("path="+n),Y.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function rie(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function nie(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function wM(t,e){return t&&!rie(e)?nie(t,e):e}var iie=Hn.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let a=Y.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function sie(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function oie(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){let c=Date.now(),f=n[s];o||(o=c),r[i]=u,n[i]=c;let d=s,g=0;for(;d!==i;)g+=r[d++],d=d%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o{let s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,u=n(a),c=s<=o;r=s;let f={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&c?(o-s)/u:void 0,event:i};f[e?"download":"upload"]=!0,t(f)}}var aie=typeof XMLHttpRequest<"u",uie=aie&&function(t){return new Promise(function(r,n){let i=t.data,s=yi.from(t.headers).normalize(),{responseType:o,withXSRFToken:a}=t,u;function c(){t.cancelToken&&t.cancelToken.unsubscribe(u),t.signal&&t.signal.removeEventListener("abort",u)}let f;if(Y.isFormData(i)){if(Hn.hasStandardBrowserEnv||Hn.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((f=s.getContentType())!==!1){let[b,...O]=f?f.split(";").map(R=>R.trim()).filter(Boolean):[];s.setContentType([b||"multipart/form-data",...O].join("; "))}}let d=new XMLHttpRequest;if(t.auth){let b=t.auth.username||"",O=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(b+":"+O))}let g=wM(t.baseURL,t.url);d.open(t.method.toUpperCase(),hM(g,t.params,t.paramsSerializer),!0),d.timeout=t.timeout;function m(){if(!d)return;let b=yi.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),R={data:!o||o==="text"||o==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:b,config:t,request:d};eie(function(M){r(M),c()},function(M){n(M),c()},R),d=null}if("onloadend"in d?d.onloadend=m:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(m)},d.onabort=function(){d&&(n(new Me("Request aborted",Me.ECONNABORTED,t,d)),d=null)},d.onerror=function(){n(new Me("Network Error",Me.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let O=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",R=t.transitional||pM;t.timeoutErrorMessage&&(O=t.timeoutErrorMessage),n(new Me(O,R.clarifyTimeoutError?Me.ETIMEDOUT:Me.ECONNABORTED,t,d)),d=null},Hn.hasStandardBrowserEnv&&(a&&Y.isFunction(a)&&(a=a(t)),a||a!==!1&&iie(g))){let b=t.xsrfHeaderName&&t.xsrfCookieName&&tie.read(t.xsrfCookieName);b&&s.set(t.xsrfHeaderName,b)}i===void 0&&s.setContentType(null),"setRequestHeader"in d&&Y.forEach(s.toJSON(),function(O,R){d.setRequestHeader(R,O)}),Y.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),o&&o!=="json"&&(d.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&d.addEventListener("progress",YF(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",YF(t.onUploadProgress)),(t.cancelToken||t.signal)&&(u=b=>{d&&(n(!b||b.type?new uf(null,t,d):b),d.abort(),d=null)},t.cancelToken&&t.cancelToken.subscribe(u),t.signal&&(t.signal.aborted?u():t.signal.addEventListener("abort",u)));let y=sie(g);if(y&&Hn.protocols.indexOf(y)===-1){n(new Me("Unsupported protocol "+y+":",Me.ERR_BAD_REQUEST,t));return}d.send(i||null)})},S_={http:Rne,xhr:uie};Y.forEach(S_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var JF=t=>`- ${t}`,cie=t=>Y.isFunction(t)||t===null||t===!1,EM={getAdapter:t=>{t=Y.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : +`+s.map(JF).join(` +`):" "+JF(s[0]):"as no adapter specified";throw new Me("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:S_};function A_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new uf(null,t)}function XF(t){return A_(t),t.headers=yi.from(t.headers),t.data=v_.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),EM.getAdapter(t.adapter||P_.adapter)(t).then(function(n){return A_(t),n.data=v_.call(t,t.transformResponse,n),n.headers=yi.from(n.headers),n},function(n){return mM(n)||(A_(t),n&&n.response&&(n.response.data=v_.call(t,t.transformResponse,n.response),n.response.headers=yi.from(n.response.headers))),Promise.reject(n)})}var ZF=t=>t instanceof yi?t.toJSON():t;function xu(t,e){e=e||{};let r={};function n(c,f,d){return Y.isPlainObject(c)&&Y.isPlainObject(f)?Y.merge.call({caseless:d},c,f):Y.isPlainObject(f)?Y.merge({},f):Y.isArray(f)?f.slice():f}function i(c,f,d){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c,d)}else return n(c,f,d)}function s(c,f){if(!Y.isUndefined(f))return n(void 0,f)}function o(c,f){if(Y.isUndefined(f)){if(!Y.isUndefined(c))return n(void 0,c)}else return n(void 0,f)}function a(c,f,d){if(d in e)return n(c,f);if(d in t)return n(void 0,c)}let u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,f)=>i(ZF(c),ZF(f),!0)};return Y.forEach(Object.keys(Object.assign({},t,e)),function(f){let d=u[f]||i,g=d(t[f],e[f],f);Y.isUndefined(g)&&d!==a||(r[f]=g)}),r}var vM="1.6.5",R_={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{R_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var eM={};R_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+vM+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new Me(i(o," has been removed"+(r?" in "+r:"")),Me.ERR_DEPRECATED);return r&&!eM[o]&&(eM[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function lie(t,e,r){if(typeof t!="object")throw new Me("options must be an object",Me.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new Me("option "+s+" must be "+u,Me.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Me("Unknown option "+s,Me.ERR_BAD_OPTION)}}var T_={assertOptions:lie,validators:R_},ms=T_.validators,Nu=class{constructor(e){this.defaults=e,this.interceptors={request:new $F,response:new $F}}request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=xu(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&T_.assertOptions(n,{silentJSONParsing:ms.transitional(ms.boolean),forcedJSONParsing:ms.transitional(ms.boolean),clarifyTimeoutError:ms.transitional(ms.boolean)},!1),i!=null&&(Y.isFunction(i)?r.paramsSerializer={serialize:i}:T_.assertOptions(i,{encode:ms.function,serialize:ms.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Y.merge(s.common,s[r.method]);s&&Y.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),r.headers=yi.concat(o,s);let a=[],u=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(u=u&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});let c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let f,d=0,g;if(!u){let y=[XF.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,c),g=y.length,f=Promise.resolve(r);d{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new uf(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},fie=C_;function die(t){return function(r){return t.apply(null,r)}}function hie(t){return Y.isObject(t)&&t.isAxiosError===!0}var x_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(x_).forEach(([t,e])=>{x_[e]=t});var pie=x_;function AM(t){let e=new Ay(t),r=tM(Ay.prototype.request,e);return Y.extend(r,Ay.prototype,e,{allOwnKeys:!0}),Y.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return AM(xu(t,i))},r}var Rt=AM(P_);Rt.Axios=Ay;Rt.CanceledError=uf;Rt.CancelToken=fie;Rt.isCancel=mM;Rt.VERSION=vM;Rt.toFormData=Sy;Rt.AxiosError=Me;Rt.Cancel=Rt.CanceledError;Rt.all=function(e){return Promise.all(e)};Rt.spread=die;Rt.isAxiosError=hie;Rt.mergeConfig=xu;Rt.AxiosHeaders=yi;Rt.formToJSON=t=>yM(Y.isHTMLForm(t)?new FormData(t):t);Rt.getAdapter=EM.getAdapter;Rt.HttpStatusCode=pie;Rt.default=Rt;bM.exports=Rt});var _M=A(Ty=>{"use strict";l();Object.defineProperty(Ty,"__esModule",{value:!0});Ty.NativeAuthClientConfig=void 0;var B_=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Ty.NativeAuthClientConfig=B_});var F_=A(Du=>{"use strict";l();var Ao=Du&&Du.__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{c(n.next(f))}catch(d){o(d)}}function u(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Du,"__esModule",{value:!0});Du.NativeAuthClient=void 0;var gie=IM(),yie=_M(),L_=class{constructor(e){this.config=Object.assign(new yie.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Ao(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return Ao(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Ao(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return Ao(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return Ao(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return Ao(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(h.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return Ao(this,void 0,void 0,function*(){return yield gie.default.get(e,{headers:this.config.extraRequestHeaders})})}};Du.NativeAuthClient=L_});var OM=A(Ny=>{"use strict";l();Object.defineProperty(Ny,"__esModule",{value:!0});Ny.TransactionStatus=void 0;var U_=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("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}};Ny.TransactionStatus=U_});var PM=A(Oy=>{"use strict";l();Object.defineProperty(Oy,"__esModule",{value:!0});Oy.TransactionReceipt=void 0;var DM=Ta(),q_=class t{constructor(){this.value="",this.sender=new DM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new DM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Oy.TransactionReceipt=q_});var RM=A(Gn=>{"use strict";l();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ErrContractQuery=Gn.ErrNetworkProvider=Gn.ErrUnexpectedCondition=Gn.Err=void 0;var Bu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Gn.Err=Bu;var V_=class extends Bu{constructor(e){super(`Unexpected condition: [${e}]`)}};Gn.ErrUnexpectedCondition=V_;var H_=class extends Bu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Gn.ErrNetworkProvider=H_;var k_=class extends Bu{constructor(e){super(e.message.replace("executeQuery:",""))}};Gn.ErrContractQuery=k_});var LM=A(ws=>{"use strict";l();Object.defineProperty(ws,"__esModule",{value:!0});ws.TransactionEventTopic=ws.TransactionEventData=ws.TransactionEvent=void 0;var BM=Ta(),G_=class t{constructor(e){this.address=new BM.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new Lu(h.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new BM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Dy(n)),r.dataPayload=Lu.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(Lu.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};ws.TransactionEvent=G_;var Lu=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(h.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ws.TransactionEventData=Lu;var Dy=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}};ws.TransactionEventTopic=Dy});var Q_=A(Py=>{"use strict";l();Object.defineProperty(Py,"__esModule",{value:!0});Py.TransactionLogs=void 0;var Eie=RM(),FM=Ta(),vie=LM(),j_=class t{constructor(e){this.address=new FM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new FM.Address(e.address),r.events=(e.events||[]).map(n=>vie.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new Eie.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}};Py.TransactionLogs=j_});var UM=A(Fu=>{"use strict";l();Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ContractResultItem=Fu.ContractResults=void 0;var MM=Q_(),Ry=Ta(),z_=class t{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=>cf.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>cf.fromApiHttpResponse(n));return new t(r)}};Fu.ContractResults=z_;var cf=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Ry.Address(""),this.sender=new Ry.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new MM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Ry.Address(e.receiver),r.sender=new Ry.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=MM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Fu.ContractResultItem=cf});var qM=A(By=>{"use strict";l();Object.defineProperty(By,"__esModule",{value:!0});By.ContractQueryRequest=void 0;var W_=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}};By.ContractQueryRequest=W_});var KM=A((pEe,$M)=>{l();$M.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Es=A(bo=>{l();var $_,Aie=[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];bo.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};bo.getSymbolTotalCodewords=function(e){return Aie[e]};bo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};bo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');$_=e};bo.isKanjiModeEnabled=function(){return typeof $_<"u"};bo.toSJIS=function(e){return $_(e)}});var My=A(zr=>{l();zr.L={bit:1};zr.M={bit:0};zr.Q={bit:3};zr.H={bit:2};function bie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return zr.L;case"m":case"medium":return zr.M;case"q":case"quartile":return zr.Q;case"h":case"high":return zr.H;default:throw new Error("Unknown EC Level: "+t)}}zr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};zr.from=function(e,r){if(zr.isValid(e))return e;try{return bie(e)}catch{return r}}});var XM=A((vEe,JM)=>{l();function YM(){this.buffer=[],this.length=0}YM.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++}};JM.exports=YM});var eU=A((bEe,ZM)=>{l();function lf(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)}lf.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};lf.prototype.get=function(t,e){return this.data[t*this.size+e]};lf.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};lf.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};ZM.exports=lf});var tU=A(Uy=>{l();var Iie=Es().getSymbolSize;Uy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=Iie(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{l();var _ie=Es().getSymbolSize,rU=7;nU.getPositions=function(e){let r=_ie(e);return[[0,0],[r-rU,0],[0,r-rU]]}});var sU=A(nt=>{l();nt.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Io={N1:3,N2:3,N3:40,N4:10};nt.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};nt.from=function(e){return nt.isValid(e)?parseInt(e,10):void 0};nt.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Io.N1+(i-5)),o=f,i=1),f=e.get(c,u),f===a?s++:(s>=5&&(n+=Io.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Io.N1+(i-5)),s>=5&&(n+=Io.N1+(s-5))}return n};nt.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*Io.N3};nt.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{l();var vs=My(),qy=[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],Vy=[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];K_.getBlocksCount=function(e,r){switch(r){case vs.L:return qy[(e-1)*4+0];case vs.M:return qy[(e-1)*4+1];case vs.Q:return qy[(e-1)*4+2];case vs.H:return qy[(e-1)*4+3];default:return}};K_.getTotalCodewordsCount=function(e,r){switch(r){case vs.L:return Vy[(e-1)*4+0];case vs.M:return Vy[(e-1)*4+1];case vs.Q:return Vy[(e-1)*4+2];case vs.H:return Vy[(e-1)*4+3];default:return}}});var oU=A(ky=>{l();var ff=new Uint8Array(512),Hy=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ff[r]=e,Hy[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ff[r]=ff[r-255]})();ky.log=function(e){if(e<1)throw new Error("log("+e+")");return Hy[e]};ky.exp=function(e){return ff[e]};ky.mul=function(e,r){return e===0||r===0?0:ff[Hy[e]+Hy[r]]}});var aU=A(df=>{l();var J_=oU();df.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{l();var uU=aU();function X_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}X_.prototype.initialize=function(e){this.degree=e,this.genPoly=uU.generateECPolynomial(this.degree)};X_.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=uU.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};cU.exports=X_});var Z_=A(fU=>{l();fU.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var eS=A(wi=>{l();var dU="[0-9]+",Tie="[A-Z $%*+\\-./:]+",hf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";hf=hf.replace(/u/g,"\\u");var Cie="(?:(?![A-Z0-9 $%*+\\-./:]|"+hf+`)(?:.|[\r +]))+`;wi.KANJI=new RegExp(hf,"g");wi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");wi.BYTE=new RegExp(Cie,"g");wi.NUMERIC=new RegExp(dU,"g");wi.ALPHANUMERIC=new RegExp(Tie,"g");var xie=new RegExp("^"+hf+"$"),Nie=new RegExp("^"+dU+"$"),Oie=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");wi.testKanji=function(e){return xie.test(e)};wi.testNumeric=function(e){return Nie.test(e)};wi.testAlphanumeric=function(e){return Oie.test(e)}});var As=A(Bt=>{l();var Die=Z_(),tS=eS();Bt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Bt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Bt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Bt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Bt.MIXED={bit:-1};Bt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Die.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Bt.getBestModeForData=function(e){return tS.testNumeric(e)?Bt.NUMERIC:tS.testAlphanumeric(e)?Bt.ALPHANUMERIC:tS.testKanji(e)?Bt.KANJI:Bt.BYTE};Bt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Bt.isValid=function(e){return e&&e.bit&&e.ccBits};function Pie(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Bt.NUMERIC;case"alphanumeric":return Bt.ALPHANUMERIC;case"kanji":return Bt.KANJI;case"byte":return Bt.BYTE;default:throw new Error("Unknown mode: "+t)}}Bt.from=function(e,r){if(Bt.isValid(e))return e;try{return Pie(e)}catch{return r}}});var mU=A(_o=>{l();var Gy=Es(),Rie=Y_(),hU=My(),bs=As(),rS=Z_(),gU=7973,pU=Gy.getBCHDigit(gU);function Bie(t,e,r){for(let n=1;n<=40;n++)if(e<=_o.getCapacity(n,r,t))return n}function yU(t,e){return bs.getCharCountIndicator(t,e)+4}function Lie(t,e){let r=0;return t.forEach(function(n){let i=yU(n.mode,e);r+=i+n.getBitsLength()}),r}function Fie(t,e){for(let r=1;r<=40;r++)if(Lie(t,r)<=_o.getCapacity(r,e,bs.MIXED))return r}_o.from=function(e,r){return rS.isValid(e)?parseInt(e,10):r};_o.getCapacity=function(e,r,n){if(!rS.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=bs.BYTE);let i=Gy.getSymbolTotalCodewords(e),s=Rie.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===bs.MIXED)return o;let a=o-yU(n,e);switch(n){case bs.NUMERIC:return Math.floor(a/10*3);case bs.ALPHANUMERIC:return Math.floor(a/11*2);case bs.KANJI:return Math.floor(a/13);case bs.BYTE:default:return Math.floor(a/8)}};_o.getBestVersionForData=function(e,r){let n,i=hU.from(r,hU.M);if(Array.isArray(e)){if(e.length>1)return Fie(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Bie(n.mode,n.getLength(),i)};_o.getEncodedBits=function(e){if(!rS.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Gy.getBCHDigit(r)-pU>=0;)r^=gU<{l();var nS=Es(),EU=1335,Mie=21522,wU=nS.getBCHDigit(EU);vU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;nS.getBCHDigit(i)-wU>=0;)i^=EU<{l();var Uie=As();function Mu(t){this.mode=Uie.NUMERIC,this.data=t.toString()}Mu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Mu.prototype.getLength=function(){return this.data.length};Mu.prototype.getBitsLength=function(){return Mu.getBitsLength(this.data.length)};Mu.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))};bU.exports=Mu});var SU=A((YEe,_U)=>{l();var qie=As(),iS=["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 Uu(t){this.mode=qie.ALPHANUMERIC,this.data=t}Uu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Uu.prototype.getLength=function(){return this.data.length};Uu.prototype.getBitsLength=function(){return Uu.getBitsLength(this.data.length)};Uu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=iS.indexOf(this.data[r])*45;n+=iS.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(iS.indexOf(this.data[r]),6)};_U.exports=Uu});var CU=A((XEe,TU)=>{"use strict";l();TU.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 NU=A((eve,xU)=>{l();var Vie=CU(),Hie=As();function qu(t){this.mode=Hie.BYTE,typeof t=="string"&&(t=Vie(t)),this.data=new Uint8Array(t)}qu.getBitsLength=function(e){return e*8};qu.prototype.getLength=function(){return this.data.length};qu.prototype.getBitsLength=function(){return qu.getBitsLength(this.data.length)};qu.prototype.write=function(t){for(let e=0,r=this.data.length;e{l();var kie=As(),Gie=Es();function Vu(t){this.mode=kie.KANJI,this.data=t}Vu.getBitsLength=function(e){return e*13};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.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)}};OU.exports=Vu});var PU=A((ive,sS)=>{"use strict";l();var pf={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=pf.PriorityQueue.make();s.push(e,0);for(var o,a,u,c,f,d,g,m,y;!s.empty();){o=s.pop(),a=o.value,c=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=c+d,m=i[u],y=typeof i[u]>"u",(y||m>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var b=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(b)}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=pf.single_source_shortest_paths(t,e,r);return pf.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=pf.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 sS<"u"&&(sS.exports=pf)});var VU=A(Hu=>{l();var je=As(),LU=IU(),FU=SU(),MU=NU(),UU=DU(),gf=eS(),jy=Es(),jie=PU();function RU(t){return unescape(encodeURIComponent(t)).length}function yf(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 qU(t){let e=yf(gf.NUMERIC,je.NUMERIC,t),r=yf(gf.ALPHANUMERIC,je.ALPHANUMERIC,t),n,i;return jy.isKanjiModeEnabled()?(n=yf(gf.BYTE,je.BYTE,t),i=yf(gf.KANJI,je.KANJI,t)):(n=yf(gf.BYTE_KANJI,je.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 oS(t,e){switch(e){case je.NUMERIC:return LU.getBitsLength(t);case je.ALPHANUMERIC:return FU.getBitsLength(t);case je.KANJI:return UU.getBitsLength(t);case je.BYTE:return MU.getBitsLength(t)}}function Qie(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 zie(t){let e=[];for(let r=0;r{l();var zy=Es(),aS=My(),$ie=XM(),Kie=eU(),Yie=tU(),Jie=iU(),lS=sU(),fS=Y_(),Xie=lU(),Qy=mU(),Zie=AU(),ese=As(),uS=VU();function tse(t,e){let r=t.size,n=Jie.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 rse(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 cS(t,e,r){let n=t.size,i=Zie.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 sse(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 c=!1;o>>s&1)===1),t.set(i,a-u,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function ose(t,e,r){let n=new $ie;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),ese.getCharCountIndicator(u.mode,t)),u.write(n)});let i=zy.getSymbolTotalCodewords(t),s=fS.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&&tse(u,e),rse(u,o),isNaN(n)&&(n=uS.getBestMask(u,aS.bind(null,u,r))),uS.applyMask(n,u),aS(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}VU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=sS.M,i,s;return typeof r<"u"&&(n=sS.from(r.errorCorrectionLevel,sS.M),i=zy.from(r.version),s=uS.from(r.maskPattern),r.toSJISFunc&&Wy.setToSJISFunction(r.toSJISFunc)),sse(e,i,n,s)}});var lS=v(So=>{l();function kU(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("")}}So.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:kU(e.color.dark||"#000000ff"),light:kU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};So.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};So.getImageWidth=function(e,r){let n=So.getScale(e,r);return Math.floor((e+r.margin*2)*n)};So.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=So.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{l();var fS=lS();function ose(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 ase(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}$y.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=ase()),i=fS.getOptions(i);let o=fS.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return fS.qrToImageData(u.data,e,i),ose(a,s,o),a.putImageData(u,0,0),s};$y.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=$y.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var zU=v(QU=>{l();var use=lS();function jU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function dS(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function cse(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?dS("M",u+r,.5+c+r):dS("m",i,0),i=0,s=!1),u+1':"",c="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+c+` -`;return typeof n=="function"&&n(null,g),g}});var $U=v(mf=>{l();var lse=$M(),hS=HU(),WU=GU(),fse=zU();function pS(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!lse())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,c){try{let f=hS.create(r,n);u(t(f,e,n))}catch(f){c(f)}})}try{let u=hS.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}mf.create=hS.create;mf.toCanvas=pS.bind(null,WU.render);mf.toDataURL=pS.bind(null,WU.renderToDataURL);mf.toString=pS.bind(null,function(t,e,r){return fse.render(t,r)})});var s4=v(Is=>{"use strict";l();var bse=Is&&Is.__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]}),i4=Is&&Is.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bse(e,t,r)};Object.defineProperty(Is,"__esModule",{value:!0});i4(_u(),Is);i4(a_(),Is)});l();var Sse=Se(Hm(),1),Tse=Se(AE(),1),Cse=Se(IE(),1),xse=Se(pt(),1),Nse=Se(ha(),1),Ose=Se(Yr(),1),Dse=Se(Yn(),1),Pse=Se(Ih(),1),Rse=Se(Pv(),1),Bse=Se(qc(),1),Lse=Se(Wh(),1),C4=Se(_i(),1),jn=Se(Ec(),1),x4=Se(tc(),1),N4=Se(ko(),1);l();l();var p2=Se(Fv(),1);l();l();var $h="elvenjs_state",f2="https://devnet-api.multiversx.com";var Gi="/dapp/init",Kh="devnet",d2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",h2=["wss://relay.walletconnect.com"],Zt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.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",xAliasAddress:"https://testnet.xalias.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",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var ve={get(t){let e=localStorage.getItem($h);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($h,JSON.stringify(r))},clear(){localStorage.removeItem($h)}};var Yh=async()=>{let t=p2.ExtensionProvider.getInstance();try{let e=await t.init(),r=ve.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var vS=Se(Fv(),1),AS=Se(Yl(),1),bS=Se(_u(),1),T4=Se(P_(),1),s0=Se(Wh(),1);l();var bM=Se(Yl(),1);l();l();var ye=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};l();var Cy=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(Cy||{});l();var Et=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Ou=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");ye.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(ve.clear(),ye.run("onLogoutSuccess")),e}catch(e){let r=Et(e);console.warn(`Something went wrong trying to logout the user: ${r}`),ye.run("onLogoutFailure",r)}finally{ye.run("onLogoutEnd")}};l();var vM=Se(pt(),1),AM=Se(ha(),1);l();var Du=()=>new Date().setHours(new Date().getHours()+24),xy=t=>Date.now()>t;var mi=async t=>{let e=ve.get("address"),r=ve.get("expires");if(!(r&&xy(r))&&e&&t.networkProvider){let i=new vM.Address(e),s=new AM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);ve.set("address",e),ve.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),ve.set("nonce",o.nonce.valueOf()),ve.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Et(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};l();function Ny(t){return t[Math.floor(Math.random()*t.length)]}var IM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{mi(t),ye.run("onLoginSuccess")},onClientLogout:()=>Ou(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Ny(t.initOptions.walletConnectV2RelayAddresses),n=new bM.WalletConnectV2Provider(e,Zt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};l();var Fy=Se(pt(),1),qM=Se(_M(),1),VM=Se(NM(),1),HM=Se(k_(),1),kM=Se(LM(),1),GM=Se(MM(),1),jM=Se(UM(),1),QM=Se(Vc(),1);var My=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Kh,this.apiUrl=e||Zt[this.chainType]?.apiAddress,this.apiTimeout=n||Zt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let c=u?.error||a.status;return clearTimeout(s),Promise.reject(c)}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)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new Fy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new qM.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 Fy.Address(r.sender),receiver:new Fy.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:VM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:HM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:kM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new QM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new jM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return GM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};l();var zM=async(t,e,r,n="/")=>{let i=await Yh(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i)if(await i.login(o))ye.run("onLoginStart");else throw new Error("There were problems while logging in!")}catch(u){let c=Et(u);throw new Error(c)}if(!i)throw new Error("There were problems with auth provider initialization!");let{signature:a}=i.account;if(ve.set("loginToken",e),a&&ve.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");ve.set("address",u),ve.set("loginMethod","browser-extension"),ve.set("expires",Du()),await mi(t),ye.run("onLoginSuccess");let c=r.getToken(u,e,a);return ve.set("accessToken",c),i}catch(u){throw new Error(`Something went wrong trying to synchronize the user account: ${u?.message}`)}};l();l();var KU=Se($U(),1),YU=Se(Yl(),1);var dse=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},hse=t=>{let e=`${d2}?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},pse=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},gse=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},gS={},yse=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",gS[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:gS[t.topic].signal}),r},Ky={},mse=(t,e,r)=>{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=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=yse(t,e);return n.appendChild(s),Ky[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ky[t.topic].signal}),n},wse=()=>{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},Ese=t=>{if(!t)return;document.getElementById(t)?.remove()},vse=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Ase=async t=>t?await KU.default.toString(t,{type:"svg"}):void 0,JU=async(t,e,r,n)=>{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=await Ase(e),o;if(s&&(o=dse(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),vse()&&i.appendChild(hse(e))),i&&r instanceof YU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),Ese(f))}catch(d){let g=Et(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ky[f].abort()}},c=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(wse()),await r.login({approval:d,token:n})}catch(d){let g=Et(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values(Ky))d?.abort();for(let d of Object.values(gS))d?.abort()}};if(a&&a.length>0){let f=pse();i.appendChild(f);let d=gse();f.appendChild(d);for(let g of a){let m=mse(g,u,c);f.appendChild(m)}}}return i};var Yy=Se(Yl(),1);var XU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=Ny(t.initOptions.walletConnectV2RelayAddresses);if(!i||!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 s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Yy.WalletConnectV2Provider){ye.run("onLoginStart");let u=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();ve.set("address",u),ve.set("loginMethod","mobile"),ve.set("expires",Du()),await mi(t),c&&ve.set("signature",c),ve.set("loginToken",e);let f=r.getToken(u,e,c);ve.set("accessToken",f),ye.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Yy.WalletConnectV2Provider&&await Ou(t)},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Yy.WalletConnectV2Provider(o,Zt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,ye.run("onQrPending"),await a.init();let{uri:u,approval:c}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await JU(n,f,a,e),ye.run("onQrLoaded")),await a.login({approval:c,token:e}),a}}catch(u){let c=Et(u);console.warn(`Something went wrong trying to login the user: ${c}`),ye.run("onLoginFailure",c)}};l();var ZU=Se(_u(),1);var yS=async(t,e,r,n)=>{let i=new ZU.WalletProvider(`${t}${Gi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return ye.run("onLoginStart"),ve.set("loginMethod",Zt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),ve.set("expires",Du()),ve.set("loginToken",e),i}catch(a){let u=Et(a);console.warn(`Something went wrong trying to login the user: ${u}`),ve.set("loginMethod",""),ye.run("onLoginFailure",u)}};l();var Ar=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};l();var e4=Se(_u(),1);var t4=Se(P_(),1),mS=async(t,e)=>{let r=Ar("signature"),n=Ar("address"),i=ve.get("address"),s=ve.get("loginToken");if(r&&ve.set("signature",r),n||i){n&&(ve.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new e4.WalletProvider(`${t}${Gi}`);if(r&&e&&n){let u=new t4.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);ve.set("accessToken",u)}return o}};l();var r4=Se(ha(),1),n4=Se(Ih(),1);var Jy=async(t,e)=>{ye.run("onTxSent",t),await new n4.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new r4.Account(n),s=await e.getAccount(n);i.update(s),ve.set("address",i.address.bech32()),ve.set("balance",i.balance.toString()),ye.run("onTxFinalized",t)};l();var ku=Se(s4(),1),a4=Se(Yr(),1);l();var o4=Se(ha(),1);var Xy=t=>{let e=t.getSender(),r=new o4.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),ve.set("nonce",n+1)};var u4=async(t,e,r,n)=>{if(Ar(ku.WALLET_PROVIDER_CALLBACK_PARAM)===ku.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=ve.get("activeGuardian"),o=ve.get("loginMethod"),a=Ar("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new ku.WalletProvider(`${r}${Gi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let c=a4.Transaction.fromPlainObject(u);c.setNonce(n),Xy(c);try{ye.run("onTxStart",c),await e.sendTransaction(c),await Jy(c,e)}catch(f){let g=`Getting transaction information failed! ${Et(f)}`;throw ye.run("onTxFailure",c,g),new Error(g)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};l();var Zy=Se(xc(),1),c4=Se(pt(),1),l4=Se(_u(),1);var f4=t=>{let e=ve.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Zy.TransactionVersion.withTxOptions()),t.setOptions(Zy.TransactionOptions.withOptions(r)),t.setGuardian(c4.Address.fromBech32(e))}return t},d4=async(t,e)=>{let r=new l4.WalletProvider(`${e}${Gi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},h4=t=>{let e=ve.get("activeGuardian");return!(!ve.get("address")||!e||t.isGuardedTransaction())};l();var p4=()=>{let t=!Ar("walletProviderStatus"),e=Ar("status")==="signed",r=Ar("message"),n=Ar("signature");t&&e&&r&&n&&(ye.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};l();var ES=Se(Yr(),1);l();var g4=(e=>(e.reloginResponse="RELOGIN_RESPONSE",e))(g4||{}),y4=(a=>(a.handshakeResponse="HANDSHAKE_RESPONSE",a.loginResponse="LOGIN_RESPONSE",a.disconnectResponse="DISCONNECT_RESPONSE",a.cancelResponse="CANCEL_RESPONSE",a.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",a.signMessageResponse="SIGN_MESSAGE_RESPONSE",a.noneResponse="NONE_RESPONSE",a))(y4||{}),wS={...y4,...g4},m4=(r=>(r.signTransactionsWithGuardianResponse="SIGN_TRANSACTIONS_WITH_GUARDIAN_RESPONSE",r.reloginRequest="RELOGIN_REQUEST",r))(m4||{}),w4=(o=>(o.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",o.signMessageRequest="SIGN_MESSAGE_REQUEST",o.loginRequest="LOGIN_REQUEST",o.logoutRequest="LOGOUT_REQUEST",o.cancelAction="CANCEL_ACTION_REQUEST",o.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",o))(w4||{}),To={...w4,...m4};l();var E4=typeof window<"u"?window:{},v4=()=>E4.ReactNativeWebView?"reactNative":E4.webkit?"ios":"web",Co=()=>typeof window<"u"&&typeof window?.location<"u"?window?.parent?.origin??"*":"*",e0=t=>Object.prototype.toString.call(t)==="[object String]";l();var t0={signTransactions:{ios:t=>window.webkit.messageHandlers.signTransactions.postMessage(t,Co()),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t}),Co())},signMessage:{ios:t=>window.webkit.messageHandlers.signMessage.postMessage(t),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signMessageRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signMessageRequest,message:t}),Co())},logout:{ios:()=>window.webkit.messageHandlers.logout.postMessage(),reactNative:()=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.logoutRequest})),web:()=>window?.postMessage(JSON.stringify({type:To.logoutRequest}),Co())}};var r0=v4(),n0="message",A4=t=>{let e=r=>{let n=r.data;if(!(r.target.origin!=Co()&&r0!="reactNative"))try{n=JSON.parse(n),t(n)}catch{console.error("error parsing response")}};document&&document.addEventListener(n0,e),window&&window.addEventListener(n0,e)},_s=class{constructor(){}async logout(){return t0.logout[r0](),new Promise(e=>{e(!0)})}async signMessage(e){try{return t0.signMessage[r0](e),await new Promise((n,i)=>{window.signMessageResponse=(o,a)=>{if(a){i(a),window.signMessageResponse=null;return}n(o),window.signMessageResponse=null};function s(o){let{message:a,type:u}=o;if(u===wS.signMessageResponse&&a!=null){let{signedMessage:c,error:f}=a;f?i(f):n(c)}document?.removeEventListener(n0,s)}A4(s)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransactions(e){try{let r=e.map(i=>i.toPlainObject());return t0.signTransactions[r0](r),await new Promise((i,s)=>{window.transactionsSigned=(a,u)=>{if(a=JSON.parse(a),u){s(u),window.transactionsSigned=null;return}i(a.map(c=>ES.Transaction.fromPlainObject(c))),window.transactionsSigned=null};function o(a){let{message:u,type:c}=a;if(c===wS.signTransactionsResponse){let{transactions:f,error:d}=u;try{d?s(d):i(f.map(g=>ES.Transaction.fromPlainObject(g)))}catch{s("Unable to sign")}}document&&document.removeEventListener(n0,o)}A4(o)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransaction(e){return(await this.signTransactions([e]))[0]}};l();l();l();function _se(t){try{let e=atob(t),r=btoa(e),n=h.Buffer.from(t,"base64").toString(),i=h.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Gu(t){return _se(t)?atob(t):t}l();var b4=t=>{if(!t||!e0(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Gu(s)),a=Gu(r);return{ttl:Number(i),extraInfo:o,origin:a,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var I4=t=>{if(!t||!e0(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Gu(r),o=Gu(n),a=b4(o);if(!a)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let u={...a,address:s,body:o,signature:i};return a.extraInfo?.timestamp||delete u.extraInfo,u}catch{return null}};function _4(t,e){let r=I4(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(ve.set("loginToken",s),ve.set("accessToken",t),ve.set("signature",n),ve.set("address",i),ve.set("loginMethod","x-portal-hub"),e.dappProvider=new _s)}l();var S4=t=>{t.onLoginStart&&ye.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&ye.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&ye.set("onLoginFailure",t.onLoginFailure),t.onLoginEnd&&ye.set("onLoginEnd",t.onLoginEnd),t.onLogoutStart&&ye.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&ye.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&ye.set("onLogoutFailure",t.onLogoutFailure),t.onLogoutEnd&&ye.set("onLogoutEnd",t.onLogoutEnd),t.onQrPending&&ye.set("onQrPending",t.onQrPending),t.onQrLoaded&&ye.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&ye.set("onTxStart",t.onTxStart),t.onTxSent&&ye.set("onTxSent",t.onTxSent),t.onTxFinalized&&ye.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&ye.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&ye.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&ye.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&ye.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&ye.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&ye.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&ye.set("onQueryFailure",t.onQueryFailure)};l();var i0=async t=>{ye.run("onLoginStart");try{await t(()=>{ye.run("onLoginSuccess")})}catch(e){let r=Et(e);console.warn(`Something went wrong trying to login the user: ${r}`),ye.run("onLoginFailure",r)}finally{ye.run("onLoginEnd")}};var IS=class{static async init(e){let r=ve.get();if(r.expires&&xy(r.expires)){ve.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Kh,apiUrl:f2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:h2,...e},this.networkProvider=new My(this.initOptions),S4(this.initOptions);let n=Ar("accessToken");n&&await i0(async s=>{_4(n,this),await mi(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Ar("address"))&&r?.loginMethod&&(await i0(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await Yh()),r.loginMethod==="mobile"&&(this.dappProvider=await IM(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new _s),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await mS(Zt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await mS(Zt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await mi(this),s()}),this.initOptions?.chainType&&(await u4(this.dappProvider,this.networkProvider,Zt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),p4()))}static async login(e,r){if(!Object.values(Cy).includes(e)){let i="Wrong login method!";throw ye.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw ye.run("onLoginFailure",i),new Error(i)}await i0(async i=>{let s=new T4.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),o=await s.initialize();if(e==="browser-extension"){let a=await zM(this,o,s,r?.callbackRoute);this.dappProvider=a,i()}if(e==="mobile"){let a=await XU(this,o,s,r?.qrCodeContainer);this.dappProvider=a,i()}if(e==="web-wallet"&&this.initOptions?.chainType){let a=await yS(Zt[this.initOptions.chainType].walletAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}if(e==="x-alias"&&this.initOptions?.chainType){let a=await yS(Zt[this.initOptions.chainType].xAliasAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}})}static async logout(){try{let e=await Ou(this);return this.dappProvider=void 0,e}catch(e){let r=Et(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw ye.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw ye.run("onTxFailure",e,n),new Error(n)}let r=f4(e);try{ye.run("onTxStart",e);let n=ve.get();if(e.setNonce(n.nonce),this.dappProvider instanceof vS.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof AS.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _s&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof bS.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=h4(r);if(i||Xy(r),i&&this.initOptions?.chainType){await d4(r,Zt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Jy(r,this.networkProvider)}}catch(n){let i=Et(n);throw ye.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(ye.run("onSignMsgStart",e),this.dappProvider instanceof vS.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new s0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof AS.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new s0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof _s&&(n=await this.dappProvider.signMessage(e)),this.dappProvider instanceof bS.WalletProvider){let i=o=>encodeURIComponent(o).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),s=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new s0.SignableMessage({message:h.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${s}${s.includes("?")?"&":"?"}message=${i(e)}`)})}return ye.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Et(i);throw ye.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{ye.run("onQueryStart",o);let a=await this.networkProvider.queryContract(o);return ye.run("onQueryFinalized",a),a}catch(a){let u=Et(a);throw ye.run("onQueryFinalized",o,u),new Error(`Smart contract query failed! ${u}`)}}static{this.storage=ve}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,ye.clear()}}};var export_Account=Nse.Account;var export_Address=xse.Address;var export_AddressType=N4.AddressType;var export_AddressValue=N4.AddressValue;var export_BigUIntType=jn.BigUIntType;var export_BigUIntValue=jn.BigUIntValue;var export_BooleanType=x4.BooleanType;var export_BooleanValue=x4.BooleanValue;var export_BytesType=C4.BytesType;var export_BytesValue=C4.BytesValue;var export_ContractFunction=Bse.ContractFunction;var export_GasEstimator=Cse.GasEstimator;var export_SignableMessage=Lse.SignableMessage;var export_SmartContract=Rse.SmartContract;var export_TokenTransfer=Sse.TokenTransfer;var export_Transaction=Ose.Transaction;var export_TransactionPayload=Dse.TransactionPayload;var export_TransactionWatcher=Pse.TransactionWatcher;var export_TransferTransactionsFactory=Tse.TransferTransactionsFactory;var export_U16Type=jn.U16Type;var export_U16Value=jn.U16Value;var export_U32Type=jn.U32Type;var export_U32Value=jn.U32Value;var export_U64Type=jn.U64Type;var export_U64Value=jn.U64Value;var export_U8Type=jn.U8Type;var export_U8Value=jn.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,IS as ElvenJS,export_GasEstimator as GasEstimator,Cy as LoginMethodsEnum,export_SignableMessage as SignableMessage,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=ose(e,r,i),a=zy.getSymbolSize(e),u=new Kie(a);return tse(u,e),rse(u),nse(u,e),cS(u,r,0),e>=7&&ise(u,e),sse(u,o),isNaN(n)&&(n=lS.getBestMask(u,cS.bind(null,u,r))),lS.applyMask(n,u),cS(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}HU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=aS.M,i,s;return typeof r<"u"&&(n=aS.from(r.errorCorrectionLevel,aS.M),i=Qy.from(r.version),s=lS.from(r.maskPattern),r.toSJISFunc&&zy.setToSJISFunction(r.toSJISFunc)),use(e,i,n,s)}});var dS=A(So=>{l();function GU(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("")}}So.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:GU(e.color.dark||"#000000ff"),light:GU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};So.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};So.getImageWidth=function(e,r){let n=So.getScale(e,r);return Math.floor((e+r.margin*2)*n)};So.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=So.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{l();var hS=dS();function cse(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 lse(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Wy.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=lse()),i=hS.getOptions(i);let o=hS.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return hS.qrToImageData(u.data,e,i),cse(a,s,o),a.putImageData(u,0,0),s};Wy.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Wy.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var WU=A(zU=>{l();var fse=dS();function QU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function pS(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function dse(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?pS("M",u+r,.5+c+r):pS("m",i,0),i=0,s=!1),u+1':"",c="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+c+` +`;return typeof n=="function"&&n(null,g),g}});var KU=A(mf=>{l();var hse=KM(),gS=kU(),$U=jU(),pse=WU();function yS(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!hse())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,c){try{let f=gS.create(r,n);u(t(f,e,n))}catch(f){c(f)}})}try{let u=gS.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}mf.create=gS.create;mf.toCanvas=yS.bind(null,$U.render);mf.toDataURL=yS.bind(null,$U.renderToDataURL);mf.toString=yS.bind(null,function(t,e,r){return pse.render(t,r)})});var o4=A(Is=>{"use strict";l();var Sse=Is&&Is.__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]}),s4=Is&&Is.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sse(e,t,r)};Object.defineProperty(Is,"__esModule",{value:!0});s4(Tu(),Is);s4(f_(),Is)});l();var xse=be(Vm(),1),Nse=be(vE(),1),Ose=be(bE(),1),Dse=be(pt(),1),Pse=be(ha(),1),Rse=be(Yr(),1),Bse=be(Yn(),1),Lse=be(Ih(),1),Fse=be(Dv(),1),Mse=be(qc(),1),Use=be(Wh(),1),x4=be(_i(),1),jn=be(Ec(),1),N4=be(tc(),1),O4=be(ko(),1),qse=be(Rv(),1),Vse=be(Mv(),1);l();l();var A2=be(Vv(),1);l();l();var $h="elvenjs_state",w2="https://devnet-api.multiversx.com";var ji="/dapp/init",Kh="devnet",E2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",v2=["wss://relay.walletconnect.com"],Zt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.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",xAliasAddress:"https://testnet.xalias.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",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var ve={get(t){let e=localStorage.getItem($h);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($h,JSON.stringify(r))},clear(){localStorage.removeItem($h)}};var Yh=async()=>{let t=A2.ExtensionProvider.getInstance();try{let e=await t.init(),r=ve.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var bS=be(Vv(),1),IS=be(Yl(),1),_S=be(Tu(),1),C4=be(F_(),1),i0=be(Wh(),1);l();var xM=be(Yl(),1);l();l();var ye=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};l();var SM=(E=>(E.onLoginStart="onLoginStart",E.onLoginEnd="onLoginEnd",E.onLoginSuccess="onLoginSuccess",E.onLoginFailure="onLoginFailure",E.onLogoutStart="onLogoutStart",E.onLogoutEnd="onLogoutEnd",E.onLogoutSuccess="onLogoutSuccess",E.onLogoutFailure="onLogoutFailure",E.onQrPending="onQrPending",E.onQrLoaded="onQrLoaded",E.onTxStart="onTxStart",E.onTxSent="onTxSent",E.onTxFinalized="onTxFinalized",E.onTxFailure="onTxFailure",E.onSignMsgStart="onSignMsgStart",E.onSignMsgFinalized="onSignMsgFinalized",E.onSignMsgFailure="onSignMsgFailure",E.onQueryStart="onQueryStart",E.onQueryFinalized="onQueryFinalized",E.onQueryFailure="onQueryFailure",E))(SM||{}),M_=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(M_||{}),mie=(r=>(r.mvx_cancelAction="mvx_cancelAction",r.mvx_signNativeAuthToken="mvx_signNativeAuthToken",r))(mie||{}),wie=(e=>(e.hasWebWalletGuardianSign="hasWebWalletGuardianSign",e))(wie||{});l();var Et=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Pu=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");ye.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(ve.clear(),ye.run("onLogoutSuccess")),e}catch(e){let r=Et(e);console.warn(`Something went wrong trying to logout the user: ${r}`),ye.run("onLogoutFailure",r)}finally{ye.run("onLogoutEnd")}};l();var TM=be(pt(),1),CM=be(ha(),1);l();var Ru=()=>new Date().setHours(new Date().getHours()+24),Cy=t=>Date.now()>t;var mi=async t=>{let e=ve.get("address"),r=ve.get("expires");if(!(r&&Cy(r))&&e&&t.networkProvider){let i=new TM.Address(e),s=new CM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);ve.set("address",e),ve.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),ve.set("nonce",o.nonce.valueOf()),ve.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Et(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};l();function xy(t){return t[Math.floor(Math.random()*t.length)]}var NM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{mi(t),ye.run("onLoginSuccess")},onClientLogout:()=>Pu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=xy(t.initOptions.walletConnectV2RelayAddresses),n=new xM.WalletConnectV2Provider(e,Zt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};l();var Ly=be(pt(),1),VM=be(OM(),1),HM=be(PM(),1),kM=be(Q_(),1),GM=be(UM(),1),jM=be(Mv(),1),QM=be(qM(),1),zM=be(Vc(),1);var Fy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Kh,this.apiUrl=e||Zt[this.chainType]?.apiAddress,this.apiTimeout=n||Zt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){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=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let c=u?.error||a.status;return clearTimeout(s),Promise.reject(c)}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)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new Ly.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new VM.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 Ly.Address(r.sender),receiver:new Ly.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:HM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:kM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:GM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new zM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new QM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return jM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};l();var WM=async(t,e,r,n="/")=>{let i=await Yh(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i)if(await i.login(o))ye.run("onLoginStart");else throw new Error("There were problems while logging in!")}catch(u){let c=Et(u);throw new Error(c)}if(!i)throw new Error("There were problems with auth provider initialization!");let{signature:a}=i.account;if(ve.set("loginToken",e),a&&ve.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");ve.set("address",u),ve.set("loginMethod","browser-extension"),ve.set("expires",Ru()),await mi(t),ye.run("onLoginSuccess");let c=r.getToken(u,e,a);return ve.set("accessToken",c),i}catch(u){throw new Error(`Something went wrong trying to synchronize the user account: ${u?.message}`)}};l();l();var YU=be(KU(),1),JU=be(Yl(),1);var gse=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},yse=t=>{let e=`${E2}?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},mse=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},wse=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},mS={},Ese=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",mS[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:mS[t.topic].signal}),r},$y={},vse=(t,e,r)=>{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=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=Ese(t,e);return n.appendChild(s),$y[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:$y[t.topic].signal}),n},Ase=()=>{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},bse=t=>{if(!t)return;document.getElementById(t)?.remove()},Ise=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),_se=async t=>t?await YU.default.toString(t,{type:"svg"}):void 0,XU=async(t,e,r,n)=>{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=await _se(e),o;if(s&&(o=gse(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),Ise()&&i.appendChild(yse(e))),i&&r instanceof JU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),bse(f))}catch(d){let g=Et(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{$y[f].abort()}},c=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(Ase()),await r.login({approval:d,token:n})}catch(d){let g=Et(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values($y))d?.abort();for(let d of Object.values(mS))d?.abort()}};if(a&&a.length>0){let f=mse();i.appendChild(f);let d=wse();f.appendChild(d);for(let g of a){let m=vse(g,u,c);f.appendChild(m)}}}return i};var Ky=be(Yl(),1);var ZU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=xy(t.initOptions.walletConnectV2RelayAddresses);if(!i||!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 s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Ky.WalletConnectV2Provider){ye.run("onLoginStart");let u=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();ve.set("address",u),ve.set("loginMethod","mobile"),ve.set("expires",Ru()),await mi(t),c&&ve.set("signature",c),ve.set("loginToken",e);let f=r.getToken(u,e,c);ve.set("accessToken",f),ye.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Ky.WalletConnectV2Provider&&await Pu(t)},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Ky.WalletConnectV2Provider(o,Zt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,ye.run("onQrPending"),await a.init();let{uri:u,approval:c}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await XU(n,f,a,e),ye.run("onQrLoaded")),await a.login({approval:c,token:e}),a}}catch(u){let c=Et(u);console.warn(`Something went wrong trying to login the user: ${c}`),ye.run("onLoginFailure",c)}};l();var e4=be(Tu(),1);var wS=async(t,e,r,n)=>{let i=new e4.WalletProvider(`${t}${ji}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return ye.run("onLoginStart"),ve.set("loginMethod",Zt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),ve.set("expires",Ru()),ve.set("loginToken",e),i}catch(a){let u=Et(a);console.warn(`Something went wrong trying to login the user: ${u}`),ve.set("loginMethod",""),ye.run("onLoginFailure",u)}};l();var Ar=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};l();var t4=be(Tu(),1);var r4=be(F_(),1),ES=async(t,e)=>{let r=Ar("signature"),n=Ar("address"),i=ve.get("address"),s=ve.get("loginToken");if(r&&ve.set("signature",r),n||i){n&&(ve.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new t4.WalletProvider(`${t}${ji}`);if(r&&e&&n){let u=new r4.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);ve.set("accessToken",u)}return o}};l();var n4=be(ha(),1),i4=be(Ih(),1);var Yy=async(t,e)=>{ye.run("onTxSent",t),await new i4.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new n4.Account(n),s=await e.getAccount(n);i.update(s),ve.set("address",i.address.bech32()),ve.set("balance",i.balance.toString()),ye.run("onTxFinalized",t)};l();var ku=be(o4(),1),u4=be(Yr(),1);l();var a4=be(ha(),1);var Jy=t=>{let e=t.getSender(),r=new a4.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),ve.set("nonce",n+1)};var c4=async(t,e,r,n)=>{if(Ar(ku.WALLET_PROVIDER_CALLBACK_PARAM)===ku.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=ve.get("activeGuardian"),o=ve.get("loginMethod"),a=Ar("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new ku.WalletProvider(`${r}${ji}`).getTransactionsFromWalletUrl()?.[0]);if(u){let c=u4.Transaction.fromPlainObject(u);c.setNonce(n),Jy(c);try{ye.run("onTxStart",c),await e.sendTransaction(c),await Yy(c,e)}catch(f){let g=`Getting transaction information failed! ${Et(f)}`;throw ye.run("onTxFailure",c,g),new Error(g)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};l();var Xy=be(xc(),1),l4=be(pt(),1),f4=be(Tu(),1);var d4=t=>{let e=ve.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Xy.TransactionVersion.withTxOptions()),t.setOptions(Xy.TransactionOptions.withOptions(r)),t.setGuardian(l4.Address.fromBech32(e))}return t},h4=async(t,e)=>{let r=new f4.WalletProvider(`${e}${ji}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},p4=t=>{let e=ve.get("activeGuardian");return!(!ve.get("address")||!e||t.isGuardedTransaction())};l();var g4=()=>{let t=!Ar("walletProviderStatus"),e=Ar("status")==="signed",r=Ar("message"),n=Ar("signature");t&&e&&r&&n&&(ye.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};l();var AS=be(Yr(),1);l();var y4=(e=>(e.reloginResponse="RELOGIN_RESPONSE",e))(y4||{}),m4=(a=>(a.handshakeResponse="HANDSHAKE_RESPONSE",a.loginResponse="LOGIN_RESPONSE",a.disconnectResponse="DISCONNECT_RESPONSE",a.cancelResponse="CANCEL_RESPONSE",a.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",a.signMessageResponse="SIGN_MESSAGE_RESPONSE",a.noneResponse="NONE_RESPONSE",a))(m4||{}),vS={...m4,...y4},w4=(r=>(r.signTransactionsWithGuardianResponse="SIGN_TRANSACTIONS_WITH_GUARDIAN_RESPONSE",r.reloginRequest="RELOGIN_REQUEST",r))(w4||{}),E4=(o=>(o.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",o.signMessageRequest="SIGN_MESSAGE_REQUEST",o.loginRequest="LOGIN_REQUEST",o.logoutRequest="LOGOUT_REQUEST",o.cancelAction="CANCEL_ACTION_REQUEST",o.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",o))(E4||{}),To={...E4,...w4};l();var v4=typeof window<"u"?window:{},A4=()=>v4.ReactNativeWebView?"reactNative":v4.webkit?"ios":"web",Co=()=>typeof window<"u"&&typeof window?.location<"u"?window?.parent?.origin??"*":"*",Zy=t=>Object.prototype.toString.call(t)==="[object String]";l();var e0={signTransactions:{ios:t=>window.webkit.messageHandlers.signTransactions.postMessage(t,Co()),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signTransactionsRequest,message:t}),Co())},signMessage:{ios:t=>window.webkit.messageHandlers.signMessage.postMessage(t),reactNative:t=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.signMessageRequest,message:t})),web:t=>window?.postMessage(JSON.stringify({type:To.signMessageRequest,message:t}),Co())},logout:{ios:()=>window.webkit.messageHandlers.logout.postMessage(),reactNative:()=>window?.ReactNativeWebView.postMessage(JSON.stringify({type:To.logoutRequest})),web:()=>window?.postMessage(JSON.stringify({type:To.logoutRequest}),Co())}};var t0=A4(),r0="message",b4=t=>{let e=r=>{let n=r.data;if(!(r.target.origin!=Co()&&t0!="reactNative"))try{n=JSON.parse(n),t(n)}catch{console.error("error parsing response")}};document&&document.addEventListener(r0,e),window&&window.addEventListener(r0,e)},_s=class{constructor(){}async logout(){return e0.logout[t0](),new Promise(e=>{e(!0)})}async signMessage(e){try{return e0.signMessage[t0](e),await new Promise((n,i)=>{window.signMessageResponse=(o,a)=>{if(a){i(a),window.signMessageResponse=null;return}n(o),window.signMessageResponse=null};function s(o){let{message:a,type:u}=o;if(u===vS.signMessageResponse&&a!=null){let{signedMessage:c,error:f}=a;f?i(f):n(c)}document?.removeEventListener(r0,s)}b4(s)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransactions(e){try{let r=e.map(i=>i.toPlainObject());return e0.signTransactions[t0](r),await new Promise((i,s)=>{window.transactionsSigned=(a,u)=>{if(a=JSON.parse(a),u){s(u),window.transactionsSigned=null;return}i(a.map(c=>AS.Transaction.fromPlainObject(c))),window.transactionsSigned=null};function o(a){let{message:u,type:c}=a;if(c===vS.signTransactionsResponse){let{transactions:f,error:d}=u;try{d?s(d):i(f.map(g=>AS.Transaction.fromPlainObject(g)))}catch{s("Unable to sign")}}document&&document.removeEventListener(r0,o)}b4(o)})}catch(r){throw console.error("error sending transaction",r),r}}async signTransaction(e){return(await this.signTransactions([e]))[0]}};l();l();l();function Cse(t){try{let e=atob(t),r=btoa(e),n=h.Buffer.from(t,"base64").toString(),i=h.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Gu(t){return Cse(t)?atob(t):t}l();var I4=t=>{if(!t||!Zy(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Gu(s)),a=Gu(r);return{ttl:Number(i),extraInfo:o,origin:a,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var _4=t=>{if(!t||!Zy(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Gu(r),o=Gu(n),a=I4(o);if(!a)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let u={...a,address:s,body:o,signature:i};return a.extraInfo?.timestamp||delete u.extraInfo,u}catch{return null}};function S4(t,e){let r=_4(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(ve.set("loginToken",s),ve.set("accessToken",t),ve.set("signature",n),ve.set("address",i),ve.set("loginMethod","x-portal-hub"),e.dappProvider=new _s)}l();var T4=t=>{t.onLoginStart&&ye.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&ye.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&ye.set("onLoginFailure",t.onLoginFailure),t.onLoginEnd&&ye.set("onLoginEnd",t.onLoginEnd),t.onLogoutStart&&ye.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&ye.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&ye.set("onLogoutFailure",t.onLogoutFailure),t.onLogoutEnd&&ye.set("onLogoutEnd",t.onLogoutEnd),t.onQrPending&&ye.set("onQrPending",t.onQrPending),t.onQrLoaded&&ye.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&ye.set("onTxStart",t.onTxStart),t.onTxSent&&ye.set("onTxSent",t.onTxSent),t.onTxFinalized&&ye.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&ye.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&ye.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&ye.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&ye.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&ye.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&ye.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&ye.set("onQueryFailure",t.onQueryFailure)};l();var n0=async t=>{ye.run("onLoginStart");try{await t(()=>{ye.run("onLoginSuccess")})}catch(e){let r=Et(e);console.warn(`Something went wrong trying to login the user: ${r}`),ye.run("onLoginFailure",r)}finally{ye.run("onLoginEnd")}};var SS=class{static async init(e){let r=ve.get();if(r.expires&&Cy(r.expires)){ve.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Kh,apiUrl:w2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:v2,...e},this.networkProvider=new Fy(this.initOptions),T4(this.initOptions);let n=Ar("accessToken");n&&await n0(async s=>{S4(n,this),await mi(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Ar("address"))&&r?.loginMethod&&(await n0(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await Yh()),r.loginMethod==="mobile"&&(this.dappProvider=await NM(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new _s),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await ES(Zt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await ES(Zt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await mi(this),s()}),this.initOptions?.chainType&&(await c4(this.dappProvider,this.networkProvider,Zt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),g4()))}static async login(e,r){if(!Object.values(M_).includes(e)){let i="Wrong login method!";throw ye.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw ye.run("onLoginFailure",i),new Error(i)}await n0(async i=>{let s=new C4.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),o=await s.initialize();if(e==="browser-extension"){let a=await WM(this,o,s,r?.callbackRoute);this.dappProvider=a,i()}if(e==="mobile"){let a=await ZU(this,o,s,r?.qrCodeContainer);this.dappProvider=a,i()}if(e==="web-wallet"&&this.initOptions?.chainType){let a=await wS(Zt[this.initOptions.chainType].walletAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}if(e==="x-alias"&&this.initOptions?.chainType){let a=await wS(Zt[this.initOptions.chainType].xAliasAddress,o,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=a}})}static async logout(){try{let e=await Pu(this);return this.dappProvider=void 0,e}catch(e){let r=Et(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw ye.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw ye.run("onTxFailure",e,n),new Error(n)}let r=d4(e);try{ye.run("onTxStart",e);let n=ve.get();if(e.setNonce(n.nonce),this.dappProvider instanceof bS.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof IS.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _s&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _S.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=p4(r);if(i||Jy(r),i&&this.initOptions?.chainType){await h4(r,Zt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Yy(r,this.networkProvider)}}catch(n){let i=Et(n);throw ye.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(ye.run("onSignMsgStart",e),this.dappProvider instanceof bS.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new i0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof IS.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new i0.SignableMessage({message:h.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof _s&&(n=await this.dappProvider.signMessage(e)),this.dappProvider instanceof _S.WalletProvider){let i=o=>encodeURIComponent(o).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),s=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new i0.SignableMessage({message:h.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${s}${s.includes("?")?"&":"?"}message=${i(e)}`)})}return ye.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Et(i);throw ye.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{ye.run("onQueryStart",o);let a=await this.networkProvider.queryContract(o);return ye.run("onQueryFinalized",a),a}catch(a){let u=Et(a);throw ye.run("onQueryFinalized",o,u),new Error(`Smart contract query failed! ${u}`)}}static{this.storage=ve}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,ye.clear()}}};var export_Account=Pse.Account;var export_Address=Dse.Address;var export_AddressType=O4.AddressType;var export_AddressValue=O4.AddressValue;var export_BigUIntType=jn.BigUIntType;var export_BigUIntValue=jn.BigUIntValue;var export_BooleanType=N4.BooleanType;var export_BooleanValue=N4.BooleanValue;var export_BytesType=x4.BytesType;var export_BytesValue=x4.BytesValue;var export_ContractFunction=Mse.ContractFunction;var export_ContractQueryResponse=Vse.ContractQueryResponse;var export_GasEstimator=Ose.GasEstimator;var export_QueryArguments=qse.QueryArguments;var export_SignableMessage=Use.SignableMessage;var export_SmartContract=Fse.SmartContract;var export_TokenTransfer=xse.TokenTransfer;var export_Transaction=Rse.Transaction;var export_TransactionPayload=Bse.TransactionPayload;var export_TransactionWatcher=Lse.TransactionWatcher;var export_TransferTransactionsFactory=Nse.TransferTransactionsFactory;var export_U16Type=jn.U16Type;var export_U16Value=jn.U16Value;var export_U32Type=jn.U32Type;var export_U32Value=jn.U32Value;var export_U64Type=jn.U64Type;var export_U64Value=jn.U64Value;var export_U8Type=jn.U8Type;var export_U8Value=jn.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,export_ContractQueryResponse as ContractQueryResponse,mie as DappCoreWCV2CustomMethodsEnum,SS as ElvenJS,SM as EventStoreEvents,export_GasEstimator as GasEstimator,M_ as LoginMethodsEnum,export_QueryArguments as QueryArguments,export_SignableMessage as SignableMessage,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,wie as WebWalletUrlParamsEnum}; /*! Bundled license information: ieee754/index.js: diff --git a/src/elven.ts b/src/elven.ts index 067c6b9..1d4d0ad 100644 --- a/src/elven.ts +++ b/src/elven.ts @@ -33,7 +33,8 @@ export { AddressType, AddressValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/address'; +export { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts/interface'; +export { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; export { ElvenJS } from './main'; - -export { LoginMethodsEnum } from './types'; +export * from './types'; diff --git a/tsconfig.json b/tsconfig.json index a0d8e07..35bd15f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,9 +10,7 @@ "moduleResolution": "Node", "allowSyntheticDefaultImports": true, "resolveJsonModule": true, - "types": [ - "node" - ], - "skipLibCheck": true - } + "types": ["node"], + "skipLibCheck": true, + }, }